File tree Expand file tree Collapse file tree 6 files changed +102
-12
lines changed
common/components/NoResult
features/home/components/ItemList Expand file tree Collapse file tree 6 files changed +102
-12
lines changed Original file line number Diff line number Diff line change 1+ import { cx } from '@styled-system/css' ;
2+
3+ import * as s from './style.css' ;
4+
5+ interface Props {
6+ type : 'search' | '404' ;
7+ }
8+ const NoResult = ( { type } : Props ) => {
9+ const icon = type === 'search' ? 'mgc_alert_fill' : 'mgc_puzzled_fill' ;
10+ const title = type === 'search' ? '๊ฒ์ ๊ฒฐ๊ณผ๊ฐ ์์ด์!' : '์, ์๋ชป๋ ์ ๊ทผ์ด์์!' ;
11+ const description = type === 'search' ? '๋ค๋ฅธ ํค์๋๋ก ๋ค์ ๊ฒ์ํด ์ฃผ์ธ์.' : '๋ค๋ฅธ ๊ฒฝ๋ก๋ก ์ ์ํด ์ฃผ์ธ์.' ;
12+ return (
13+ < div className = { s . Container } >
14+ < div
15+ className = { cx ( icon , s . Icon ) }
16+ role = "img"
17+ aria-label = { type === 'search' ? '์๋ฆผ ์์ด์ฝ' : '๋นํฉ ์์ด์ฝ' }
18+ />
19+ < div className = { s . Text } >
20+ < p > { title } </ p >
21+ < p className = { s . Description } > { description } </ p >
22+ </ div >
23+ </ div >
24+ ) ;
25+ } ;
26+ export default NoResult ;
Original file line number Diff line number Diff line change 1+ import { css } from '@styled-system/css' ;
2+
3+ export const Container = css ( {
4+ display : 'flex' ,
5+ flexDir : 'column' ,
6+ gap : '1rem' ,
7+ alignItems : 'center' ,
8+ } ) ;
9+
10+ export const Icon = css ( {
11+ fontSize : '3rem' ,
12+ color : 'main' ,
13+ } ) ;
14+
15+ export const Text = css ( {
16+ display : 'flex' ,
17+ flexDir : 'column' ,
18+ alignItems : 'center' ,
19+ gap : '0.375rem' ,
20+ color : '100' ,
21+ fontSize : '1.25rem' ,
22+ fontWeight : 600 ,
23+ lineHeight : 1.4 ,
24+ letterSpacing : '-0.05rem' ,
25+ } ) ;
26+
27+ export const Description = css ( {
28+ color : '80' ,
29+ fontSize : '1rem' ,
30+ fontWeight : 400 ,
31+ letterSpacing : '-0.04rem' ,
32+ } ) ;
Original file line number Diff line number Diff line change 1+ import NoResult from '@/common/components/NoResult' ;
12import ItemCard from '@/features/home/components/ItemCard' ;
23import type { ItemInterface } from '@/features/home/types' ;
34
@@ -7,11 +8,10 @@ interface Props {
78 itemList : ItemInterface [ ] ;
89}
910const ItemList = ( { itemList } : Props ) => {
11+ const isEmpty = itemList . length === 0 ;
1012 return (
11- < div className = { s . Container } >
12- { itemList . map ( item => (
13- < ItemCard key = { item . itemId } data = { item } />
14- ) ) }
13+ < div className = { s . Container ( { isEmpty } ) } >
14+ { isEmpty ? < NoResult type = "search" /> : itemList . map ( item => < ItemCard key = { item . itemId } data = { item } /> ) }
1515 </ div >
1616 ) ;
1717} ;
Original file line number Diff line number Diff line change 1- import { css } from '@styled-system/css' ;
1+ import { cva } from '@styled-system/css' ;
22
3- export const Container = css ( {
4- display : 'flex' ,
5- flexDir : 'column' ,
6- gap : '1rem' ,
3+ export const Container = cva ( {
4+ base : {
5+ display : 'flex' ,
6+ flexDir : 'column' ,
7+ gap : '1rem' ,
8+ } ,
9+ variants : {
10+ isEmpty : {
11+ true : {
12+ justifyContent : 'center' ,
13+ alignItems : 'center' ,
14+ height : '100%' ,
15+ } ,
16+ } ,
17+ } ,
718} ) ;
Original file line number Diff line number Diff line change 11import { useNavigate } from 'react-router' ;
22
3- import Chip from '@/common/components/Chip' ;
43import SafeArea from '@/common/components/SafeArea' ;
4+ import NoResult from '@/common/components/NoResult' ;
5+ import Btn from '@/common/components/Button' ;
6+ import * as s from './style.css' ;
57
68const NotFoundPage = ( ) => {
79 const navigate = useNavigate ( ) ;
810
911 return (
1012 < SafeArea >
11- < Chip onClick = { ( ) => navigate ( '/' ) } > ํ์ผ๋ก ๊ฐ๊ธฐ</ Chip >
12- < h1 > ํ์ด์ง๋ฅผ ์ฐพ์ ์ ์์ด์ . . .</ h1 >
13+ < div className = { s . Container } >
14+ < NoResult type = "404" />
15+ < Btn mode = "main" className = { s . Button } onClick = { ( ) => navigate ( '/' ) } >
16+ ํ์ผ๋ก ๋์๊ฐ๊ธฐ
17+ </ Btn >
18+ </ div >
1319 </ SafeArea >
1420 ) ;
1521} ;
Original file line number Diff line number Diff line change 1+ import { css } from '@styled-system/css' ;
2+
3+ export const Container = css ( {
4+ display : 'flex' ,
5+ width : 'full' ,
6+ height : 'full' ,
7+ alignItems : 'center' ,
8+ justifyContent : 'center' ,
9+ flexDir : 'column' ,
10+ gap : '2.25rem' ,
11+ } ) ;
12+
13+ export const Button = css ( {
14+ width : '17rem' ,
15+ } ) ;
You canโt perform that action at this time.
0 commit comments