Skip to content

Commit

Permalink
Merge pull request #61 from modern-agile-team/setting/#37/Styled-comp…
Browse files Browse the repository at this point in the history
…onents_theme

Styled-components의 글로벌 스타일 및 미디어(반응형) 적용
  • Loading branch information
bluetree7878 authored Nov 7, 2024
2 parents 7555211 + 94f4e96 commit d6ba8cd
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 21 deletions.
9 changes: 6 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./src/style/index.css" />
<title>Vite + React + TS</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/fonts-archive/Maplestory/subsets/Maplestory-dynamic-subset.css"
type="text/css"
/>
<title>CokoEdu</title>
</head>
<body>
<div id="root"></div>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.59.0",
"@tanstack/react-query-devtools": "^5.59.0",
"@tanstack/react-query": "^5.59.9",
"@tanstack/react-query-devtools": "^5.59.9",
"@types/dompurify": "^3.0.5",
"axios": "^1.7.7",
"dompurify": "^3.1.7",
Expand Down
9 changes: 8 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Router from './route/Router';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { ThemeProvider } from 'styled-components';
import { media } from './style/media';
import GlobalStyle from './style/GlobalStyle';

function App() {
const queryClient = new QueryClient({
defaultOptions: {
Expand All @@ -13,7 +17,10 @@ function App() {
return (
<>
<QueryClientProvider client={queryClient}>
<Router />
<ThemeProvider theme={media}>
<GlobalStyle />
<Router />
</ThemeProvider>
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/main/Main.tsx → src/pages/learn/Learn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
LayOutDiv,
FeatureDiv,
} from '../../style/LayOut';
export default function Main() {
export default function Learn() {
return (
<AlignCenter>
<GridContainer>
Expand Down
20 changes: 11 additions & 9 deletions src/route/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { BrowserRouter, Route, Routes } from 'react-router-dom';
import Main from '../pages/main/Main';
import Quest from '../pages/Quest/Quest';
import Ranking from '../pages/Ranking/Ranking';
import { BrowserRouter, Route, Routes, Navigate } from 'react-router-dom';
import Learn from '../pages/learn/Learn';
import Quest from '../pages/quest/Quest';
import Ranking from '../pages/ranking/Ranking';
import Quiz from '../pages/quiz/Quiz';
import Login from '../pages/login/Login';

export default function Router() {
return (
<>
<BrowserRouter>
<Routes>
<Route path="/" element={<Main />}></Route>
<Route path="/quest" element={<Quest />}></Route>
<Route path="/ranking" element={<Ranking />}></Route>
<Route path="/quiz" element={<Quiz />}></Route>
<Route path="/login" element={<Login />}></Route>
<Route path="/" element={<Navigate to="/learn" />} />
<Route path="/learn" element={<Learn />} />
<Route path="/quest" element={<Quest />} />
<Route path="/ranking" element={<Ranking />} />
<Route path="/quiz" element={<Quiz />} />
<Route path="/login" element={<Login />} />
</Routes>
</BrowserRouter>
</>
Expand Down
18 changes: 18 additions & 0 deletions src/style/GlobalStyle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { createGlobalStyle } from 'styled-components';

const GlobalStyle = createGlobalStyle`
*, *::before, *::after {
font-family : Maplestory;
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: #FFF8EB;
}
button {
cursor: pointer;
}
`;

export default GlobalStyle;
3 changes: 0 additions & 3 deletions src/style/index.css

This file was deleted.

11 changes: 11 additions & 0 deletions src/style/media.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const media = {
/**
* @example
* ${({ media }) => media.desktop} {
* padding: 3px;
* }
*/
desktop: '@media (min-width: 1280px)',
tablet: '@media (min-width: 768px) and (max-width: 1279px)',
mobile: '@media (max-width: 767px)',
};

0 comments on commit d6ba8cd

Please sign in to comment.