Skip to content

Commit

Permalink
feat : EmptyContent 컴포넌트 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
BadaHertz52 committed Dec 24, 2024
1 parent 69b507a commit b62d6d5
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 2 deletions.
12 changes: 12 additions & 0 deletions frontend/src/assets/emptyContentIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions frontend/src/components/common/EmptyContent/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Icon from '@/assets/emptyContentIcon.svg';
import { EssentialPropsWithChildren } from '@/types';

import * as S from './styles';

interface EmptyContentProps {
iconHeight?: string;
iconWidth?: string;
iconMessageGap?: string;
messageFontSize?: string;
}

const EmptyContent = ({
iconHeight,
iconWidth,
iconMessageGap,
messageFontSize,
children,
}: EssentialPropsWithChildren<EmptyContentProps>) => {
return (
<S.EmptyContent $iconMessageGap={iconMessageGap}>
<S.Img $height={iconHeight} $width={iconWidth} alt="" src={Icon} />
<S.MessageContainer $messageFontSize={messageFontSize}>{children}</S.MessageContainer>
</S.EmptyContent>
);
};

export default EmptyContent;
32 changes: 32 additions & 0 deletions frontend/src/components/common/EmptyContent/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import styled from '@emotion/styled';

export const EmptyContent = styled.div<{ $iconMessageGap?: string }>`
display: flex;
flex-direction: column;
gap: ${(props) => props.$iconMessageGap ?? '3.2rem'};
align-items: center;
`;
interface ImgProps {
$height?: string;
$width?: string;
}
export const Img = styled.img<ImgProps>`
aspect-ratio: 39/25;
width: ${(props) => {
if (props.$width && props.$height) return props.$width;
if (props.$width) return props.$width;
return 'auto';
}};
height: ${(props) => {
if (props.$height && props.$width) return props.$height;
if (props.$height) return props.$height;
if (props.$width) return 'auto';
return '19.7rem';
}};
`;

export const MessageContainer = styled.div<{ $messageFontSize?: string }>`
font-size: ${(props) => props.$messageFontSize ?? props.theme.fontSize.medium};
font-weight: ${({ theme }) => theme.fontWeight.semibold};
color: ${({ theme }) => theme.colors.emptyContentText};
`;
2 changes: 1 addition & 1 deletion frontend/src/components/common/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export { default as Carousel } from './Carousel';
export { default as Accordion } from './Accordion';
export { default as Dropdown } from './Dropdown';
export { default as Toast } from './Toast';

export { default as EmptyContent } from './EmptyContent';
export { default as OptionSwitch } from './OptionSwitch';
export { default as ReviewEmptySection } from './ReviewEmptySection';
export * from './modals';
3 changes: 2 additions & 1 deletion frontend/src/styles/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const breakpoint = {
medium: 1024,
large: 1025,
};

// NOTE: 1rem = 10px
export const fontSize: ThemeProperty<CSSProperties['fontSize']> = {
small: '1.4rem',
Expand All @@ -45,7 +46,6 @@ export const fontSize: ThemeProperty<CSSProperties['fontSize']> = {
large: '3.2rem',
h2: '4.8rem',
};

export const borderRadius: ThemeProperty<CSSProperties['borderRadius']> = {
basic: '0.8rem',
};
Expand All @@ -72,6 +72,7 @@ export const colors: ThemeProperty<CSSProperties['color']> = {
sidebarBackground: `rgba(0, 0, 0, 0.25)`,
disabled: '#D8D8D8',
disabledText: '#7F7F7F',
emptyContentText: '#CBD6DE',
red: '#FF0000',
};

Expand Down

0 comments on commit b62d6d5

Please sign in to comment.