Skip to content

Composition of common rules #33

Description

@xypnox

In several instances, I repeat a set of css styles, for example for a button I will have a set of css rules which will also be used for a anchor tag as well. Ex:

const commonStyles = `
  padding: 1em;
`

const Button = () => {
  css` button { ${commonStyles} }`
  return <button></button>
}

const AButton = () => {
  css` a { ${commonStyles} }`
  return <a></a>
}

However, trying to accomplish this with solid-styled I run into the problem that the inserted string is converted to a variable.

Note that I will also have some specific styles in the css (not shown in example) so using a dynamic component doesn't make sense. (Ex: sharing border and focus styles between input and textarea, but adding additional styling in the respective components themselves)

Is there a way to compose styles (or insert style strings inside the css)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions