|
| 1 | +import { PropsWithChildren } from 'react'; |
| 2 | +import { Link } from '@remix-run/react'; |
| 3 | +import { |
| 4 | + Award01Icon, |
| 5 | + CoinsStacked03Icon, |
| 6 | + CurrencyDollarCircleIcon, |
| 7 | + Diamond01Icon, |
| 8 | + GraduationHat01Icon, |
| 9 | + Lightbulb02Icon, |
| 10 | + UserRight01Icon, |
| 11 | + Users01Icon, |
| 12 | + UsersPlusIcon, |
| 13 | + UserUp02Icon, |
| 14 | +} from '@var-meta/icons'; |
| 15 | +import { CalendarIcon, HStack, Sidebar, Layout as VarLayout } from '@var-meta/ui'; |
| 16 | + |
| 17 | +const Logo = () => ( |
| 18 | + <svg width={40} height={40} viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 19 | + <g filter="url(#a)"> |
| 20 | + <rect width={40} height={40} rx={20} fill="#312DCA" /> |
| 21 | + <path |
| 22 | + d="m22.139 25.065-2.277-3.956a.31.31 0 0 0-.536 0l-2.284 3.956a.31.31 0 0 0 .268.464h4.564a.31.31 0 0 0 .265-.464" |
| 23 | + fill="#fff" |
| 24 | + /> |
| 25 | + <path |
| 26 | + d="m21.89 15.007.004-.007h-.658c-.11 0-.214.06-.268.153l-1.037 1.797a.31.31 0 0 1-.536 0l-1.033-1.796a.3.3 0 0 0-.268-.154l-11.784.007a.31.31 0 0 0-.268.464l5.715 9.915a.3.3 0 0 0 .268.154h3.614c.11 0 .214-.06.268-.154l3.488-6.048a.309.309 0 0 1 .537 0l3.488 6.048a.3.3 0 0 0 .268.154h3.614c.11 0 .214-.06.268-.154l5.722-9.922a.31.31 0 0 0-.268-.464z" |
| 27 | + fill="#fff" |
| 28 | + /> |
| 29 | + </g> |
| 30 | + <defs> |
| 31 | + <filter id="a" x={0} y={-4} width={40} height={44} filterUnits="userSpaceOnUse" colorInterpolationFilters="sRGB"> |
| 32 | + <feFlood floodOpacity={0} result="BackgroundImageFix" /> |
| 33 | + <feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape" /> |
| 34 | + <feColorMatrix in="SourceAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha" /> |
| 35 | + <feOffset dy={-4} /> |
| 36 | + <feGaussianBlur stdDeviation={4} /> |
| 37 | + <feComposite in2="hardAlpha" operator="arithmetic" k2={-1} k3={1} /> |
| 38 | + <feColorMatrix values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.64 0" /> |
| 39 | + <feBlend in2="shape" result="effect1_innerShadow_31_6926" /> |
| 40 | + </filter> |
| 41 | + </defs> |
| 42 | + </svg> |
| 43 | +); |
| 44 | + |
| 45 | +const links = [ |
| 46 | + { |
| 47 | + title: 'GENERAL', |
| 48 | + routes: [ |
| 49 | + { |
| 50 | + icon: <Users01Icon className="h-5 w-5" />, |
| 51 | + label: 'Staff List', |
| 52 | + value: 'Staff List', |
| 53 | + href: '/', |
| 54 | + }, |
| 55 | + { |
| 56 | + icon: <UserRight01Icon className="h-5 w-5" />, |
| 57 | + label: 'Request', |
| 58 | + value: 'Request', |
| 59 | + dropdowns: [ |
| 60 | + { |
| 61 | + label: 'Work from home', |
| 62 | + value: 'Work from home', |
| 63 | + href: '/', |
| 64 | + }, |
| 65 | + { |
| 66 | + label: 'Day off', |
| 67 | + value: 'Day off', |
| 68 | + href: '/', |
| 69 | + }, |
| 70 | + { |
| 71 | + label: 'CI/CO', |
| 72 | + value: 'CI/CO', |
| 73 | + href: '/', |
| 74 | + }, |
| 75 | + { |
| 76 | + label: 'Overtime', |
| 77 | + value: 'Overtime', |
| 78 | + href: '/', |
| 79 | + }, |
| 80 | + ], |
| 81 | + }, |
| 82 | + { |
| 83 | + icon: <Award01Icon className="h-5 w-5" />, |
| 84 | + label: 'Ranking Chart', |
| 85 | + value: 'Ranking Chart', |
| 86 | + href: '/', |
| 87 | + }, |
| 88 | + ], |
| 89 | + }, |
| 90 | + |
| 91 | + { |
| 92 | + title: 'SALARY', |
| 93 | + routes: [ |
| 94 | + { |
| 95 | + icon: <CalendarIcon className="h-5 w-5" />, |
| 96 | + label: 'Time Keeping', |
| 97 | + value: 'Time Keeping', |
| 98 | + href: '/', |
| 99 | + }, |
| 100 | + { |
| 101 | + icon: <CurrencyDollarCircleIcon className="h-5 w-5" />, |
| 102 | + label: 'Payroll', |
| 103 | + value: 'Payroll', |
| 104 | + href: '/', |
| 105 | + }, |
| 106 | + { |
| 107 | + icon: <UserUp02Icon className="h-5 w-5" />, |
| 108 | + label: 'Check Point', |
| 109 | + value: 'Check Point', |
| 110 | + href: '/', |
| 111 | + }, |
| 112 | + ], |
| 113 | + }, |
| 114 | + |
| 115 | + { |
| 116 | + title: 'MANAGEMENT', |
| 117 | + routes: [ |
| 118 | + { |
| 119 | + icon: <CoinsStacked03Icon className="h-5 w-5" />, |
| 120 | + label: 'Resource Management', |
| 121 | + value: 'Resource Management', |
| 122 | + href: '/', |
| 123 | + }, |
| 124 | + { |
| 125 | + icon: <Lightbulb02Icon className="h-5 w-5" />, |
| 126 | + label: 'Initiative Management', |
| 127 | + value: 'Initiative Management', |
| 128 | + href: '/', |
| 129 | + }, |
| 130 | + { |
| 131 | + icon: <Diamond01Icon className="h-5 w-5" />, |
| 132 | + label: 'Asset Management', |
| 133 | + value: 'Asset Management', |
| 134 | + href: '/', |
| 135 | + }, |
| 136 | + { |
| 137 | + icon: <UsersPlusIcon className="h-5 w-5" />, |
| 138 | + label: 'Recruitment Management', |
| 139 | + value: 'Recruitment Management', |
| 140 | + href: '/', |
| 141 | + }, |
| 142 | + { |
| 143 | + icon: <GraduationHat01Icon className="h-5 w-5" />, |
| 144 | + label: 'Skills Management', |
| 145 | + value: 'Skills Management', |
| 146 | + href: '/', |
| 147 | + }, |
| 148 | + ], |
| 149 | + }, |
| 150 | +]; |
| 151 | + |
| 152 | +const Layout = ({ children }: PropsWithChildren) => { |
| 153 | + return ( |
| 154 | + <div className="bg-background border-border relative min-h-[80vh] border"> |
| 155 | + <VarLayout> |
| 156 | + <Sidebar.Overlay /> |
| 157 | + <Sidebar> |
| 158 | + <Sidebar.Head> |
| 159 | + <Sidebar.Head.Toggle /> |
| 160 | + |
| 161 | + <Sidebar.Head.Logo> |
| 162 | + <Logo /> |
| 163 | + </Sidebar.Head.Logo> |
| 164 | + <Sidebar.Head.Title>Excellent in Every Block</Sidebar.Head.Title> |
| 165 | + </Sidebar.Head> |
| 166 | + |
| 167 | + <Sidebar.Body> |
| 168 | + {links.map((link) => ( |
| 169 | + <Sidebar.Body.Section key={link.title}> |
| 170 | + <Sidebar.Body.Title>{link.title}</Sidebar.Body.Title> |
| 171 | + <Sidebar.Body.List> |
| 172 | + {link.routes.map((item) => { |
| 173 | + if (item?.dropdowns) { |
| 174 | + return ( |
| 175 | + <Sidebar.Body.List.Dropdown key={item.label} icon={item.icon} label={item.label}> |
| 176 | + {item.dropdowns.map((child) => ( |
| 177 | + <Link to={child.href} key={child.value}> |
| 178 | + <Sidebar.Body.List.Item |
| 179 | + as="div" |
| 180 | + value={child.value} |
| 181 | + key={child.value} |
| 182 | + label={child.label} |
| 183 | + /> |
| 184 | + </Link> |
| 185 | + ))} |
| 186 | + </Sidebar.Body.List.Dropdown> |
| 187 | + ); |
| 188 | + } |
| 189 | + |
| 190 | + return ( |
| 191 | + <Link to={item.href} key={item.value}> |
| 192 | + <Sidebar.Body.List.Item |
| 193 | + as="div" |
| 194 | + value={item.value} |
| 195 | + key={item.value} |
| 196 | + icon={item.icon} |
| 197 | + label={item.label} |
| 198 | + /> |
| 199 | + </Link> |
| 200 | + ); |
| 201 | + })} |
| 202 | + </Sidebar.Body.List> |
| 203 | + </Sidebar.Body.Section> |
| 204 | + ))} |
| 205 | + </Sidebar.Body> |
| 206 | + |
| 207 | + <Sidebar.Footer>Footer</Sidebar.Footer> |
| 208 | + </Sidebar> |
| 209 | + |
| 210 | + <VarLayout.Content> |
| 211 | + <HStack className="w-full p-4" pos="apart"> |
| 212 | + <header>Header application</header> |
| 213 | + |
| 214 | + <VarLayout.BurgerMenu /> |
| 215 | + </HStack> |
| 216 | + |
| 217 | + <main className="w-full p-4">{children}</main> |
| 218 | + </VarLayout.Content> |
| 219 | + </VarLayout> |
| 220 | + </div> |
| 221 | + ); |
| 222 | +}; |
| 223 | + |
| 224 | +export default Layout; |
0 commit comments