Download wp-calypso/packages/components/src/segmented-control/index.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 768 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/components/src/segmented-control/index.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/packages/components/src/segmented-control/index.jsx
-
curl -L -o index.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/components/src/segmented-control/index.jsx
768 Bytes
| import clsx from 'clsx'; | |
| import PropTypes from 'prop-types'; | |
| import { Component } from 'react'; | |
| import SegmentedControlItem from './item'; | |
| import './style.scss'; | |
| export default class SegmentedControl extends Component { | |
| static Item = SegmentedControlItem; | |
| static propTypes = { | |
| className: PropTypes.string, | |
| compact: PropTypes.bool, | |
| primary: PropTypes.bool, | |
| style: PropTypes.object, | |
| children: PropTypes.node.isRequired, | |
| }; | |
| render() { | |
| const segmentedClasses = { | |
| 'is-compact': this.props.compact, | |
| 'is-primary': this.props.primary, | |
| }; | |
| return ( | |
| <ul | |
| className={ clsx( 'segmented-control', segmentedClasses, this.props.className ) } | |
| style={ this.props.style } | |
| role="radiogroup" | |
| > | |
| { this.props.children } | |
| </ul> | |
| ); | |
| } | |
| } | |