2024-02-01 04:41:12 -05:00
|
|
|
import { memo, type Dispatch, type SetStateAction } from 'react'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
2024-09-03 07:30:25 -04:00
|
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
2024-02-01 04:41:12 -05:00
|
|
|
|
|
|
|
export const OutlineItemToggleButton = memo<{
|
|
|
|
expanded: boolean
|
|
|
|
setExpanded: Dispatch<SetStateAction<boolean>>
|
|
|
|
}>(({ expanded, setExpanded }) => {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
className="outline-item-expand-collapse-btn"
|
|
|
|
onClick={() => setExpanded(value => !value)}
|
|
|
|
aria-label={expanded ? t('collapse') : t('expand')}
|
|
|
|
>
|
2024-09-03 07:30:25 -04:00
|
|
|
<MaterialIcon
|
|
|
|
type={expanded ? 'keyboard_arrow_down' : 'keyboard_arrow_right'}
|
2024-02-01 04:41:12 -05:00
|
|
|
className="outline-caret-icon"
|
|
|
|
/>
|
|
|
|
</button>
|
|
|
|
)
|
|
|
|
})
|
|
|
|
OutlineItemToggleButton.displayName = 'OutlineItemToggleButton'
|