Download wp-calypso/client/blocks/author-selector/docs/example.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 806 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/blocks/author-selector/docs/example.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/blocks/author-selector/docs/example.jsx
-
curl -L -o example.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/blocks/author-selector/docs/example.jsx
806 Bytes
| import { Card } from '@automattic/components'; | |
| import { connect } from 'react-redux'; | |
| import { getCurrentUser } from 'calypso/state/current-user/selectors'; | |
| import AuthorSelector from '../'; | |
| function AuthorSelectorExample( { primarySiteId, displayName } ) { | |
| return ( | |
| <Card> | |
| <AuthorSelector siteId={ primarySiteId } allowSingleUser popoverPosition="bottom"> | |
| <span>You are { displayName } </span> | |
| </AuthorSelector> | |
| </Card> | |
| ); | |
| } | |
| const ConnectedAuthorSelectorExample = connect( ( state ) => { | |
| const user = getCurrentUser( state ); | |
| if ( ! user ) { | |
| return {}; | |
| } | |
| return { | |
| primarySiteId: user.primary_blog, | |
| displayName: user.display_name, | |
| }; | |
| } )( AuthorSelectorExample ); | |
| ConnectedAuthorSelectorExample.displayName = 'AuthorSelector'; | |
| export default ConnectedAuthorSelectorExample; | |