Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

메인페이지 그리드 시스템 생성 #23

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<!doctype html>
<!DOCTYPE html>
<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>
</head>
<body>
Expand Down
7 changes: 6 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import Main from './pages/main/Main';
function App() {
return <></>;
return (
<>
<Main></Main>
</>
);
}

export default App;
2 changes: 0 additions & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { createRoot } from 'react-dom/client';
import App from './App.tsx';
import './index.css';

createRoot(document.getElementById('root')!).render(<App />);
76 changes: 76 additions & 0 deletions src/pages/main/Main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { GridDiv } from '../../style/gridSystem';
import { LayOutDiv, FeatureDiv } from './style';
export default function Main() {
return (
<GridDiv>
<LayOutDiv $height="739px">
<FeatureDiv
$width="200px"
$height="35px"
$backGroundColor="#FFFFFF"
$marginTop="50px"
>
로고
</FeatureDiv>
{['learining', 'Ranking', 'quest', 'store', 'profile', 'setting'].map(
(value, index) => (
<FeatureDiv
$width="197px"
$height="53px"
$backGroundColor="#FFFFFF"
$marginTop="46px"
key={index}
>
{value}
</FeatureDiv>
)
)}
</LayOutDiv>
<LayOutDiv $height="100vh ">
<FeatureDiv
$width="676px"
$height="53px"
$backGroundColor="#FFFFFF"
$marginTop="42px"
>
진행도
</FeatureDiv>
<FeatureDiv
$width="676px"
$height="123px"
$backGroundColor="#FFFFFF"
$marginTop="25px"
>
챕터 선택
</FeatureDiv>
<FeatureDiv
$width="676px"
$height="468px"
$backGroundColor="#FFFFFF"
$marginTop="25px"
>
챕터
</FeatureDiv>
</LayOutDiv>

<LayOutDiv $marginTop="42px" $height="303px">
<FeatureDiv
$width="240px"
$height="52px"
$backGroundColor="#FFFFFF"
$marginTop="25px"
>
생명력/프로필
</FeatureDiv>
<FeatureDiv
$width="250px"
$height="197px"
$backGroundColor="#FFFFFF"
$marginTop="54px"
>
일일 퀘스트
</FeatureDiv>
</LayOutDiv>
</GridDiv>
);
}
19 changes: 19 additions & 0 deletions src/pages/main/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import styled from 'styled-components';
import { LayOut } from './type';
//아래 코드는 구역을 나누기 위한 것 일 뿐이니 나중에 지워도 됩니다
export const LayOutDiv = styled.div<LayOut>`
display: flex;
flex-direction: column;
align-items: center;
margin-top: ${({ $marginTop }) => $marginTop || '0px'};
height: ${({ $height }) => $height || '0px'};
background-color: ${({ $backGroundColor }) => $backGroundColor || 'gray'};
`;
export const FeatureDiv = styled.div<LayOut>`
width: ${({ $width }) => $width || '0px'};
height: ${({ $height }) => $height || '0px'};
margin-top: ${({ $marginTop }) => $marginTop || '0px'};
background-color: ${({ $backGroundColor }) => $backGroundColor || 'gray'};
border: solid 1px;
border-radius: 8px;
`;
6 changes: 6 additions & 0 deletions src/pages/main/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface LayOut {
$marginTop?: string;
$height?: string;
$width?: string;
$backGroundColor?: string;
}
8 changes: 8 additions & 0 deletions src/style/gridSystem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import styled from 'styled-components';
export const GridDiv = styled.div`
display: grid;
margin: 0 24px 0 24px;
grid-template-columns: 2fr 6fr 2fr;
column-gap: 24px;
grid-template-rows: 100vh;
`;