Skip to content

Commit

Permalink
feat :: 메인페이지 완
Browse files Browse the repository at this point in the history
  • Loading branch information
dutexion committed Feb 28, 2024
1 parent b121bf1 commit ba34433
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
18 changes: 10 additions & 8 deletions packages/user/src/components/Main/LatestProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { theme } from '@merge/design-system';
import { Link } from 'react-router-dom';

type projectsType = {
project_id: string,
project_name: string,
team_name_en: string,
logo: string
}
id: string;
project_name: string;
team_name_en: string;
logo: string;
};

export const LatestProject = ({ projects }: { projects: projectsType[] }) => {
return (
<LatestProjectContainer>
{projects.map((project, index) => {
return (
<FlexContainer key={index} to={`project/${project.project_id}`}>
<FlexContainer key={index} to={`project/${project.id}`}>
<ProjectImg src={project.logo} />
<NameContainer>
<ProjectName>{project.project_name}</ProjectName>
Expand Down Expand Up @@ -43,8 +43,8 @@ const LatestProjectContainer = styled.div`
`;

const ProjectImg = styled.img`
width: 200;
height: 170px;
width: 200px;
height: 200px;
margin-bottom: 4px;
border: 1px solid ${theme.color.gray100};
border-radius: 10px;
Expand All @@ -58,8 +58,10 @@ const NameContainer = styled.div`

const ProjectName = styled.div`
${theme.font.subTitle2};
color: ${theme.color.gray800};
`;

const TeamName = styled.div`
${theme.font.body1};
color: ${theme.color.primary400};
`;
26 changes: 12 additions & 14 deletions packages/user/src/pages/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { LatestProject } from '../components/Main/LatestProject';
import { theme } from '@merge/design-system';
import styled from '@emotion/styled';
import BannerImg from '../assets/banner.png';
import ScrollImg from "../assets/topPageButton.svg";
import ScrollImg from '../assets/topPageButton.svg';
import { useEffect, useRef, useState } from 'react';
import { getProjects } from '../apis/main'
import { getProjects } from '../apis/main';

type projectsType = {
project_id: string,
project_name: string,
team_name_en: string,
logo: string
}
id: string;
project_name: string;
team_name_en: string;
logo: string;
};

export const Main = () => {
const [projects, setProjects] = useState<projectsType[]>();
Expand All @@ -27,9 +27,9 @@ export const Main = () => {

useEffect(() => {
getProjects()
.then((res) => console.log(res))
.catch((err) => console.log(err))
}, [])
.then((res) => setProjects(res.data))
.catch((err) => console.log(err));
}, []);

return (
<Container ref={container}>
Expand All @@ -39,9 +39,7 @@ export const Main = () => {
<FavoriteProjects />
</FavoriteProjectContainer>
<Title marginTop="56px">최근 등록 된 프로젝트</Title>
<LatestProjectContainer>
{projects && <LatestProject projects={projects} />}
</LatestProjectContainer>
<LatestProjectContainer>{projects && <LatestProject projects={projects} />}</LatestProjectContainer>
<TopPageButton onClick={scrollToTop} />
</Container>
);
Expand Down Expand Up @@ -95,4 +93,4 @@ const TopPageButton = styled.div`
&:hover {
cursor: pointer;
}
`;
`;

0 comments on commit ba34433

Please sign in to comment.