Skip to content

Commit

Permalink
Merge pull request #297 from GDSC-PKNU-Official/feat/#264
Browse files Browse the repository at this point in the history
Feat/#264: 어학 공지사항 기능 추가
  • Loading branch information
pp449 authored Dec 28, 2023
2 parents d98b449 + 8ba3282 commit 1f840f0
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 12 deletions.
4 changes: 3 additions & 1 deletion src/@types/styles/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ export type IconKind =
| 'checkedRadio'
| 'uncheckedRadio'
| 'location'
| 'warning';
| 'warning'
| 'account'
| 'language';
5 changes: 2 additions & 3 deletions src/apis/Suspense/fetch-announce-list.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import Major from '@type/major';
import { AxiosResponse } from 'axios';

import wrapPromise from './wrap-promise';
import http from '../http';

const fetchAnnounceList = <T>(major: Major) => {
const fetchAnnounceList = <T>(endPoint: string) => {
const promise: Promise<AxiosResponse<T>> = http
.get(major ? `/api/announcement?major=${major}` : `/api/announcement`)
.get(`/api/announcement` + endPoint)
.then((res) => res.data);

return wrapPromise<T>(promise);
Expand Down
4 changes: 4 additions & 0 deletions src/components/Common/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import {
MdOutlineError,
MdOutlineKeyboardArrowRight,
MdOutlineKeyboardArrowDown,
MdAssignmentInd,
MdLanguage,
} from 'react-icons/md';

const ICON: { [key in IconKind]: IconType } = {
Expand Down Expand Up @@ -58,6 +60,8 @@ const ICON: { [key in IconKind]: IconType } = {
checkedRadio: MdRadioButtonChecked,
location: MdOutlineMyLocation,
warning: MdOutlineError,
account: MdAssignmentInd,
language: MdLanguage,
};

interface IconProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/InformUpperLayout/InformSearchForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import useToasts from '@hooks/useToast';
import React, { useRef } from 'react';

interface InformSearchForm {
category: 'school' | 'major';
category: 'school' | 'major' | 'language' | 'recruit';
}

const InformSearchForm = ({ category }: InformSearchForm) => {
Expand Down
4 changes: 4 additions & 0 deletions src/constants/announcement.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
export const ANNOUNCEMENT_TITLE = {
SCHOOL: '학교 공지사항',
MAROR: '학과 공지사항',
LANGUAGE: '어학 공지사항',
RECRUIT: '채용 공지사항',
};

export const ANNOUNCEMENT_CATEGORY = {
SCHOOL: 'school',
MAJOR: 'major',
LANGUAGE: 'language',
RECRUIT: 'recruit',
} as const;

export const ANNOUNCEMENT_TYPE = {
Expand Down
4 changes: 3 additions & 1 deletion src/constants/path.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
type Category = 'school' | 'major';
type Category = 'school' | 'major' | 'language' | 'recruit';

const PATH = {
SCHOOL_ANNOUNCEMENT: '/school/:type',
MAJOR_ANNOUNCEMENT: '/major/:type',
LANGUAGE_ANNOUNCEMENT: '/language/:type',
RECRUIT_ANNOUNCEMENT: '/recruit/:type',
NORMAL_ANNOUNCEMENT: (category: Category) =>
`/announcement/${category}/normal`,
PINNED_ANNOUNCEMENT: (category: Category) =>
Expand Down
4 changes: 2 additions & 2 deletions src/constants/tip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface TipData {
link: string;
}

export const SHORTCUT_DATA: readonly TipData[] = [
export const SHORTCUT_DATA: TipData[] = [
{
title: '부경대학교',
subTitle: '부경대학교\n홈페이지로 이동',
Expand Down Expand Up @@ -58,7 +58,7 @@ export const SHORTCUT_DATA: readonly TipData[] = [
},
] as const;

export const HONEY_TIP_DATA: readonly TipData[] = [
export const HONEY_TIP_DATA: TipData[] = [
{
title: '아우란트검사',
subTitle: '인성·역량·취업준비도\n·진로적성검사',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Announcement/components/AnnounceContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useParams } from 'react-router-dom';
interface AnnounceContainerProps {
title: string;
category: AnnouncementCategory;
endPoint: string | null;
endPoint: string;
}

const AnnounceContainer = ({
Expand Down
12 changes: 11 additions & 1 deletion src/pages/Announcement/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,17 @@ const Announcement = () => {
<AnnounceContainer
title={ANNOUNCEMENT_TITLE.MAROR}
category={ANNOUNCEMENT_CATEGORY.MAJOR}
endPoint={major}
endPoint={'?major=' + major}
/>
}
/>
<Route
path={PATH.LANGUAGE_ANNOUNCEMENT}
element={
<AnnounceContainer
title={ANNOUNCEMENT_TITLE.LANGUAGE}
category={ANNOUNCEMENT_CATEGORY.LANGUAGE}
endPoint={'/language'}
/>
}
/>
Expand Down
64 changes: 64 additions & 0 deletions src/pages/Home/components/InformHalfCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import Icon from '@components/Common/Icon';
import styled from '@emotion/styled';
import useRouter from '@hooks/useRouter';
import { THEME } from '@styles/ThemeProvider/theme';
import { IconKind } from '@type/styles/icon';

interface InformHalfCardProps {
iconKind: IconKind;
title: string;
subTitle: string;
link: string;
}

const InformHalfCard = ({
iconKind,
title,
subTitle,
link,
}: InformHalfCardProps) => {
const { routerTo } = useRouter();

return (
<Container onClick={() => routerTo(link)}>
<Icon kind={iconKind} size="45" color={THEME.PRIMARY} />
<TitleWrapper>
<SubTitle>{subTitle}</SubTitle>
<Title>{title}</Title>
</TitleWrapper>
</Container>
);
};

export default InformHalfCard;

const Container = styled.div`
display: flex;
align-items: center;
justify-content: space-between;
width: 39%;
background-color: ${THEME.IVORY};
padding: 3% 5% 3% 4%;
border-radius: 15px;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
height: 55px;
`;

const TitleWrapper = styled.div`
display: flex;
flex-direction: column;
padding-left: 7px;
`;

const Title = styled.h2`
font-size: 16px;
font-weight: bold;
`;

const SubTitle = styled.h3`
color: ${THEME.TEXT.SEMIBLACK};
display: flex;
justify-content: flex-end;
font-size: 13px;
padding-bottom: 6px;
`;
21 changes: 21 additions & 0 deletions src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Carousel from '@components/Carousel';
import styled from '@emotion/styled';
import InformHalfCard from '@pages/Home/components/InformHalfCard';
import { THEME } from '@styles/ThemeProvider/theme';

import InformCardList from './components/InformCardList';
Expand All @@ -11,6 +12,20 @@ const Home = () => {
<InformTitle>학교</InformTitle>
<InformCardList />
</InformCardWrapper>
<InformHalfCardList>
<InformHalfCard
iconKind="account"
title="취업 길라잡이"
subTitle="채용 정보 확인"
link="/announcement/recruit/normal"
/>
<InformHalfCard
iconKind="language"
title="어학 공지사항"
subTitle="어학 정보 확인"
link="/announcement/language/normal"
/>
</InformHalfCardList>
<InformCardWrapper>
<InformTitle>비교과</InformTitle>
<Carousel />
Expand Down Expand Up @@ -38,6 +53,12 @@ const InformCardWrapper = styled.div`
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
`;

const InformHalfCardList = styled.div`
display: flex;
justify-content: space-between;
margin-top: 5%;
`;

const InformTitle = styled.div`
font-size: 20px;
font-weight: bold;
Expand Down
5 changes: 3 additions & 2 deletions src/styles/ThemeProvider/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ export const THEME: Theme = {

TEXT: {
BLACK: '#000000',
SEMIBLACK: '#444444',
GRAY: '#808080',
WHITE: '#FFFFFF',
},

PRIMARY: '#95B1DC',
PRIMARY: '#7A9DD3',

BUTTON: {
BLUE: '#95B1DC',
BLUE: '#7A9DD3',
GRAY: '#E7E7E7',
},

Expand Down
1 change: 1 addition & 0 deletions src/styles/emotion.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare module '@emotion/react' {
BACKGROUND: string; // EAEAEA
TEXT: {
BLACK: string;
SEMIBLACK: string;
GRAY: string;
WHITE: string;
};
Expand Down

0 comments on commit 1f840f0

Please sign in to comment.