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

[Refactor] memberInfo RQ에서 SSG fetching으로 수정 #419

Merged
merged 6 commits into from
Sep 7, 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
13 changes: 9 additions & 4 deletions src/pages/about.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from '@emotion/styled';
import { InferGetServerSidePropsType } from 'next';
import { lazy } from 'react';
import dynamic from 'next/dynamic';
import PageLayout from '@src/components/common/PageLayout';
import { api } from '@src/lib/api';
import {
Expand All @@ -10,9 +10,12 @@ import {
RecordSection,
} from '@src/views/AboutPage/components';

const MemberSection = lazy(() => import('@src/views/AboutPage/components/Member/Section'));
const MemberSection = dynamic(() => import('@src/views/AboutPage/components/Member/Section'));

const AboutPage = ({ aboutInfo }: InferGetServerSidePropsType<typeof getStaticProps>) => {
const AboutPage = ({
aboutInfo,
memberInfo,
}: InferGetServerSidePropsType<typeof getStaticProps>) => {
return (
<PageLayout>
<Root>
Expand All @@ -22,7 +25,7 @@ const AboutPage = ({ aboutInfo }: InferGetServerSidePropsType<typeof getStaticPr
coreValues={aboutInfo.aboutInfo.coreValue.eachValues}
/>
<CurriculumSection curriculums={aboutInfo.aboutInfo.curriculums} />
<MemberSection generation={aboutInfo.aboutInfo.generation} />
<MemberSection members={memberInfo.members} generation={aboutInfo.aboutInfo.generation} />
<RecordSection
generation={aboutInfo.aboutInfo.generation}
records={aboutInfo.aboutInfo.records}
Expand All @@ -34,10 +37,12 @@ const AboutPage = ({ aboutInfo }: InferGetServerSidePropsType<typeof getStaticPr

export const getStaticProps = async () => {
const aboutInfo = await api.aboutAPI.getAboutInfo();
const memberInfo = await api.aboutAPI.getMemberInfo();

return {
props: {
aboutInfo,
memberInfo,
},
};
};
Expand Down
7 changes: 6 additions & 1 deletion src/views/AboutPage/components/Member/Card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ const MemberCard = ({
return (
<St.Card>
<St.ImageWrapper>
<St.ProfileImage src={imageSrc || NullImage.src} alt={`${name}의 프로필`} fill />
<St.ProfileImage
src={imageSrc || NullImage.src}
alt={`${name}의 프로필`}
fill
sizes="100%"
/>
</St.ImageWrapper>
<St.NameWrapper>
<St.Position>{position}</St.Position>
Expand Down
63 changes: 0 additions & 63 deletions src/views/AboutPage/components/Member/Content/index.tsx

This file was deleted.

41 changes: 0 additions & 41 deletions src/views/AboutPage/components/Member/Content/style.ts

This file was deleted.

41 changes: 38 additions & 3 deletions src/views/AboutPage/components/Member/Section/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import Flex from '@src/components/common/Flex';
import { MemberType } from '@src/lib/types/about';
import MemberCard from '@src/views/AboutPage/components/Member/Card';
import SectionTop from '../../@common/SectionTop';
import MemberContent from '../Content';
import * as St from './style';

type MemberSectionProps = {
generation: number;
members: MemberType[];
};

const MemberSection = ({ generation }: MemberSectionProps) => {
const MemberSection = ({ generation, members }: MemberSectionProps) => {
return (
<Flex
dir="column"
Expand All @@ -21,7 +23,40 @@ const MemberSection = ({ generation }: MemberSectionProps) => {
description="200명의 활동 회원들이 열정을 외칠 수 있도록, 35기 AND SOPT를 이끄는 임원진들이에요."
/>
{/* TODO : 서버에서 description을 받아오도록 수정 */}
<MemberContent />
<Flex
dir="column"
gap={{ mobile: 18, tablet: 24, desktop: 48 }}
style={{ alignItems: 'center' }}
>
{/* {errorContent} */}
<St.CardContainer>
{members.map(
({
id,
name,
position,
description,
currentProject,
imageSrc,
gmail,
linkedin,
github,
}) => (
<MemberCard
key={id}
name={name}
position={position}
description={description}
currentProject={currentProject}
imageSrc={imageSrc}
gmail={gmail}
linkedin={linkedin}
github={github}
/>
),
)}
</St.CardContainer>
</Flex>
</Flex>
);
};
Expand Down
40 changes: 40 additions & 0 deletions src/views/AboutPage/components/Member/Section/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,43 @@ export const MarginTop = styled.div`
height: 120px;
}
`;

export const CardContainer = styled.div`
display: grid;

grid-template-columns: repeat(3, 1fr);
gap: 34px;
width: 1200px;

@media (max-width: 80rem) and (min-width: 73.125rem) {
width: calc(100% - 40px);
}

@media (max-width: 73.125rem) and (min-width: 48rem) {
grid-template-columns: repeat(2, 1fr);
width: 752px;
}

@media (max-width: 48rem) and (min-width: 36.5rem) {
grid-template-columns: repeat(2, 1fr);
gap: 24px;
width: 576px;
}
/* 모바일 뷰 */
@media (max-width: 36.5rem) {
grid-template-columns: repeat(2, 1fr);
gap: 15px;
width: max(350px, 100% - 40px);
}
`;

export const OvalSpinnerWrapper = styled.div`
width: 100%;
height: 100vh;

padding-top: 200px;

display: flex;
flex-direction: column;
align-items: center;
`;
Loading