Download wp-calypso/client/blocks/comments/comment-approve-action.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/blocks/comments/comment-approve-action.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/blocks/comments/comment-approve-action.jsx
-
curl -L -o comment-approve-action.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/blocks/comments/comment-approve-action.jsx
1.14 kB
| import { Gridicon } from '@automattic/components'; | |
| import { Button } from '@wordpress/components'; | |
| import clsx from 'clsx'; | |
| import { localize } from 'i18n-calypso'; | |
| import PropTypes from 'prop-types'; | |
| import './comment-approve-action.scss'; | |
| const noop = () => {}; | |
| const CommentApproveAction = ( { translate, status, approveComment, unapproveComment } ) => { | |
| const isApproved = status === 'approved'; | |
| const buttonStyle = clsx( 'comments__comment-actions-approve', { | |
| 'is-approved': isApproved, | |
| } ); | |
| return ( | |
| <Button className={ buttonStyle } onClick={ ! isApproved ? approveComment : unapproveComment }> | |
| <Gridicon icon="checkmark" size={ 18 } /> | |
| <span className="comments__comment-actions-like-label"> | |
| { isApproved ? translate( 'Approved' ) : translate( 'Approve' ) } | |
| </span> | |
| </Button> | |
| ); | |
| }; | |
| CommentApproveAction.propTypes = { | |
| translate: PropTypes.func.isRequired, | |
| approveComment: PropTypes.func, | |
| unapproveComment: PropTypes.func, | |
| status: PropTypes.string.isRequired, | |
| }; | |
| CommentApproveAction.defaultProps = { | |
| approveComment: noop, | |
| unapproveComment: noop, | |
| }; | |
| export default localize( CommentApproveAction ); | |