Skip to content

Composition with pseudoselectors #10

@joshwnj

Description

@joshwnj
  • rethink this feature, and decide whether to reinstate it:

Composition with pseudoselectors

Sometimes you have an atom that you want to compose, but within the scope of a pseudoselector. Traditionally, if you wanted to change the classes applied to an element on hover, you'd need to do that with javascript.

cmz.pseudo allows us to create new atoms from old ones that are wrapped in a pseudoselector. For example:

// say we've got an existing atom:
const pinkFancyText = cmz(`
  color: hotpink
  font-style: italic
`)

// but we only want our element to be pink and fancy when it is hovered:
const elemStyle = cmz([`
  width: 500px
`,
  cmz.pseudo('hover', pinkFancyText)
])

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