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

[gatsby-theme-wordpress-basic] Split theme.js #8

Open
jeanfredrik opened this issue Jun 1, 2021 · 0 comments
Open

[gatsby-theme-wordpress-basic] Split theme.js #8

jeanfredrik opened this issue Jun 1, 2021 · 0 comments
Assignees
Labels
feat New feature or request

Comments

@jeanfredrik
Copy link
Member

The theme.js file is the core of a powerful way to customize the Gatsby theme plugin in a project. Right now, the exported object of that file in translated into CSS variables and default properties for components. There’s no distinction made between these which leads to there being CSS variables that aren’t used (because they are supposed to be props for components) or extra props that are forwarded as HTML attributes via ...restProps (because thet are supposed to be CSS vars).

I suggest splitting the object into two or more distinct parts, e.g.:

export const defaultProps = {
  Link: {
    components: ...
  },
  // ...
}

export const cssVars = {
  link: {
    default: { color: "#369" },
    hover: { color: "#47A" },
  },
}

This makes it easy to add more exports later for other purposes.

@jeanfredrik jeanfredrik added the feat New feature or request label Jun 1, 2021
@jeanfredrik jeanfredrik self-assigned this Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant