* feat(#1330): added arrow loader * refactor(#1330): refactoring * refactor(#1330): renamekeep-around/af30b88d367751c9e05a735e4a0467a96238ef47
parent
1769ff51a2
commit
183f0ff399
|
After Width: | Height: | Size: 733 B |
@ -0,0 +1,19 @@ |
||||
import { ArrowLoaderProps } from './types' |
||||
import { Wrapper, Arrows } from './styled' |
||||
|
||||
export const ArrowLoader = ({ |
||||
backgroundColor, |
||||
backgroundSize, |
||||
disabled, |
||||
width, |
||||
}: ArrowLoaderProps) => ( |
||||
<Wrapper |
||||
width={width} |
||||
backgroundColor={backgroundColor} |
||||
disabled={disabled} |
||||
> |
||||
<Arrows backgroundSize={backgroundSize} /> |
||||
</Wrapper> |
||||
) |
||||
|
||||
export const ArrowLoaderUI = { ArrowLoader, Arrows } |
||||
@ -0,0 +1,39 @@ |
||||
import styled from 'styled-components/macro' |
||||
import { keyframes } from 'styled-components' |
||||
|
||||
import { ArrowLoaderProps } from './types' |
||||
|
||||
const rotate = keyframes` |
||||
from { |
||||
transform: rotate(360deg); |
||||
} |
||||
|
||||
to { |
||||
transform: rotate(0deg); |
||||
} |
||||
` |
||||
|
||||
export const Wrapper = styled.button<ArrowLoaderProps>` |
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3); |
||||
border-color: transparent; |
||||
width: ${({ width = 'auto' }) => width}; |
||||
height: 50px; |
||||
background-color: ${({ backgroundColor = '#294fc4' }) => backgroundColor}; |
||||
border-radius: 5px; |
||||
display: flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
:disabled { |
||||
opacity: 0.5; |
||||
} |
||||
` |
||||
|
||||
export const Arrows = styled.div<ArrowLoaderProps>` |
||||
width: 36px; |
||||
height: 34px; |
||||
background-size: ${({ backgroundSize = 'contain' }) => backgroundSize}; |
||||
background-image: url(/images/arrowGroup.svg); |
||||
background-repeat: no-repeat; |
||||
background-position: center; |
||||
animation: ${rotate} 1s linear infinite; |
||||
` |
||||
@ -0,0 +1,6 @@ |
||||
export type ArrowLoaderProps = { |
||||
backgroundColor?: string, |
||||
backgroundSize?: string, |
||||
disabled?: boolean, |
||||
width?:string, |
||||
} |
||||
Loading…
Reference in new issue