@vtex/admin-styles
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

admin styles

the vtex admin css-in-js style parser

NPM

Summary

This package is responsible to:

  1. Define the VTEX admin theme structure
  2. Parse the StyleProp to the a emotion ObjectStyle

Installation

yarn add @vtex/admin-styles @emotion/css @emotion/react

Usage

Define a theme object that respect's the defined shape of the Theme type, and call the styles function:

import { styles, Theme } from '@vtex/admin-styles'

const theme: Theme = {
  colors: {
    dark: {
      primary: 'black',
      secondary: 'silver',
    },
  },
}

styles({
  bg: 'dark.primary',
  color: 'dark.secondary',
})(theme)

// returns { backgroundColor: 'black', color: 'silver' }

You can also use emotion to style your react components after parse.

import { css } from '@emotion/css'
import { styles, Theme } from '@vtex/admin-styles'

const theme: Theme = {
  colors: {
    dark: {
      primary: 'black',
      secondary: 'silver',
    },
  },
}

const styles = styles({
  bg: 'dark.primary',
  color: 'dark.secondary',
})(theme)

/** compiled className */
const className = css(styles)

render(<div className={className} />)

Dependencies (4)

Dev Dependencies (4)

Package Sidebar

Install

npm i @vtex/admin-styles

Weekly Downloads

22

Version

0.3.1

License

none

Unpacked Size

151 kB

Total Files

33

Last publish

Collaborators

  • jardelymaris
  • denissilvavtex
  • eduardocesb
  • enzomerca
  • vinhags
  • zaedyvtex
  • filafb
  • bastotec
  • arthurtriis1vtex
  • geraldo.fernandes
  • georgebrindeiro
  • filipewl
  • emersonvtex
  • rodrigo.albuquerque
  • viniciuslouzadavtex
  • npedrosovtex
  • myllena.alves
  • mendescamara
  • mauro.takeda
  • lpolon
  • gianvittorio
  • eduardoformiga
  • vcnovaes
  • dpzvtex
  • vtexlab-user
  • wender
  • natamelo
  • mairatma
  • mayzabel
  • augusto.lazaro
  • rafarubim
  • gustavorosolem
  • arthurepc
  • jeymisson
  • victorhmp
  • lurian
  • arturpimentel
  • anitavincent
  • brunojdo
  • lucasecdb
  • matheusps
  • emersonlaurentino
  • viniagostini
  • lucasaarcoverde
  • lariciamota
  • icazevedo
  • fabits
  • mateuspontes
  • gmantiqueira
  • vitorlgomes
  • rodolfoams
  • policarpo
  • marcelovicentegc
  • maianabt
  • jeffersontuc
  • hiagolcm
  • william.silva