Skip to content

Instantly share code, notes, and snippets.

@martinwairegi
Created July 5, 2022 10:20
Show Gist options
  • Save martinwairegi/f9b3d86b0f12e491bc8210012db82ba1 to your computer and use it in GitHub Desktop.
Save martinwairegi/f9b3d86b0f12e491bc8210012db82ba1 to your computer and use it in GitHub Desktop.
import styled, { css } from "styled-components";
const GridBlock = styled.div`
${props =>
props.size &&
css`
width: ${props.size - Math.floor(props.size / 10)}px;
height: ${props.size - Math.floor(props.size / 10)}px;
border: ${Math.floor(props.size / 20)}px solid black;
`};
${props =>
props.color &&
css`
background-color: rgb(${props.color});
`};
`;
export default GridBlock;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment