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

Feature/main page 메인 페이지 퍼블리싱 #3

Merged
merged 25 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
336262b
chore:메인페이지 이미지 추가
2NNS-V Aug 27, 2024
c2c014f
chore:global font 설정 및 font 추가
2NNS-V Aug 27, 2024
281a135
feat:Text 스타일에 weight 옵션 추가
2NNS-V Aug 27, 2024
e827009
fix:폰트 스타일 변경
2NNS-V Aug 28, 2024
635d834
feat:Input 컴포넌트 추가
2NNS-V Aug 28, 2024
c2c0369
fix:폰트 삭제
2NNS-V Aug 28, 2024
7a8d417
chore:react-icons 추가
2NNS-V Aug 28, 2024
7f613c6
feat:메인 페이지 퍼블리싱
2NNS-V Aug 28, 2024
3c89b4d
feat:사이드바 추가
2NNS-V Aug 28, 2024
3b0e70e
design:사이드바 너비 수정
2NNS-V Aug 28, 2024
9dac8d7
design:사이드바 width 수정
2NNS-V Aug 28, 2024
b6f3068
fix:text color default 값 추가
2NNS-V Aug 28, 2024
1be845d
design:input padding 추가
2NNS-V Aug 28, 2024
4476341
design:메인 페이지 input 높이 수정
2NNS-V Aug 28, 2024
a9885ad
fix:react-icons 삭제
2NNS-V Aug 28, 2024
6d4760b
fix:아이콘 svg로 변경
2NNS-V Aug 28, 2024
d726fa7
feat:Text에 color 프로퍼티 추가
2NNS-V Aug 28, 2024
38b4d90
design: SideBar height 반응형으로 수정
2NNS-V Aug 28, 2024
cab67f4
Merge branch 'develop' into feature/main-page
toothlessdev Aug 28, 2024
87f20d7
fix: svg 분리
2NNS-V Aug 28, 2024
a649b2a
design: 사이드바 배경 삭제
2NNS-V Aug 28, 2024
9c56371
Merge branch 'feature/main-page' of https://github.com/LikeLion-KNU/d…
2NNS-V Aug 28, 2024
9eb9c81
fix:useNavigation, Button 중복 에러 해결
2NNS-V Aug 28, 2024
940b93c
design:close 버튼 오른쪽 정렬
2NNS-V Aug 28, 2024
9271ab6
design:메뉴바 버튼 오른쪽 정렬
2NNS-V Aug 28, 2024
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
20 changes: 20 additions & 0 deletions src/assets/icons/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/assets/icons/menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/dongari.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/likelion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions src/components/form/Input.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { InputProps } from "./Input";
import styled from "@emotion/styled";

export const InputElement = styled.input<InputProps>`
width: ${(props) => props.width};
height: ${(props) => props.height};

border-radius: 12px;
border: none;
padding:5px;

background-color: ${(props) => {
switch (props.variants) {
case "primary":
return "#ECECEC";
case "secondary":
return "#fff";
}
}};
`;
17 changes: 17 additions & 0 deletions src/components/form/Input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { forwardRef } from "react";

import { InputElement } from "./Input.style";

export interface InputProps extends React.ComponentPropsWithoutRef<"input"> {
variants: "primary" | "secondary";
width: string;
height: string;
}

export const Input = forwardRef<HTMLInputElement, InputProps>(
({ width, height, variants, ...rest }, ref) => {
return (
<InputElement ref={ref} width={width} height={height} variants={variants} {...rest} />
);
},
);
32 changes: 32 additions & 0 deletions src/components/navigation/SideBar.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import styled from "@emotion/styled";

export const SideBarWrapper = styled.div`
z-index: 5;
padding: 20px;
border-radius: 0 0 15px 15px;
height: auto;
max-height: 100%;
overflow-y: auto;
width:100%;
top: -80%;
backdrop-filter: blur(5px);
position: fixed;
align-items: flex-end;
transition: 0.5s ease;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
&.open {
top: 0;
transition: 0.5s ease;
}
img {
display: block;
margin-left: auto; /* Align the image to the right */
cursor: pointer; /* Add a pointer cursor for better UX */
}
`

export const Menu = styled.li`
margin: 20px 8px;
list-style-type: none;
cursor: pointer;
`;
45 changes: 45 additions & 0 deletions src/components/navigation/SideBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React from "react";

import {SideBarWrapper, Menu} from "./SideBar.style"
import closeIcon from "@/assets/icons/close.svg";

interface SideBarProps {
isOpen: boolean;
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
}

export const SideBar = ({isOpen, setIsOpen} : SideBarProps) => {
const outside = React.useRef<any>();

React.useEffect(() => {
document.addEventListener('mousedown', handlerOutsie);
return () => {
document.removeEventListener('mousedown', handlerOutsie);
};
});

const handlerOutsie = (e: any) => {
if (!outside.current.contains(e.target)) {
handleSideBar();
}
};

const handleSideBar = () => {
setIsOpen(false);
};

return (

<SideBarWrapper id="sidebar" ref={outside} className={isOpen ? "open" : ""}>
<img src = {closeIcon} onClick = {handleSideBar}/>

<ul>
<Menu>테스트</Menu>
<Menu>통계</Menu>
<Menu>만든이들</Menu>
</ul>
</SideBarWrapper>

)
}

