Skip to content

Commit

Permalink
feat: 카드 컴포넌트 구현 (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
junyeokk authored and eastfilmm committed May 15, 2024
1 parent a98600c commit 52ef2eb
Show file tree
Hide file tree
Showing 2 changed files with 195 additions and 0 deletions.
99 changes: 99 additions & 0 deletions src/components/display/Card.styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import styled from "styled-components";

export const SectionWrapper = styled.div`
background: #ffffff;
padding: 20px;
width: 70%;
margin-bottom: 30px;
display: flex;
flex-direction: column;
align-items: center;
border: 1px solid #d4d2e3;
border-radius: 24px;
`;

export const TopSection = styled.div`
display: flex;
align-items: center;
width: 100%;
`;

export const Photo = styled.img`
width: 70px;
height: 70px;
border-radius: 50%;
object-fit: cover;
margin-right: 20px;
`;

export const MemberInfo = styled.div`
display: flex;
flex-direction: column;
gap: 2px;
`;

export const MiddleSection = styled.div`
width: 100%;
padding: 10px 0;
`;

export const Description = styled.div`
margin-top: 6px;
list-style: none;
padding-left: 0;
li {
position: relative;
margin-bottom: 3px;
padding-left: 20px;
&::before {
content: "";
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 6px;
height: 6px;
background-color: #adabc3;
border-radius: 50%;
}
}
`;

export const BottomSection = styled.div`
width: 100%;
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
padding: 0;
`;

export const Contact = styled.div`
display: flex;
gap: 10px;
flex-wrap: wrap;
`;

export const IconLink = styled.a`
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
padding: 5px 10px;
background-color: #f2f2f2;
border-radius: 20px;
color: #5d5a88;
text-decoration: none;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
font-family: "MesloLGS NF", monospace;
`;

export const SocialIcon = styled.div`
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
`;
96 changes: 96 additions & 0 deletions src/components/display/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import { FaInstagram, FaLinkedin, FaGithub } from "react-icons/fa";

import { Text } from "../typography/Text";
import {
SectionWrapper,
TopSection,
Photo,
MemberInfo,
MiddleSection,
Description,
BottomSection,
Contact,
IconLink,
} from "./Card.styled";

interface ICard {
name: string;
dept: string;
role: string;
photo: string;
description: string[];
contact: {
instagram?: string;
linkedin?: string;
github?: string;
};
team: string;
}

const Card: React.FC<ICard> = ({ photo, name, dept, role, description, contact }) => {
const instagramURL = contact.instagram ? `https://instagram.com/${contact.instagram}` : null;
const linkedinURL = contact.linkedin ? `https://linkedin.com/in/${contact.linkedin}` : null;
const githubURL = contact.github ? `https://github.com/${contact.github}` : null;

return (
<>
<SectionWrapper>
<TopSection>
<Photo src={photo} alt="Profile Photo" />
<MemberInfo>
<Text size="m" weight="bold" variant="darkpurple">
{name}
</Text>
<Text size="xs" weight="bold" variant="lightpurple">
{dept}
</Text>
<Text size="xs" weight="bold" variant="lightpurple">
{role}
</Text>
</MemberInfo>
</TopSection>
<MiddleSection>
<Description>
{description.map((item, index) => (
<li key={index}>
<Text size="xs" weight="normal" variant="lightpurple">
{item}
</Text>
</li>
))}
</Description>
</MiddleSection>
<BottomSection>
<Contact>
{instagramURL && (
<IconLink href={instagramURL} target="_blank" rel="noopener noreferrer">
<FaInstagram />
<Text size="xxs" weight="normal">
{contact.instagram}
</Text>
</IconLink>
)}
{linkedinURL && (
<IconLink href={linkedinURL} target="_blank" rel="noopener noreferrer">
<FaLinkedin />
<Text size="xxs" weight="normal">
{contact.linkedin}
</Text>
</IconLink>
)}
{githubURL && (
<IconLink href={githubURL} target="_blank" rel="noopener noreferrer">
<FaGithub />
<Text size="xxs" weight="normal">
{contact.github}
</Text>
</IconLink>
)}
</Contact>
</BottomSection>
</SectionWrapper>
</>
);
};

export default Card;

0 comments on commit 52ef2eb

Please sign in to comment.