refactor: ClearColumnButton

This commit is contained in:
scarf 2025-03-27 01:58:33 +09:00
parent a97ee55650
commit 70085dd2ed
No known key found for this signature in database
GPG Key ID: 07CA0A3CCA037E7D
2 changed files with 27 additions and 21 deletions

View File

@ -1,21 +0,0 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import { FormattedMessage } from 'react-intl';
import DeleteForeverIcon from '@/material-icons/400-24px/delete_forever.svg?react';
import { Icon } from 'mastodon/components/icon';
export default class ClearColumnButton extends PureComponent {
static propTypes = {
onClick: PropTypes.func.isRequired,
};
render () {
return (
<button className='text-btn column-header__setting-btn' tabIndex={0} onClick={this.props.onClick}><Icon id='eraser' icon={DeleteForeverIcon} /> <FormattedMessage id='notifications.clear' defaultMessage='Clear notifications' /></button>
);
}
}

View File

@ -0,0 +1,27 @@
import React, { MouseEventHandler } from 'react';
import { FormattedMessage } from 'react-intl';
import DeleteForeverIcon from '@/material-icons/400-24px/delete_forever.svg?react';
import { Icon } from 'mastodon/components/icon';
interface Props {
onClick?: MouseEventHandler<HTMLButtonElement>;
}
const ClearColumnButton: React.FC<Props> = ({ onClick }) => {
return (
<button
className='text-btn column-header__setting-btn'
tabIndex={0}
onClick={onClick}
>
<Icon id='eraser' icon={DeleteForeverIcon} />{' '}
<FormattedMessage
id='notifications.clear'
defaultMessage='Clear notifications'
/>
</button>
);
};
export default ClearColumnButton;