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

Add static createComponent helper #652

Open
michalkvasnicak opened this issue Oct 7, 2020 · 0 comments
Open

Add static createComponent helper #652

michalkvasnicak opened this issue Oct 7, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@michalkvasnicak
Copy link
Member

michalkvasnicak commented Oct 7, 2020

Basically following is too verbose:

const Wrapper = createComponent(Flex, {
  styles: {
    alignItems: 'flex-start',
    width: '100%',
    ...variantStyles('parameterType', {
      [TaskParameterType.LABEL]: {
        mb: 2,
      },
      [TaskParameterType.SINGLECHOICE]: {
        mt: 4,
      },
    }),
  },
  variants: [
    variant('parameterType', true, [
      TaskParameterType.LABEL,
      TaskParameterType.SINGLECHOICE,
    ] as const),
  ],
})

I'd like to create variants by simple variants: {} but in this case I don't know how to create boolean variants. Something like react-stitches.

Also it could create new version of visage component that has style generated on create and not on mount. In this case maybe it could offer extensibility but primitive usage should be as fast as possible (pregenerated CSS). The problem can be theme access through context, in this case we can render styles only on render.

Also we need to think about variant and prop stripping.

@michalkvasnicak michalkvasnicak added the enhancement New feature or request label Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant