Download wp-calypso/client/components/forms/form-button/index.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 950 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/forms/form-button/index.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/components/forms/form-button/index.jsx
-
curl -L -o index.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/forms/form-button/index.jsx
950 Bytes
| import { Button } from '@automattic/components'; | |
| import clsx from 'clsx'; | |
| import { localize } from 'i18n-calypso'; | |
| import { omit } from 'lodash'; | |
| import { Component, Children } from 'react'; | |
| import './style.scss'; | |
| class FormButton extends Component { | |
| static defaultProps = { | |
| isSubmitting: false, | |
| isPrimary: true, | |
| type: 'submit', | |
| }; | |
| getDefaultButtonAction = () => { | |
| return this.props.isSubmitting | |
| ? this.props.translate( 'Saving…' ) | |
| : this.props.translate( 'Save Settings' ); | |
| }; | |
| render() { | |
| const { children, className, isPrimary, ...props } = this.props; | |
| const buttonClasses = clsx( className, 'form-button' ); | |
| return ( | |
| <Button | |
| { ...omit( props, [ 'isSubmitting', 'moment', 'numberFormat', 'translate' ] ) } | |
| primary={ isPrimary } | |
| className={ buttonClasses } | |
| > | |
| { Children.count( children ) ? children : this.getDefaultButtonAction() } | |
| </Button> | |
| ); | |
| } | |
| } | |
| export default localize( FormButton ); | |