Skip to content

Commit

Permalink
feat: 대시보드 Navbar 및 초기 화면 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
YerangPark committed Sep 11, 2024
1 parent 94ab647 commit 7d2cd3e
Show file tree
Hide file tree
Showing 14 changed files with 123 additions and 12 deletions.
5 changes: 5 additions & 0 deletions src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import DashboardPage from '@/components/templates/DashboardPage'

export default function Page() {
return <DashboardPage />
}
4 changes: 2 additions & 2 deletions src/components/atoms/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { Button as ChakraButton } from '@chakra-ui/react'
import { ButtonProps } from '@/types/style'

const Button: React.FC<ButtonProps> = ({ label, onClick, disabled = false, bg, color, _hover, ...props}) => {
const Button: React.FC<ButtonProps> = ({ children, onClick, disabled = false, bg, color, _hover, ...props}) => {
return (
<ChakraButton
onClick={onClick}
Expand All @@ -11,7 +11,7 @@ const Button: React.FC<ButtonProps> = ({ label, onClick, disabled = false, bg, c
color={color}
_hover={_hover}
{...props}>
{label}
{children}
</ChakraButton>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/DefaultButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const DefaultButton: React.FC<DefaultButtonProps> = ({ label, onClick, theme, mr
return (
<div>
<Button
label={label}
children={label}
onClick={onClick}
bg={themeOption.bg}
color={themeOption.color}
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/RoundButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const RoundButton: React.FC<DefaultButtonProps> = ({ label, onClick, color, size
return (
<div>
<Button
label={label}
children={label}
onClick={onClick}
color="white"
bg={color}
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/SubmitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface SubmitButtonProps {
const SubmitButton: React.FC<SubmitButtonProps> = ({ onSubmit }) => {
return (
<Button
label="Submit"
children="submit"
onClick={onSubmit}
bg="brand.primary1"
color="white"
Expand Down
19 changes: 19 additions & 0 deletions src/components/molecules/UserButtonWithMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Button, Icon, Menu, MenuButton, MenuItem, MenuList } from '@chakra-ui/react'
import React from 'react'
import { FaUser } from 'react-icons/fa'

const UserButtonWithMenu: React.FC = () => {
return (
<Menu>
<MenuButton as={Button} bg="white" border="1px solid" borderColor="gray.200">
<Icon as={FaUser} />
</MenuButton>
<MenuList>
<MenuItem>로그아웃</MenuItem>
<MenuItem>개인정보 수정</MenuItem>
</MenuList>
</Menu>
)
}

export default UserButtonWithMenu
13 changes: 13 additions & 0 deletions src/components/organisms/DashboardContent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { DashboardProps } from '@/types/data'
import React from 'react'

const DashboardContent: React.FC<DashboardProps> = ({ data }) => {
// 대시보드 카드 형식으로 보여줘야 함.
return (
<>

</>
)
}

export default DashboardContent
21 changes: 21 additions & 0 deletions src/components/organisms/DashboardNavBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// src/components/organisms/Navbar.tsx
'use client'

import React from 'react'
import { Box, Flex, Icon, Spacer } from '@chakra-ui/react'
import Logo from '@/components/atoms/Logo'
import UserButtonWithMenu from '../molecules/UserButtonWithMenu'

const DashboardNavBar: React.FC = () => {
return (
<Box bg="white" px={4}>
<Flex alignItems="center" py={4}>
<Logo />
<Spacer />
<UserButtonWithMenu />
</Flex>
</Box>
);
};

export default DashboardNavBar;
31 changes: 31 additions & 0 deletions src/components/organisms/EmptyDashboardContents.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use client'
import { Box } from '@chakra-ui/react'
import React from 'react'
import { Heading } from '../atoms/Text'
import RoundButton from '../molecules/RoundButton'

const EmptyDashboardContents: React.FC = () => {
return (
<>
<Box
textAlign="center"
mt={150}
>
<Box mb={15}>
<Heading content="포트폴리오를 생성해주세요." fontSize="4xl" color="brand.text1" />
</Box>
<RoundButton
label="생성하기"
color="brand.primary1"
px={24}
py={6}
fontWeight="bold"
fontSize="2xl"
onClick={()=>console.log('포트폴리오 만드는 페이지로 이동')}
/>
</Box>
</>
)
}

export default EmptyDashboardContents
2 changes: 1 addition & 1 deletion src/components/organisms/LoginModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const LoginModal: React.FC<LoginModalProps> = ({ isOpen, onClose, openSignupModa
</Flex>
</FormControl>

<Button color="white" bg="brand.primary1" width="100%" onClick={handleSubmit} label="로그인" />
<Button color="white" bg="brand.primary1" width="100%" onClick={handleSubmit} children="로그인" />
{errorMessage && (
<Alert
status="error"
Expand Down
12 changes: 7 additions & 5 deletions src/components/organisms/SignupModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const SignupModal: React.FC<SignupModalProps> = ({ isOpen, onClose, openLoginMod
headers: {
"Content-Type": "application/json",
},
credentials: 'include',
body: JSON.stringify({
username: formData.username,
name: formData.name,
Expand Down Expand Up @@ -125,13 +126,14 @@ const SignupModal: React.FC<SignupModalProps> = ({ isOpen, onClose, openLoginMod
// 폼 데이터를 초기화하는 함수
const handleReset = () => {
setFormData(initialFormData);
setErrorMessage(null); // 에러 메시지 초기화
setErrorMessage(null);
};

// 모달을 닫을 때 폼을 초기화
const handleClose = () => {
handleReset(); // 모달을 닫을 때 초기화
onClose(); // 모달 닫기 함수 호출
handleReset();
setIsSignupSuccess(false);
onClose();
};

return (
Expand Down Expand Up @@ -220,7 +222,7 @@ const SignupModal: React.FC<SignupModalProps> = ({ isOpen, onClose, openLoginMod
</ModalBody>

<ModalFooter>
<Button color="white" bg="brand.primary1" width="100%" onClick={handleSubmit} label="회원가입" />
<Button color="white" bg="brand.primary1" width="100%" onClick={handleSubmit} children="회원가입" />
</ModalFooter>

<ModalFooter justifyContent="center">
Expand Down Expand Up @@ -249,7 +251,7 @@ const SignupModal: React.FC<SignupModalProps> = ({ isOpen, onClose, openLoginMod
handleClose();
openLoginModal();
}}
label="로그인 하러 가기"
children="로그인 하러 가기"
mt={6}
/>
</Box>
Expand Down
16 changes: 16 additions & 0 deletions src/components/templates/DashboardPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
import DashboardNavBar from '../organisms/DashboardNavBar'
import { Heading } from '../atoms/Text'
import EmptyDashboardContents from '../organisms/EmptyDashboardContents'

const DashboardPage: React.FC = () => {
return (
<div>
<DashboardNavBar />
<Heading content="대시보드" fontSize="4xl" color="brand.text1"/>
<EmptyDashboardContents />
</div>
)
}

export default DashboardPage
3 changes: 3 additions & 0 deletions src/types/data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface DashboardProps {

}
3 changes: 2 additions & 1 deletion src/types/style.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ResponsiveValue, SystemStyleObject } from "@chakra-ui/react"
import { ReactNode } from "react"

export interface ButtonProps {
label: string
onClick: () => void
bg: string
color: string
Expand All @@ -16,6 +16,7 @@ export interface ButtonProps {
mr?: number | string
width?: string | number
mt?: number | string;
children?: ReactNode | string | undefined
}

export interface InputProps {
Expand Down

0 comments on commit 7d2cd3e

Please sign in to comment.