import BoxBlink from 'BoxBlink';
<BoxBlink color={db.theme.colors.alternatives} />
<BoxBlink color={db.theme.colors.alternatives} height="2em" />
<BoxBlink color={db.theme.colors.alternatives} color="#ffffff" />
<BoxBlink color={db.theme.colors.alternatives} />
<BoxBlink color={db.theme.colors.alternatives} width="50%" />
Last active
January 28, 2021 13:23
-
-
Save fabiovila/c4b619af7e709fcc6e32981cde987ceb to your computer and use it in GitHub Desktop.
Basic box blinking loading component in React, Styled Components
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
import styled from 'styled-components'; | |
const BoxBlink = styled.div` | |
@keyframes blinker { | |
50% { | |
opacity: 0; | |
} | |
} | |
animation: blinker 2s linear infinite; | |
width: ${(props) => props.width}; | |
min-height: ${(props) => props.height}; | |
background-color: ${(props) => props.color}; | |
border-radius: ${(props) => props.radius}; | |
margin-bottom: 1em; | |
` | |
export default BoxBlink; | |
BoxBlink.defaultProps = { | |
color: '#ddd', | |
width: '100%', | |
height: '1.1em', | |
radius: '4px' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment