Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme Value Plugin #812

Merged
merged 3 commits into from
Oct 1, 2020
Merged

Theme Value Plugin #812

merged 3 commits into from
Oct 1, 2020

Conversation

robinweser
Copy link
Owner

@robinweser robinweser commented Sep 21, 2020

Description

This PR adds a new plugin: fela-plugin-theme-value.
It allows to use string-based theme value keys directly in style objects.

Example

If required, add a code example or a link to a working example (repository).

// given this theme
const theme = {
  colors: {
    foreground: {
      primary: "red",
      secondary: "blue"
    },
    background: {
      primary: "black",
      secondary: "white"
    }
  },
  fonts: {
    text: "Helvetica Neue, Arial, sanf-serif",
    heading: "Impact, serif"
  }
}

// with given plugin configuration
themeValue({
  color: theme => theme.colors,
  backgroundColors: theme => theme.colors,
  fontFamily: theme => theme.fonts
})

// one can now write style like this
const style = {
  color: "foreground.primary",
  backgroundColor: "background.secondary",
  fontFamily: "heading"
}

Packages

List all packages that have been changed.

  • fela-plugin-theme-value

Versioning

Minor

Checklist

Quality Assurance

You can also run yarn run check to run all 4 commands at once.

  • The code was formatted using Prettier (yarn run format)
  • The code has no linting errors (yarn run lint)
  • All tests are passing (yarn run test)
  • There are no flow-type errors (yarn run flow)

Changes

If one of the following checks doesn't make sense due to the type of PR, just check them.

  • Tests have been added/updated
  • Documentation has been added/updated
  • My changes have proper flow-types

rename all occurences of robin frischmann to robin weser
@robinweser robinweser merged commit 7183b96 into master Oct 1, 2020
@robinweser robinweser deleted the theme-value-plugin branch November 30, 2020 15:42
@montogeek
Copy link
Contributor

@robinweser It is possible to get typings when writing

css({ color: "foreground.prim..."})

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants