import type { ButtonHTMLAttributes, DetailedHTMLProps, JSX } from 'react'; import { memo } from 'react'; import { useTranslation } from 'next-i18next'; import styles from './SwitchingButtonGroup.module.scss'; const moduleClass = styles['btn-group-switching'] ?? ''; type SwitchingButtonProps = DetailedHTMLProps< ButtonHTMLAttributes, HTMLButtonElement > & { active?: boolean; }; const SwitchingButton = memo((props: SwitchingButtonProps) => { const { active, className, children, onClick, ...rest } = props; return ( ); }); type Props = { showPreview: boolean; onSelected?: (showPreview: boolean) => void; }; export const SwitchingButtonGroup = (props: Props): JSX.Element => { const { t } = useTranslation(); const { showPreview, onSelected } = props; return (
onSelected?.(true)} > play_arrow {t('page_comment.preview')} onSelected?.(false)} > edit_square {t('page_comment.write')}
); };