diff --git a/src/const/ColorPalette.ts b/src/const/ColorPalette.ts index 0c50cfe..945f260 100644 --- a/src/const/ColorPalette.ts +++ b/src/const/ColorPalette.ts @@ -1,4 +1,5 @@ export type ColorPaletteType = { + index: number; style: string; main: boolean; } @@ -6,75 +7,93 @@ export type ColorPaletteType = { export const ColorPalette: Record = { Black: { + index: 0, style: '#000000', main: true }, White: { + index: 1, style: '#FFFFFF', main: true }, PeachCream: { + index: 2, style: '#FFDAB9', main: false }, CoralPink: { + index: 3, style: '#F08080', main: true }, MintIcing: { + index: 4, style: '#C1E1C1', main: false }, Vanilla: { + index: 5, style: '#FFFACD', main: true }, Wheat: { + index: 6, style: '#F5DEB3', main: false }, AliceBlue: { + index: 7, style: '#F0F8FF', main: true }, Lavender: { + index: 8, style: '#E6E6FA', main: false }, LightAqua: { + index: 9, style: '#A8E6CF', main: true }, CloudWhite: { + index: 10, style: '#F0F8FF', main: false }, LightGray: { + index: 11, style: '#D3D3D3', main: true }, LightKhakki: { + index: 12, style: '#F0F8E6', main: false }, DustyRose: { + index: 13, style: '#D8BFD8', - main: false + main: true }, CreamBeige: { + index: 14, style: '#FAF0E6', main: true, }, Oatmeal: { + index: 15, style: '#FDF5E6', main: false }, CharcoalLight: { + index: 16, style: '#A9A9A9', main: true }, - custom: { - style: 'transprent', - main: true + Custom: { + index: 17, + style: 'transparent', + main: false }, } \ No newline at end of file diff --git a/src/hooks/use-palette.ts b/src/hooks/use-palette.ts index 3afed53..a94f704 100644 --- a/src/hooks/use-palette.ts +++ b/src/hooks/use-palette.ts @@ -9,7 +9,7 @@ export function usePalette() { const getMainPaletteList = () => { const paletteKeys = Object.keys(ColorPalette); - const paletteList: ColorPaletteType[] = []; + let paletteList: ColorPaletteType[] = []; paletteKeys.forEach((paletteKey) => { const key = paletteKey as keyof typeof ColorPalette; const palette: ColorPaletteType = ColorPalette[key]; @@ -18,12 +18,14 @@ export function usePalette() { } }); + paletteList = paletteList.sort((a, b) => a.index - b.index); + return paletteList; } const getExtraPaletteList = () => { - const paletteKeys = Object.keys(ColorPalette); - const paletteList: ColorPaletteType[] = []; + const paletteKeys = Object.keys(ColorPalette); + let paletteList: ColorPaletteType[] = []; paletteKeys.forEach((paletteKey) => { const key = paletteKey as keyof typeof ColorPalette; const palette: ColorPaletteType = ColorPalette[key]; @@ -31,11 +33,11 @@ export function usePalette() { paletteList.push(palette); } }); - + paletteList = paletteList.sort((a, b) => a.index - b.index); return paletteList; } - const getAllPaletteList = [...getMainPaletteList(), ...getExtraPaletteList()]; + const getAllPaletteList = [...getMainPaletteList(), ...getExtraPaletteList()].sort((a, b) => a.index - b.index); const getPaletteByKey = (key: keyof typeof ColorPalette) => { return ColorPalette[key]; diff --git a/src/layouts/Layout.tsx b/src/layouts/Layout.tsx index 8bff8ae..be7a761 100644 --- a/src/layouts/Layout.tsx +++ b/src/layouts/Layout.tsx @@ -1,5 +1,5 @@ import SideBar from "@/ui/component/SideBar"; -import { Outlet } from "react-router-dom"; +import { Outlet, useNavigate } from "react-router-dom"; import { SidebarProvider } from "@/components/ui/sidebar"; import Header from "@/ui/component/Header"; import { useAuthStore } from '@/store/authStore'; @@ -11,9 +11,22 @@ import { OctagonXIcon, TriangleAlertIcon, } from "lucide-react"; +import { useState } from "react"; export default function Layout() { const { authData } = useAuthStore(); + const [open, setOpen] = useState(false); + const navigate = useNavigate(); + const pathname = location.pathname; + + const goTo = (path: string) => { + console.log(path); + console.log(pathname); + if (path === pathname) return; + navigate(path); + setOpen(false); + } + return ( <> - +
{ authData ?
: null}
diff --git a/src/ui/component/SideBar.tsx b/src/ui/component/SideBar.tsx index 2e91130..417768b 100644 --- a/src/ui/component/SideBar.tsx +++ b/src/ui/component/SideBar.tsx @@ -5,11 +5,20 @@ import { SidebarFooter, SidebarHeader } from '@/components/ui/sidebar'; +import { PageRouting } from '@/const/PageRouting'; + +interface SideBarProps { + goTo: (path: string) => void; +} +export default function SideBar({ goTo } : SideBarProps) { -export default function SideBar() { return ( - + + +
goTo(PageRouting["HOME"].path)}>Home
+
goTo(PageRouting["SCHEDULES"].path)}>Schedules
+
); } \ No newline at end of file diff --git a/src/ui/component/popover/ColorPickPopover.tsx b/src/ui/component/popover/ColorPickPopover.tsx index 2595c6d..669b811 100644 --- a/src/ui/component/popover/ColorPickPopover.tsx +++ b/src/ui/component/popover/ColorPickPopover.tsx @@ -31,18 +31,17 @@ export const ColorPickPopover = ({ setColor }: ColorPickPopoverProps) => { - - {getSlicedList(mainPaletteList, 5).map((list) => ( -
- {list.map((palette) => ( -
setColor(palette)} - /> - ))} -
- ))} + {getSlicedList(mainPaletteList, 5).map((list) => ( +
+ {list.map((palette) => ( +
setColor(palette)} + /> + ))} +
+ ))} { !seeMore ?
setSeeMore(true)}>더 보기
@@ -52,7 +51,10 @@ export const ColorPickPopover = ({ setColor }: ColorPickPopoverProps) => { {list.map((palette) => (
setColor(palette)} /> ))} @@ -60,6 +62,11 @@ export const ColorPickPopover = ({ setColor }: ColorPickPopoverProps) => { ))} } + { + seeMore + ?
setSeeMore(false)}>접기
+ : null + } ) } \ No newline at end of file diff --git a/src/ui/component/popover/SchedulePopover.tsx b/src/ui/component/popover/SchedulePopover.tsx index 953eafe..9d98220 100644 --- a/src/ui/component/popover/SchedulePopover.tsx +++ b/src/ui/component/popover/SchedulePopover.tsx @@ -6,6 +6,7 @@ import { useEffect, useState } from 'react'; import { usePalette } from '@/hooks/use-palette'; import { type ColorPaletteType } from '@/const/ColorPalette'; import { ColorPickPopover } from './ColorPickPopover'; +import { Input } from '@/components/ui/input'; interface ScheduleSheetProps { date: Date | undefined; @@ -43,15 +44,16 @@ export const SchedulePopover = ({ date, popoverSide, popoverAlign }: ScheduleShe ) } > -
+
@@ -59,6 +61,13 @@ export const SchedulePopover = ({ date, popoverSide, popoverAlign }: ScheduleShe setColor={selectColor} /> +
diff --git a/src/ui/page/account/login/LoginPage.tsx b/src/ui/page/account/login/LoginPage.tsx index c7fffaf..d78f985 100644 --- a/src/ui/page/account/login/LoginPage.tsx +++ b/src/ui/page/account/login/LoginPage.tsx @@ -83,7 +83,10 @@ export default function LoginPage() { throw new Error(res.data.message); } }, - error: (err: Error) => err.message || "에러 발생" + error: (err: Error) => { + setIsLoading(false); + return err.message || "에러 발생" + } } ); } diff --git a/vite.config.ts b/vite.config.ts index 732dddd..a364a9c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,6 +5,7 @@ import path from 'path' // https://vite.dev/config/ export default defineConfig({ server: { + host: '0.0.0.0', port: 5185 }, plugins: [