Download wp-calypso/client/blocks/post-share/connections-list.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/blocks/post-share/connections-list.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/blocks/post-share/connections-list.jsx
-
curl -L -o connections-list.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/blocks/post-share/connections-list.jsx
1.11 kB
| import PropTypes from 'prop-types'; | |
| import { PureComponent } from 'react'; | |
| import Connection from './connection'; | |
| class ConnectionsList extends PureComponent { | |
| static propTypes = { | |
| connections: PropTypes.array, | |
| onToggle: PropTypes.func, | |
| siteId: PropTypes.number, | |
| siteSlug: PropTypes.string, | |
| }; | |
| static defaultProps = { | |
| connections: [], | |
| }; | |
| renderEmptyPlaceholder() { | |
| return ( | |
| <div className="post-share__main"> | |
| <div className="post-share__form is-placeholder" /> | |
| <div className="post-share__services is-placeholder" /> | |
| </div> | |
| ); | |
| } | |
| render() { | |
| const { connections, onToggle, siteId } = this.props; | |
| if ( ! siteId || ! connections.length ) { | |
| return null; | |
| } | |
| if ( ! this.props.hasFetchedConnections ) { | |
| return this.renderEmptyPlaceholder(); | |
| } | |
| return ( | |
| <div className="post-share__connections"> | |
| { connections.map( ( connection ) => ( | |
| <Connection | |
| key={ connection.ID } | |
| { ...{ | |
| connection, | |
| onToggle, | |
| isActive: connection.isActive, | |
| } } | |
| /> | |
| ) ) } | |
| </div> | |
| ); | |
| } | |
| } | |
| export default ConnectionsList; | |