Download wp-calypso/client/blocks/comments/post-comment-content.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/blocks/comments/post-comment-content.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/blocks/comments/post-comment-content.jsx
-
curl -L -o post-comment-content.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/blocks/comments/post-comment-content.jsx
1.38 kB
| import clsx from 'clsx'; | |
| import { localize } from 'i18n-calypso'; | |
| import PropTypes from 'prop-types'; | |
| import { Component } from 'react'; | |
| import AutoDirection from 'calypso/components/auto-direction'; | |
| import './post-comment-content.scss'; | |
| class PostCommentContent extends Component { | |
| static propTypes = { | |
| content: PropTypes.string.isRequired, | |
| isPlaceholder: PropTypes.bool, | |
| className: PropTypes.string, | |
| setWithDimensionsRef: PropTypes.func, | |
| }; | |
| static defaultProps = { | |
| setWithDimensionsRef: () => {}, | |
| }; | |
| render() { | |
| // Don't trust comment content unless it was provided by the API | |
| if ( this.props.isPlaceholder ) { | |
| return ( | |
| <div className={ clsx( 'comments__comment-content', this.props.className ) }> | |
| { this.props.content.split( '\n' ).map( ( item, key ) => { | |
| return ( | |
| <span key={ key }> | |
| { item } | |
| <br /> | |
| </span> | |
| ); | |
| } ) } | |
| </div> | |
| ); | |
| } | |
| /*eslint-disable react/no-danger*/ | |
| return ( | |
| <AutoDirection> | |
| <div className={ clsx( 'comments__comment-content-wrapper', this.props.className ) }> | |
| <div | |
| className="comments__comment-content" | |
| ref={ this.props.setWithDimensionsRef } | |
| dangerouslySetInnerHTML={ { __html: this.props.content } } | |
| /> | |
| </div> | |
| </AutoDirection> | |
| ); | |
| /*eslint-enable react/no-danger*/ | |
| } | |
| } | |
| export default localize( PostCommentContent ); | |