Skip to content

Commit

Permalink
settings : 레이아웃 세팅
Browse files Browse the repository at this point in the history
- 기본 레이아웃
  • Loading branch information
howooking committed Jul 25, 2023
1 parent 04f3044 commit 9cf4639
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { Route, Routes } from 'react-router-dom';
import NotFound from '@/page/notFound';
import Home from '@/page/home';
import koKR from 'antd/locale/ko_KR';
import Layout from '@/components/Layout';
import Signup from '@/page/signup';
import Singin from '@/page/signin';
import MyAccount from '@/page/myAccount';
import MyLayout from '@/components/MyLayout';

export default function App() {
const theme = {
Expand All @@ -17,7 +17,7 @@ export default function App() {
return (
<ConfigProvider theme={theme} locale={koKR}>
<Routes>
<Route element={<Layout />}>
<Route element={<MyLayout />}>
<Route path="/" element={<Home />} />
<Route path="/signup" element={<Signup />} />
<Route path="/signin" element={<Singin />} />
Expand Down
1 change: 0 additions & 1 deletion src/assets/react.svg

This file was deleted.

10 changes: 0 additions & 10 deletions src/components/Layout.tsx

This file was deleted.

16 changes: 16 additions & 0 deletions src/components/MyHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { NAV_ITEMS } from '@/data/constants';
import { Space } from 'antd';
import { Header } from 'antd/es/layout/layout';
import { Link } from 'react-router-dom';

export default function MyHeader() {
return (
<Header style={{ backgroundColor: 'palegreen' }}>
<Space size="large">
{NAV_ITEMS.map((item) => (
<Link to={item.href}>{item.label}</Link>
))}
</Space>
</Header>
);
}
22 changes: 22 additions & 0 deletions src/components/MyLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Layout } from 'antd';
import { Content } from 'antd/es/layout/layout';
import { Outlet } from 'react-router-dom';
import MyHeader from './MyHeader';

export default function MyLayout() {
return (
<Layout style={{ display: 'flex', minHeight: '100vh' }}>
<MyHeader />
<Content
style={{
flex: 1,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<Outlet />
</Content>
</Layout>
);
}
18 changes: 18 additions & 0 deletions src/data/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export const NAV_ITEMS = [
{
label: '홈',
href: '/',
},
{
label: '로그인',
href: '/signin',
},
{
label: '회원가입',
href: '/signup',
},
{
label: '내계정',
href: '/myaccount',
},
];
Empty file added src/data/dummyData.ts
Empty file.
14 changes: 13 additions & 1 deletion src/page/home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
import { theme } from 'antd';

export default function Home() {
return <div>홈🏠🏠🏠🏠</div>;
const {
token: { colorPrimary, colorPrimaryBg, colorSuccess },
} = theme.useToken();

return (
<div>
홈🏠🏠🏠🏠 <span style={{ color: colorPrimary }}>사용하고 싶으색</span>{' '}
<span style={{ backgroundColor: colorPrimaryBg }}>원하는 색을</span>{' '}
<span style={{ color: colorSuccess }}>theme에서 가져와서 사용</span>
</div>
);
}

0 comments on commit 9cf4639

Please sign in to comment.