From b62d6d50e69569536df9bc0cc0db3e01994d1b39 Mon Sep 17 00:00:00 2001 From: badahertz52 Date: Tue, 24 Dec 2024 17:23:12 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20EmptyContent=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/assets/emptyContentIcon.svg | 12 +++++++ .../components/common/EmptyContent/index.tsx | 28 ++++++++++++++++ .../components/common/EmptyContent/styles.ts | 32 +++++++++++++++++++ frontend/src/components/common/index.tsx | 2 +- frontend/src/styles/theme.ts | 3 +- 5 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 frontend/src/assets/emptyContentIcon.svg create mode 100644 frontend/src/components/common/EmptyContent/index.tsx create mode 100644 frontend/src/components/common/EmptyContent/styles.ts diff --git a/frontend/src/assets/emptyContentIcon.svg b/frontend/src/assets/emptyContentIcon.svg new file mode 100644 index 000000000..1c1d3e1d9 --- /dev/null +++ b/frontend/src/assets/emptyContentIcon.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/frontend/src/components/common/EmptyContent/index.tsx b/frontend/src/components/common/EmptyContent/index.tsx new file mode 100644 index 000000000..4bad95f0d --- /dev/null +++ b/frontend/src/components/common/EmptyContent/index.tsx @@ -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) => { + return ( + + + {children} + + ); +}; + +export default EmptyContent; diff --git a/frontend/src/components/common/EmptyContent/styles.ts b/frontend/src/components/common/EmptyContent/styles.ts new file mode 100644 index 000000000..4037442e3 --- /dev/null +++ b/frontend/src/components/common/EmptyContent/styles.ts @@ -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` + 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}; +`; diff --git a/frontend/src/components/common/index.tsx b/frontend/src/components/common/index.tsx index 2a15f749f..6dda8b053 100644 --- a/frontend/src/components/common/index.tsx +++ b/frontend/src/components/common/index.tsx @@ -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'; diff --git a/frontend/src/styles/theme.ts b/frontend/src/styles/theme.ts index d3370a64e..c12147f14 100644 --- a/frontend/src/styles/theme.ts +++ b/frontend/src/styles/theme.ts @@ -36,6 +36,7 @@ export const breakpoint = { medium: 1024, large: 1025, }; + // NOTE: 1rem = 10px export const fontSize: ThemeProperty = { small: '1.4rem', @@ -45,7 +46,6 @@ export const fontSize: ThemeProperty = { large: '3.2rem', h2: '4.8rem', }; - export const borderRadius: ThemeProperty = { basic: '0.8rem', }; @@ -72,6 +72,7 @@ export const colors: ThemeProperty = { sidebarBackground: `rgba(0, 0, 0, 0.25)`, disabled: '#D8D8D8', disabledText: '#7F7F7F', + emptyContentText: '#CBD6DE', red: '#FF0000', };