Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Latest commit

 

History

History

synth-styled-components

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

@beatgig/synth-styled-components

styled-components bindings for Synth.

Installation

yarn add @beatgig/synth-styled-components

Usage

import React from 'react'
import styled from 'styled-components'
import ReactDOM from 'react-dom'
import { backgroundColor, color } from '@beatgig/synth-styled-components'
import { SynthProvider } from '@beatgig/synth-react'
import { withTokens } from '@beatgig/synth-css'

const tokens = {
  '@coolWhite': 'white',

  color: {
    text: {
      button: '@coolWhite',
    },

    background: {
      button: 'red',
    },
  },
}

const Button = styled.button`
  ${backgroundColor('button')}
  ${color('button')}
`

ReactDOM.render(
  <SynthProvider value={{
    tokens,
    ...withTokens(tokens),
  }}>
    <Button>A Red Button<Button>
  </SynthProvider>,
  document.getElementById('root')
)