2 changes: 2 additions & 0 deletions src/components/typography/Text.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { TextProps } from "./Text";
import styled from "@emotion/styled";

export const TextElement = styled.span<TextProps>`
font-weight: ${(props) => props.weight ?? "normal"};

font-size: ${(props) => {
switch (props.size) {
case "xs":
Expand Down
3 changes: 2 additions & 1 deletion src/components/typography/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { forwardRef } from "react";
import { TextElement } from "./Text.style";

export interface TextProps extends React.ComponentProps<"span"> {
size: "xs" | "s" | "m" | "l" | "xl";
size: "xs" | "s" | "m" | "l" | "xl" | string;
color?: "primary" | string;
weight?: "light" | "regular" | "bold" | "extrabold" | "heavy";
children: React.ReactNode;
}
Expand Down
61 changes: 61 additions & 0 deletions src/pages/HomePage.style.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,67 @@
import styled from "@emotion/styled";

export const HomePageWrapper = styled.div`
display: flex;
flex-direction: column;
align-items: center;
position: relative;
width: 100%;
height: 100vh;
`;

export const Header = styled.div`
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
margin-top:50px;
`;

export const TextContainer = styled.div`
margin : 10px;
`

export const MiddleSection = styled.div`
flex-grow: 0.8;
`

export const Main = styled.div`
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
`

export const InputContainer = styled.div`
display:flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap:15px;
`

export const ButtonContainer = styled.div`
display:flex;
justify-content: center;
align-items: center;

margin-top:50px;
`

export const Footer = styled.div`
display:flex;
justify-content: center;
align-items: center;
gap: 10px;
margin:20px;
`

export const MenuContainer = styled.div`
display:flex;
justify-content: center;
align-items: center;

position: absolute;
top: 10px;
right: 10px;
`
72 changes: 58 additions & 14 deletions src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,71 @@
import React from 'react';
import { Text } from "@/components/typography/Text";

import { HomePageWrapper } from "./HomePage.style";
import {SideBar} from '@/components/navigation/SideBar';
import { HomePageWrapper, Header, TextContainer, InputContainer, ButtonContainer, Main, Footer, MiddleSection, MenuContainer} from "./HomePage.style";

import { useNavigate } from "react-router-dom";
import { Button } from "@/components/form/Button";
import menuIcon from '@/assets/icons/menu.svg';
import dongari from '@/assets/images/dongari.png';
import likelion from '@/assets/images/likelion.png';

import {Input} from "@/components/form/Input";
import {Button} from "@/components/form/Button";


// import { useNavigate } from "react-router-dom";

export default function HomePage() {
const name = React.useRef<HTMLInputElement>(null);
const major = React.useRef<HTMLInputElement>(null);

const navigate = useNavigate();
const goToLoadingPage = () => {
navigate("/loading");
const [isOpen, setIsOpen] = React.useState(false);
const handleSideBar = () => {
setIsOpen(!isOpen);
};

return (
<HomePageWrapper>
<Text size="xl">XL</Text>
<Text size="l">L</Text>
<Text size="m">M</Text>
<Text size="s">S</Text>
<Text size="xs">XS</Text>
<Button width="150px" height="50px" variants="primary" onClick={goToLoadingPage}>
로딩페이지 테스트
</Button>
<MenuContainer role="button" onClick={handleSideBar}>
<img src = {menuIcon} />
</MenuContainer>
<SideBar isOpen = {isOpen} setIsOpen = {setIsOpen} />

<Header>
<img src = {dongari} alt = "동BTI" width="75px" height="75px"></img>
<Text size = '60px' weight='bold'>동BTI</Text>

<TextContainer>
<Text size="m">나에게 딱! 맞는 </Text>
<Text size="m" color="primary" weight="bold">동아리</Text>
<Text size="m">를 추천드려용</Text>
</TextContainer>
</Header>

<MiddleSection />

<Main>
<InputContainer>
<Input variants = "primary" width="242px" height = "30px" placeholder='이름을 입력하세용' ref = {name}/>
<Input variants = "primary" width="242px" height = "30px" placeholder='학과를 입력하세용' ref = {major} />
<Text size = "xs" color = '#6E6E6E'>개인정보는 외부에 공유되지 않으니 안심하세용</Text>
</InputContainer>

<ButtonContainer>
<Button variants = "primary" width="242px" height="55px" children = "테스트 시작하기" />
</ButtonContainer>

<TextContainer>
<Text size = "xs">오늘까지 </Text>
<Text size = "xs" color="primary" weight="bold">39,239명</Text>
<Text size = "xs">이 참여했어요!</Text>
</TextContainer>
</Main>

<Footer>
<img src = {likelion} alt = "멋쟁이사자처럼" width="20px" height="20px"></img>
<Text size = "xs">X</Text>
<img src = {dongari} alt = "총동아리연합회 미르" width="20px" height="20px"></img>
</Footer>
</HomePageWrapper>
);
}
2 changes: 1 addition & 1 deletion src/styles/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const GlobalStyle = css`
a {
text-decoration: none;
}

:root {
--font-size-xl: 24px;
--font-size-l: 22px;
Expand Down