smooth-code / smooth-ui

Modern React UI library 💅👩‍🎤🍭

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use theme getters in own component?

adambisek opened this issue · comments

Hey there,
I am using smooth ui with styled components, using @xstyled/styled-components ThemeProvider.

I came across documentation of smooth ui and also xstyled doc and I am wondering, how can I get in custom component some variable from theme. I’ve tried theme getters to get value from theme that is in context but is not working as expected:

import { th } from '@xstyled/system'
const Documentation = () => {
  return “primary color hey is” + th('colors.primary') // colors.primary is from theme that is in context
}

Theme getter returns currying function, but not value.
How can I do this?

Sorry for formatting, I wrote that on phone and will fix on computer later :)