Skip to content

Instantly share code, notes, and snippets.

@rich-97
Last active October 28, 2020 19:17
Show Gist options
  • Save rich-97/49ce905d6735edf39de1b7d774b3f3cd to your computer and use it in GitHub Desktop.
Save rich-97/49ce905d6735edf39de1b7d774b3f3cd to your computer and use it in GitHub Desktop.
React - Padding component
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