Download wp-calypso/client/blocks/calendar-popover/docs/example.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 932 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/blocks/calendar-popover/docs/example.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/blocks/calendar-popover/docs/example.jsx
-
curl -L -o example.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/blocks/calendar-popover/docs/example.jsx
932 Bytes
| import { Button } from '@automattic/components'; | |
| import moment from 'moment'; | |
| import { createRef, PureComponent } from 'react'; | |
| import CalendarPopover from 'calypso/blocks/calendar-popover'; | |
| const tomorrow = ( date ) => date.date( date.date() + 1 ); | |
| class CalendarPopoverExample extends PureComponent { | |
| buttonRef = createRef(); | |
| state = { show: false, currentDate: tomorrow( moment() ) }; | |
| toggle = () => this.setState( { show: ! this.state.show } ); | |
| close = () => this.setState( { show: false } ); | |
| render() { | |
| return ( | |
| <div> | |
| <Button primary ref={ this.buttonRef } onClick={ this.toggle }> | |
| Show Popover | |
| </Button> | |
| <CalendarPopover | |
| context={ this.buttonRef.current } | |
| isVisible={ this.state.show } | |
| selectedDay={ this.state.currentDate } | |
| onClose={ this.close } | |
| /> | |
| </div> | |
| ); | |
| } | |
| } | |
| CalendarPopoverExample.displayName = 'CalendarPopover'; | |
| export default CalendarPopoverExample; | |