Last active
October 28, 2020 19:17
-
-
Save rich-97/49ce905d6735edf39de1b7d774b3f3cd to your computer and use it in GitHub Desktop.
React - Padding component
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"; | |
interface Props { | |
top?: string; | |
right?: string; | |
left?: string; | |
bottom?: string; | |
all?: string; | |
} | |
const Padding = styled.div<Props>` | |
${props => { | |
const { top, right, left, bottom, all } = props; | |
if (all) { | |
return `padding: ${all}`; | |
} | |
return ` | |
padding-left: ${left}; | |
padding-top: ${top}; | |
padding-right: ${right}; | |
padding-bottom: ${bottom}; | |
`; | |
}} | |
`; | |
export default Padding; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment