|
1 | | -import React from 'react'; |
2 | | -import { ArrowLeftEndOnRectangleIcon, ArrowRightStartOnRectangleIcon } from '@heroicons/react/24/outline'; |
| 1 | +import React, { useState } from 'react'; |
| 2 | +import { |
| 3 | + ArrowLeftEndOnRectangleIcon, |
| 4 | + ArrowRightStartOnRectangleIcon, |
| 5 | + Cog8ToothIcon, |
| 6 | +} from '@heroicons/react/24/outline'; |
| 7 | + |
3 | 8 | import Tippy from '@tippyjs/react'; |
4 | 9 | import useNavigationStore from 'stores/AppNavBarStore'; |
5 | 10 | import useCollectionStore from 'stores/CollectionStore'; |
| 11 | +import SettingsModal from '../modals/SettingsModal'; |
6 | 12 |
|
7 | 13 | const MainFooter = () => { |
8 | 14 | const collections = useCollectionStore((state) => state.collections); |
9 | 15 | const isNavBarCollapsed = useNavigationStore((state) => state.collapseNavBar); |
10 | 16 | const updateNavCollapseState = useNavigationStore((state) => state.setNavCollapseState); |
| 17 | + const [openSettingsModal, setOpenSettingsModal] = useState(false); |
11 | 18 | return ( |
12 | 19 | <footer className='flex items-center justify-between px-4 py-3 text-xs'> |
13 | | - <label className='swap swap-rotate cursor-pointer py-1'> |
14 | | - <input |
15 | | - type='checkbox' |
16 | | - onClick={(event) => { |
17 | | - if (collections.length) { |
18 | | - // since default is false for isNavBarCollapsed |
19 | | - updateNavCollapseState(!isNavBarCollapsed); |
20 | | - } else { |
21 | | - event.preventDefault(); |
22 | | - event.stopPropagation(); |
23 | | - } |
24 | | - }} |
25 | | - /> |
26 | | - <ArrowRightStartOnRectangleIcon className='swap-on h-6 w-6' /> |
27 | | - <ArrowLeftEndOnRectangleIcon className='swap-off h-6 w-6' /> |
28 | | - </label> |
| 20 | + <div className='flex items-center justify-between gap-2'> |
| 21 | + <button onClick={() => setOpenSettingsModal(true)}> |
| 22 | + <Cog8ToothIcon className='w-6 h-6' /> |
| 23 | + </button> |
| 24 | + <label className='py-1 cursor-pointer swap swap-rotate'> |
| 25 | + <input |
| 26 | + // Overriding styles as Daisy UI input and React Hook form's input were conflicting |
| 27 | + className='!focus:outline-none !focus:ring-0 !appearance-none !border-0 !bg-transparent !bg-none !outline-none' |
| 28 | + type='checkbox' |
| 29 | + onClick={(event) => { |
| 30 | + if (collections.length) { |
| 31 | + // since default is false for isNavBarCollapsed |
| 32 | + updateNavCollapseState(!isNavBarCollapsed); |
| 33 | + } else { |
| 34 | + event.preventDefault(); |
| 35 | + event.stopPropagation(); |
| 36 | + } |
| 37 | + }} |
| 38 | + /> |
| 39 | + <ArrowRightStartOnRectangleIcon className='w-6 h-6 swap-on' /> |
| 40 | + <ArrowLeftEndOnRectangleIcon className='w-6 h-6 swap-off' /> |
| 41 | + </label> |
| 42 | + </div> |
29 | 43 | <div className='flex items-center justify-between gap-4 font-semibold'> |
30 | 44 | <Tippy content='External Link' placement='top'> |
31 | 45 | <a href='https://github.com/FlowTestAI/FlowTest' target='_blank' rel='noreferrer' className='link'> |
@@ -62,6 +76,7 @@ const MainFooter = () => { |
62 | 76 | </a> |
63 | 77 | </Tippy> |
64 | 78 | </div> |
| 79 | + <SettingsModal closeFn={() => setOpenSettingsModal(false)} open={openSettingsModal} /> |
65 | 80 | </footer> |
66 | 81 | ); |
67 | 82 | }; |
|
0 commit comments