Skip to content
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
14 changes: 10 additions & 4 deletions src/components/common/avatar/Avatar.styled.ts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 코드는 유저에 대한 프로필로 사용되는데, 단순히 이미지만 사용하는 거라면 아바타 컴포넌트가 아닌 img태그만 사용하는 건 어떨까요?
단순 이미지로도 사용되고 유저 프로필로도 사용되면 아바타 컴포넌트가 아닌 컨트롤러에 가까워 보이네요 :)
참고

Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import styled from 'styled-components';
import { AvatarProps } from './Avatar';

export const AvatarContainer = styled.div<Omit<AvatarProps, 'image'>>`
interface AvatarContainerProps extends Omit<AvatarProps, 'image'> {
$isMainLogo?: boolean;
}

export const AvatarContainer = styled.div<AvatarContainerProps>`
width: ${({ size }) => size};
height: ${({ size }) => size};
border: 1px solid ${({ theme }) => theme.color.border};
border-radius: 50%;
border-radius: ${({ $isMainLogo }) => ($isMainLogo ? '0' : '50%')};
border: ${({ $isMainLogo, theme }) =>
$isMainLogo ? 'none' : `1px solid ${theme.color.border}`};

.avatar {
width: 100%;
height: 100%;
border-radius: 50%;
border-radius: ${({ $isMainLogo }) => ($isMainLogo ? '0' : '50%')};
}

@media screen and ${({ theme }) => theme.mediaQuery.tablet} {
Expand Down
4 changes: 3 additions & 1 deletion src/components/common/avatar/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { ReactNode } from 'react';
import * as S from './Avatar.styled';
import defaultImg from '../../../assets/defaultImg.png';
import MainLogo from '../../../assets/mainlogo.svg';

export interface AvatarProps {
size: string;
image: string | ReactNode;
}

function Avatar({ size, image }: AvatarProps) {
const isMainLogo = image === MainLogo;
const releasedImg =
typeof image === 'string' && image.trim() ? image : defaultImg;
return (
<S.AvatarContainer size={size}>
<S.AvatarContainer size={size} $isMainLogo={isMainLogo}>
{typeof image === 'string' || !image ? (
<img className='avatar' src={releasedImg} alt='Avatar' />
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/sidebar/Sidebar.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const MenuItem = styled.div<{ $isActive: boolean }>`
$isActive ? '#f9f9f9' : 'transparent'};

@media ${({ theme }) => theme.mediaQuery.tablet} {
font-size: 0.7rem;
font-size: 0.9rem;
}

&:hover {
Expand Down
2 changes: 1 addition & 1 deletion src/components/manageProjects/CardList.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styled from 'styled-components';
export const CardListWrapper = styled.div`
display: flex;
flex-wrap: wrap;
justify-content: start;
justify-content: center;
align-items: center;
gap: 20px;
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const Title = styled.h2`
`;

export const Label = styled.p`
font-size: ${({ theme }) => theme.heading.medium.fontSize};
font-size: ${({ theme }) => theme.heading.semiSmall.fontSize};
font-weight: 700;
color: ${({ theme }) => theme.color.deepGrey};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled from 'styled-components';

export const Label = styled.p`
font-size: ${({ theme }) => theme.heading.medium.fontSize};
font-size: ${({ theme }) => theme.heading.semiSmall.fontSize};
font-weight: 700;
color: ${({ theme }) => theme.color.deepGrey};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ export const Button = styled.button<ButtonProps>`
border: 1px solid
${({ $passStatus, theme }) => getBorderColor($passStatus, theme)};
border-radius: ${({ theme }) => theme.borderRadius.primary};
transition: all 0.2s ease;

&:hover {
background-color: ${({ theme }) => theme.buttonScheme.primary.bg};
color: ${({ theme }) => theme.buttonScheme.primary.color};
border: none;
transition: all 0.2s ease-out;
}

@media ${({ theme }) => theme.mediaQuery.tablet} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ export const ItemWrapper = styled.li`
padding: 1rem;
border: 1px solid ${({ theme }) => theme.color.grey};
border-radius: ${({ theme }) => theme.borderRadius.primary};
transition: all 0.2s ease;

&:hover {
background-color: ${({ theme }) => theme.color.navy};
color: ${({ theme }) => theme.color.white};
transition: all 0.2s ease;
}

@media ${({ theme }) => theme.mediaQuery.tablet} {
Expand Down
1 change: 0 additions & 1 deletion src/pages/manage/myProjectList/MyProjectList.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ export const ManageProjectsContainer = styled.div`
`;

export const TitleWrapper = styled.header`
margin-left: 2rem;
margin-bottom: 2rem;
`;