Skip to content

Commit

Permalink
init: 폴더구조, 절대 경로, 레이아웃 및 전역 스타일링 기본 구조 세팅
Browse files Browse the repository at this point in the history
  • Loading branch information
ocahs9 committed Nov 15, 2024
1 parent 4ab36f2 commit 1d3de64
Show file tree
Hide file tree
Showing 22 changed files with 113 additions and 7 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
25 changes: 20 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
import { useState } from 'react'
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import { Navigate } from "react-router-dom";
import Layout from "@pages/Layout/Layout"
import Main from "@pages/Main/Main";

const router = createBrowserRouter([
{
path: "/",
element: <Layout/>,
children: [
{
path: "/",
element : <Main/>
},

],
errorElement: <Navigate to={"/"}/>
}
])

function App() {
const [count, setCount] = useState(0)

function App() {
return (
<>


<RouterProvider router={router}/>
</>
)
}
Expand Down
1 change: 1 addition & 0 deletions src/apis/apis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//예시
Empty file added src/assets/images/.keep
Empty file.
Empty file added src/assets/svgs/.keep
Empty file.
Empty file added src/components/Main/Comp1/.keep
Empty file.
Empty file added src/components/Main/Comp2/.keep
Empty file.
Empty file.
Empty file.
Empty file.
1 change: 1 addition & 0 deletions src/constants/mainConstant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//예시
1 change: 1 addition & 0 deletions src/hooks/useExample.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//예시 파일
8 changes: 7 additions & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import App from './App.tsx'
import GlobalStyle from '@styles/GlobalStyle.ts'
import { ThemeProvider } from '@emotion/react'
import theme from '@styles/theme.ts'

createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
<GlobalStyle/>
<ThemeProvider theme={theme}>
<App />
</ThemeProvider>
</StrictMode>,
)
5 changes: 5 additions & 0 deletions src/pages/Layout/Layout.styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import styled from "@emotion/styled";

//레이아웃 스타일 정의 예시
export const LayoutWrapper = styled.div`
`;
12 changes: 12 additions & 0 deletions src/pages/Layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'
import * as S from "./Layout.styled"

const Layout = () => {
return (
<S.LayoutWrapper>

</S.LayoutWrapper>
)
}

export default Layout
4 changes: 4 additions & 0 deletions src/pages/Main/Main.styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import styled from "@emotion/styled";

export const MainWrapper = styled.div`
`;
12 changes: 12 additions & 0 deletions src/pages/Main/Main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'
import * as S from "./Main.styled"

const Main = () => {
return (
<S.MainWrapper>

</S.MainWrapper>
)
}

export default Main
9 changes: 9 additions & 0 deletions src/styles/GlobalStyle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Global,css } from "@emotion/react";

export const globalStyle = css`
//여기에 전역 상태 정의!
`

const GlobalStyle = () => <Global styles={globalStyle}/>

export default GlobalStyle;
10 changes: 10 additions & 0 deletions src/styles/emotion.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import "@emotion/react";
import { ColorType, FontType } from "./theme";

declare module "@emotion/react" {
export interface Theme {
colors: ColorType,
fonts: FontType
}
}

18 changes: 18 additions & 0 deletions src/styles/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const colors = {
//여기에 색 정의

};

const fonts = {
//여기에 폰트 정의
};

const theme = {
colors,
fonts,
};

export default theme;

export type ColorType = typeof theme.colors;
export type FontType = typeof theme.fonts;
Empty file added src/utils/.keep
Empty file.
14 changes: 13 additions & 1 deletion tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,19 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
"noUncheckedSideEffectImports": true,
"baseUrl": "./",
"paths": {
"@assets/*": ["src/assets/*"],
"@pages/*": ["src/pages/*"],
"@components/*": ["src/components/*"],
"@styles/*": ["src/styles/*"],
"@constants/*": ["src/constants/*"],
"@hooks/*": ["src/hooks/*"],
"@utils/*": ["src/utils/*"],
"@apis/*": ["src/apis/*"],
},
},

"include": ["src"]
}

0 comments on commit 1d3de64

Please sign in to comment.