2021-05-17 22:33:04 -07:00
|
|
|
import { TemplateIcon } from '@heroicons/react/outline'
|
2021-05-01 21:31:55 -07:00
|
|
|
import { defaultLayouts, GRID_LAYOUT_KEY } from './TradePageGrid'
|
2021-04-22 05:33:35 -07:00
|
|
|
import useLocalStorageState from '../hooks/useLocalStorageState'
|
2021-04-22 07:45:36 -07:00
|
|
|
import Tooltip from './Tooltip'
|
2021-04-22 05:33:35 -07:00
|
|
|
|
|
|
|
const ResetLayout = ({ className = '' }) => {
|
|
|
|
const [, setSavedLayouts] = useLocalStorageState(
|
2021-05-01 21:31:55 -07:00
|
|
|
GRID_LAYOUT_KEY,
|
2021-04-22 05:33:35 -07:00
|
|
|
defaultLayouts
|
|
|
|
)
|
|
|
|
|
2021-04-22 06:10:43 -07:00
|
|
|
const handleResetLayout = () => {
|
|
|
|
setSavedLayouts(defaultLayouts)
|
|
|
|
}
|
|
|
|
|
2021-04-22 05:33:35 -07:00
|
|
|
return (
|
2021-05-07 12:41:26 -07:00
|
|
|
<div className={`inline-flex relative ${className}`}>
|
2021-04-24 15:02:13 -07:00
|
|
|
<Tooltip content="Reset Layout" className="text-xs py-1">
|
2021-04-22 07:45:36 -07:00
|
|
|
<button
|
|
|
|
onClick={() => handleResetLayout()}
|
2021-04-24 15:02:13 -07:00
|
|
|
className="flex items-center justify-center rounded-full bg-th-bkg-3 w-8 h-8 hover:text-th-primary focus:outline-none"
|
2021-04-22 07:45:36 -07:00
|
|
|
>
|
2021-05-17 22:33:04 -07:00
|
|
|
<TemplateIcon className="w-4 h-4" />
|
2021-04-22 07:45:36 -07:00
|
|
|
</button>
|
|
|
|
</Tooltip>
|
2021-04-22 05:33:35 -07:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ResetLayout
|