import { Fragment } from 'react' import { IconProp } from '@fortawesome/fontawesome-svg-core' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { Listbox, Transition } from '@headlessui/react' import { useTranslation } from 'next-i18next' import useLocalStorage from '../utils/useLocalStorage' export const layouts: Array<{ id: number; name: 'Grid' | 'List'; icon: IconProp }> = [ { id: 1, name: 'List', icon: 'th-list' }, { id: 2, name: 'Grid', icon: 'th' }, ] const SwitchLayout = () => { const [preferredLayout, setPreferredLayout] = useLocalStorage('preferredLayout', layouts[0]) const { t } = useTranslation() return (
{ // t('Grid') // t('List') t(preferredLayout.name) } {layouts.map(layout => ( { // t('Grid') // t('List') t(layout.name) } {layout.name === preferredLayout.name && ( )} ))}
) } export default SwitchLayout