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 메인 페이지 수정 #13

Merged
merged 24 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e8cc5d1
feat:통계 페이지로 이동
2NNS-V Aug 28, 2024
78b93a7
Merge branch 'develop' of https://github.com/LikeLion-KNU/dongBTI int…
2NNS-V Aug 29, 2024
8c01947
design:백그라운드 이미지 추가
2NNS-V Aug 29, 2024
2fba2ad
design:사이드바 hover 이벤트 추가
2NNS-V Aug 30, 2024
05544e9
design:input 폰트 크기 설정 및 padding 설정
2NNS-V Aug 30, 2024
b758800
feat:단과대학 dropdown 추가 및 적용
2NNS-V Aug 30, 2024
5d60e10
design:background image 삭제
2NNS-V Sep 2, 2024
4044c5c
chore: png->svg로 확장자명 변경
2NNS-V Sep 2, 2024
eaa0a5a
style:sidebar 블러 효과 수정
2NNS-V Sep 2, 2024
2ca349a
feat: 변경된 디자인에 맞게 수정 및 전역 상태(name, major) 설정
2NNS-V Sep 2, 2024
e318461
style: input 글씨체 설정
2NNS-V Sep 2, 2024
1a6eacf
refact: 이름 명시적으로 수정
2NNS-V Sep 4, 2024
e7769a2
feat:통계 페이지 진행중
2NNS-V Sep 4, 2024
d16ece1
feat:메인 페이지에 이미지 추가
2NNS-V Sep 4, 2024
aaff2e1
feat:동아리 로고 Footer 추가
2NNS-V Sep 4, 2024
b656022
feat:Footer 적용 및 메인 이미지 반응형 적용
2NNS-V Sep 4, 2024
a1324a9
refact: Footer 스타일 컴포넌트 분리
2NNS-V Sep 4, 2024
def6482
refact: dropdown 컴포넌트명 PascalCase로 변경
2NNS-V Sep 4, 2024
712269d
refact: 불필요한 함수 제거(handleSideBar)
2NNS-V Sep 4, 2024
8adc963
feat:SideBar 이동 로직 추가
2NNS-V Sep 4, 2024
87146ab
Rename:Dropdown.tsx to DropDown.tsx
2NNS-V Sep 5, 2024
d8d2d1a
Rename:Dropdown.style.ts to DropDown.style.ts
2NNS-V Sep 5, 2024
9876bae
refact: DropDown 코드 리팩토링
2NNS-V Sep 5, 2024
8b06a10
refact: SideBar 관련 함수 타입 지정
2NNS-V Sep 5, 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
1,577 changes: 1,281 additions & 296 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"hangul-js": "^0.2.6",
"primereact": "^10.8.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.26.1",
Expand Down
3 changes: 2 additions & 1 deletion src/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import HomePage from "./pages/HomePage";
import LoadingPage from './pages/ResultLoading';
import ResultShare from "./pages/ResultShare";
import ResultPage from "./pages/ResultPage";

import AnalyticsPage from "./pages/AnalyticsPage";

