Download wp-calypso/client/layout/guided-tours/config-elements/tour.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 664 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/layout/guided-tours/config-elements/tour.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/layout/guided-tours/config-elements/tour.js
-
curl -L -o tour.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/layout/guided-tours/config-elements/tour.js
664 Bytes
| import PropTypes from 'prop-types'; | |
| import { Component } from 'react'; | |
| import { contextTypes } from '../context-types'; | |
| export default class Tour extends Component { | |
| static propTypes = { | |
| name: PropTypes.string.isRequired, | |
| version: PropTypes.string, | |
| path: PropTypes.oneOfType( [ PropTypes.string, PropTypes.arrayOf( PropTypes.string ) ] ), | |
| when: PropTypes.func, | |
| }; | |
| static contextTypes = contextTypes; | |
| render() { | |
| const { children } = this.props; | |
| const { step } = this.context; | |
| const nextStep = Array.isArray( children ) | |
| ? children.find( ( stepComponent ) => stepComponent.props.name === step ) | |
| : children; | |
| return nextStep || null; | |
| } | |
| } | |