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

Style: 명함보기 페이지 내 아이콘 등 디테일 수정 #63

Merged
merged 7 commits into from
Aug 19, 2024
19 changes: 15 additions & 4 deletions src/assets/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 16 additions & 9 deletions src/components/CardInfo/CardInfo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,29 @@ import PropTypes from 'prop-types';
import * as S from './CardInfo.style';
import Icon from '../../components/Icon/Icon';
import { Link } from 'react-router-dom';
import ProfileImgDefault from '../../assets/images/profile-img-default.svg';

export default function CardInfo({
name,
job,
company,
imageUrl = ProfileImgDefault,
imageUrl,
isDeleteMode = false,
isSelected = false,
onClick = () => {},
}) {
return (
const cardContent = (
<S.Card
onClick={onClick}
isDeleteMode={isDeleteMode}
isSelected={isSelected}
>
<S.CardWrapper>
<S.ProfileImgWrapper>
<img src={imageUrl || ProfileImgDefault} alt={`${name} 프로필`} />
{imageUrl ? (
<img src={imageUrl} alt={`${name} 프로필`} />
) : (
<Icon id='profile-basic' fill='none' />
)}
</S.ProfileImgWrapper>
<S.Info>
<S.Name isSelected={isSelected}>{name}</S.Name>
Expand All @@ -32,11 +35,9 @@ export default function CardInfo({
</S.Info>
</S.CardWrapper>
{!isDeleteMode && (
<Link to={`/card/${name}`}>
<S.ArrowIconWrapper>
<Icon id='arrow-right' fill='none' />
</S.ArrowIconWrapper>
</Link>
<S.ArrowIconWrapper>
<Icon id='arrow-right' fill='none' />
</S.ArrowIconWrapper>
)}
{isDeleteMode && (
<S.ArrowIconWrapper>
Expand All @@ -45,6 +46,12 @@ export default function CardInfo({
)}
</S.Card>
);

return isDeleteMode ? (
cardContent
) : (
<Link to={`/card/${name}`}>{cardContent}</Link>
);
}

CardInfo.propTypes = {
Expand Down
8 changes: 7 additions & 1 deletion src/components/CardInfo/CardInfo.style.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from '@emotion/styled';

export const Card = styled.a`
export const Card = styled.div`
display: flex;
justify-content: space-between;
align-items: center;
Expand Down Expand Up @@ -29,6 +29,12 @@ export const ProfileImgWrapper = styled.div`
border-radius: 50%;
object-fit: cover;
}
svg {
width: 100%;
height: 100%;
border-radius: 50%;
object-fit: cover;
}
`;

export const Info = styled.div`
Expand Down
7 changes: 7 additions & 0 deletions src/components/MyCard/MyCard.style.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ export const ProfileImg = styled.div`
max-height: 68px;
border-radius: 50%;
display: flex;
img {
width: 100%;
height: 100%;
border-radius: 50%;
object-fit: cover;
}
`;

export const ProfileText = styled.div`
Expand Down
3 changes: 1 addition & 2 deletions src/pages/CardDetailPage/CardDetailPage.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useState, useEffect } from 'react';
import { useParams } from 'react-router-dom';
import { useParams, Link } from 'react-router-dom';
import * as S from './CardDetailPage.style';
import Icon from '../../components/Icon/Icon';
import { TabBar, BlueBadge } from '../../components';
import ProfileImgDefault from '../../assets/images/profile-img-default.svg';
import { Link } from 'react-router-dom';
import CARDS_SAMPLE_DATA from '../../constants/cardsSampleData';

export default function CardDetailPage() {
Expand Down
4 changes: 1 addition & 3 deletions src/pages/ViewCardPage/ViewCardPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ export default function ViewCardPage() {
<S.EditBadgeWrapper>
<S.DeleteCardBadge onClick={handleDeleteClick}>
<S.BadgeText>명함 삭제</S.BadgeText>
<S.TrashIcon>
<Icon id='trash' fill='none' />
</S.TrashIcon>
<Icon id='trash' />
</S.DeleteCardBadge>
{isEditCompleteVisible && (
<S.EditCompletedBadge onClick={handleEditCompleteClick}>
Expand Down
13 changes: 7 additions & 6 deletions src/pages/ViewCardPage/ViewCardPage.style.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import styled from '@emotion/styled';

export const ViewCardPage = styled.div`
padding: 0 20px 100px 20px;
overflow-y: scroll;
scrollbar-width: none;
`;

// 버튼
Expand Down Expand Up @@ -34,6 +36,11 @@ export const DeleteCardBadge = styled.button`
gap: 8px;
border-radius: 10px;
background: var(--Color-4-1, #ffe6f2);

svg {
width: 10px;
height: 11px;
}
`;

export const EditCompletedBadge = styled.button`
Expand All @@ -56,12 +63,6 @@ export const BadgeText = styled.p`
letter-spacing: -0.55px;
`;

export const TrashIcon = styled.div`
width: 10px;
height: 11px;
flex-shrink: 0;
`;

// 명함
export const CardContainer = styled.div`
display: flex;
Expand Down