export const Router = () => {
return (
Expand All @@ -16,6 +16,7 @@ export const Router = () => {
<Route path="/loading" element={<LoadingPage />} />
<Route path="/result" element={<ResultPage />}></Route>
<Route path="/share" element={<ResultShare />}></Route>
<Route path="/analytics" element={<AnalyticsPage />}></Route>
</Route>
</Routes>
);
Expand Down
Binary file removed src/assets/images/dongari.png
Binary file not shown.
1 change: 1 addition & 0 deletions src/assets/images/dongari.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 removed src/assets/images/likelion.png
Binary file not shown.
1 change: 1 addition & 0 deletions src/assets/images/likelion.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/images/main.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/images/mir.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/components/display/Footer.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import styled from "@emotion/styled";

export const FooterWrapper = styled.div`
display: flex;
justify-content: center;
align-items: center;
gap: 10px;
margin: 20px;
`;
16 changes: 16 additions & 0 deletions src/components/display/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Text } from "@/components/typography/Text";

import likelion from "@/assets/images/likelion.svg";
import mir from "@/assets/images/mir.svg";

import { FooterWrapper } from "./Footer.style";

export default function Footer() {
return (
<FooterWrapper>
<img src={likelion} alt="멋쟁이사자처럼" width="20px" height="20px"></img>
<Text size="xs">X</Text>
<img src={mir} alt="총동아리연합회 미르" width="20px" height="20px"></img>
</FooterWrapper>
);
}
58 changes: 58 additions & 0 deletions src/components/form/DropDown.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { DropDownProps } from "./DropDown";
import styled from "@emotion/styled";
import { Dropdown } from "primereact/dropdown";

interface LabelProps {
color: string;
}

const getBackgroundColor = (color: string) => {
switch (color) {
case "primary":
return "#ECECEC";
case "secondary":
return "#fff";
default:
return color;
}
};

export const DropDownWrapper = styled.div<DropDownProps>`
display: flex;
border-radius: 12px;
justify-content: center;

background-color: ${(props) => getBackgroundColor(props.color)};

height: ${(props) => props.height};
width: ${(props) => props.width};
`;

export const DropDownContainer = styled(Dropdown)`
width: 100%;
font-size: 15px;
justify-content: center;
align-items: center;
padding: 10px;
`;

export const LabelContainer = styled.span<LabelProps>`
display: inline-block;
width: 100%;
color: #333;
padding: 10px;

background-color: ${(props) => getBackgroundColor(props.color)};

&:hover {
color: ${(props) => {
switch (props.color) {
case "primary":
case "secondary":
return "#37cdcd";
default:
return props.color;
}
}};
}
`;
49 changes: 49 additions & 0 deletions src/components/form/DropDown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from "react";

import { DropDownWrapper, DropDownContainer, LabelContainer } from "./DropDown.style";

export interface DropDownProps {
color: string;
width: string;
height: string;
selectedMajor?: string;
setSelectedMajor?: React.Dispatch<React.SetStateAction<string>>;
}

export default function DropDown({ color, width, height, selectedMajor, setSelectedMajor }: DropDownProps) {
const majors = [
{ label: "📖 인문대학", value: "인문대학" },
{ label: "📋 사회과학대학", value: "사회과학대학" },
{ label: "🔬 자연과학대학", value: "자연과학대학" },
{ label: "📊 경상대학", value: "경상대학" },
{ label: "🛠️ 공과대학", value: "공과대학" },
{ label: "💻 IT대학", value: "IT대학" },
{ label: "🥕 농업생명과학대학", value: "농업생명과학대학" },
{ label: "🎨 예술대학", value: "예술대학" },
{ label: "📚 사범대학", value: "사범대학" },
{ label: "🥼 의과대학", value: "의과대학" },
{ label: "🦷 치과대학", value: "치과대학" },
{ label: "🐈 수의과대학", value: "수의과대학" },
{ label: "🧼 생활과학대학", value: "생활과학대학" },
{ label: "💉 간호대학", value: "간호대학" },
{ label: "💊 약학대학", value: "약학대학" },
{ label: "🚙 첨단기술융합대학", value: "첨단기술융합대학" },
{ label: "🪵 생태환경대학", value: "생태환경대학" },
{ label: "📡 과학기술대학", value: "과학기술대학" },
{ label: "🖋️ 행정학부", value: "행정학부" },
{ label: "💡 자율전공부", value: "자율전공부" },
];

return (
<DropDownWrapper color={color} width={width} height={height}>
<DropDownContainer
value={selectedMajor}
onChange={(e) => setSelectedMajor && setSelectedMajor(e.value)}
options={majors}
optionLabel="label"
placeholder="단과 대학을 선택하세용"
itemTemplate={(option) => <LabelContainer color={color}>{option.label}</LabelContainer>}
/>
</DropDownWrapper>
);
}
4 changes: 3 additions & 1 deletion src/components/form/Input.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { InputProps } from "./Input";
import styled from "@emotion/styled";

export const InputElement = styled.input<InputProps>`
font-size: 15px;
font-family: "NanumSquareNeo";
width: ${(props) => props.width};
height: ${(props) => props.height};

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

background-color: ${(props) => {
switch (props.variants) {
Expand Down
34 changes: 20 additions & 14 deletions src/components/navigation/SideBar.style.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
import styled from "@emotion/styled";

export const SideBarWrapper = styled.div`
z-index: 5;
padding: 20px;
z-index: 5;
padding: 20px;
border-radius: 0 0 15px 15px;
height: auto;
max-height: 100%;
overflow-y: auto;
width:100%;
width: 100%;
top: -80%;
backdrop-filter: blur(5px);
position: fixed;
backdrop-filter: blur(10px);
position: fixed;
align-items: flex-end;
transition: 0.5s ease;
transition: 0.5s ease;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
&.open {
top: 0;
transition: 0.5s ease;
&.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 */
margin-left: auto;
cursor: pointer;
}
`
`;

export const Menu = styled.li`
export const Menu = styled.li`
margin: 20px 8px;
list-style-type: none;
cursor: pointer;
`;
&:hover {
color: #37cdcd;
}
&.active {
color: #37cdcd;
}
`;
67 changes: 34 additions & 33 deletions src/components/navigation/SideBar.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,46 @@
import React from "react";
import { useNavigate } from "react-router-dom";

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

import { SideBarWrapper, Menu } from "./SideBar.style";

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);
export const SideBar = ({ isOpen, setIsOpen }: SideBarProps) => {
const outside = React.useRef<HTMLDivElement>(null);
const navigate = useNavigate();

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

const handlerOutside = (e: MouseEvent) => {
if (outside.current && !outside.current.contains(e.target as Node)) {
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>

)
}
const handleNavigation = (path: string) => {
navigate(path);
setIsOpen(false);
};

return (
<SideBarWrapper id="sidebar" ref={outside} className={isOpen ? "open" : ""}>
<img src={closeIcon} onClick={() => setIsOpen(false)} />

<ul>
<Menu onClick={() => handleNavigation("/")}>테스트</Menu>
<Menu onClick={() => handleNavigation("/analytics")}>통계</Menu>
<Menu onClick={() => handleNavigation("/")}>만든이들</Menu>
</ul>
</SideBarWrapper>
);
};
27 changes: 27 additions & 0 deletions src/pages/AnalyticsPage.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import styled from "@emotion/styled";

export const TitleContainer = styled.div`
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
margin: 30px;
`;

export const TitleTop = styled.div`
display: flex;
width: 60%;
align-items: center;
justify-content: flex-start;
`;

export const Main = styled.div``;

export const Content = styled.div`
margin: 20px;
`;

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