-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 충전소 검색 로드 시 스켈레톤이 아닌 스피너가 출력되는 기능 구현 [#501] * feat: 검색 새로 요청하기 전에 이 전 데이터 들고 있는 기능 구현 [#501] * refactor: Loader 컴포넌트 디자인 및 색상 개선 [#501] * refactor: 피드백 반영 및 자동 페칭 제한 [#501] --------- Co-authored-by: Dain Lee <[email protected]>
- Loading branch information
1 parent
9b60bdc
commit 1d6a139
Showing
5 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import type { Meta } from '@storybook/react'; | ||
|
||
import type { LoaderProps } from '@common/Loader/Loader'; | ||
import Loader from '@common/Loader/index'; | ||
|
||
const meta = { | ||
title: 'Components/Loader', | ||
component: Loader, | ||
tags: ['autodocs'], | ||
args: { | ||
size: 'xs', | ||
}, | ||
argTypes: { | ||
size: { | ||
options: { none: false, xs: 'xs', sm: 'sm', md: 'md', lg: 'lg', xl: 'xl', xxl: 'xxl' }, | ||
control: { | ||
type: 'select', | ||
}, | ||
description: | ||
'사이즈를 부여할 수 있습니다. Size Props이외에도 필요에 따라 수동으로도 제어할 수 있습니다.', | ||
}, | ||
}, | ||
} satisfies Meta<typeof Loader>; | ||
|
||
export default meta; | ||
|
||
export const Default = (args: LoaderProps) => { | ||
return <Loader {...args} />; | ||
}; | ||
export const Sizes = () => { | ||
return ( | ||
<> | ||
<Loader /> | ||
<Loader size="xs" /> | ||
<Loader size="sm" /> | ||
<Loader size="md" /> | ||
<Loader size="lg" /> | ||
<Loader size="xl" /> | ||
<Loader size="xxl" /> | ||
<Loader size="100px" /> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import styled from 'styled-components'; | ||
|
||
import type { Size } from '@type'; | ||
|
||
export interface LoaderProps { | ||
size?: Size | string; | ||
} | ||
|
||
const Loader = styled.div<LoaderProps>` | ||
width: ${({ size }) => { | ||
switch (size) { | ||
case 'xs': | ||
return '1.2rem'; | ||
case 'sm': | ||
return '1.6rem'; | ||
case 'md': | ||
return '2.0rem'; | ||
case 'lg': | ||
return '2.4rem'; | ||
case 'xl': | ||
return '2.8rem'; | ||
case 'xxl': | ||
return '3.2rem'; | ||
default: | ||
return size || '2.0rem'; | ||
} | ||
}}; | ||
height: ${({ size }) => { | ||
switch (size) { | ||
case 'xs': | ||
return '1.2rem'; | ||
case 'sm': | ||
return '1.6rem'; | ||
case 'md': | ||
return '2.0rem'; | ||
case 'lg': | ||
return '2.4rem'; | ||
case 'xl': | ||
return '2.8rem'; | ||
case 'xxl': | ||
return '3.2rem'; | ||
default: | ||
return size || '2.0rem'; | ||
} | ||
}}; | ||
border: 2px solid #e9ecef; | ||
border-bottom-color: #212529bf; | ||
border-radius: 50%; | ||
display: inline-block; | ||
box-sizing: border-box; | ||
animation: rotation 1s linear infinite; | ||
@keyframes rotation { | ||
0% { | ||
transform: rotate(0deg); | ||
} | ||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
`; | ||
|
||
export default Loader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Loader from './Loader'; | ||
|
||
export default Loader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters