Skip to content

CSS guidelines

CatQueenCodes edited this page Mar 6, 2021 · 4 revisions

Use real CSS

Use as much real CSS as possible and avoid framework specific features to assist with debugging in the browser, easy now doesn't mean easy later

BAD: GOOD:

Styled Componenet pattern

https://github.com/styled-components/styled-components/issues/418#issuecomment-275589908

Example:

JIst of it is this:

```js
import styled, { css } from 'styled-components'

const StyledComponent = styled.div`
  font-size: 20px;
  background: black;
  color: white;
  width: 20em;
  height: 10em;
  ${props => props.off && css`
    color: black;
    height: 0em;
  `}
  ${props => props.active && css`
    background: blue;
    outline: 1px solid white;
    width: 30em;
    height: 20em;
  `}
`
Clone this wiki locally