-
Notifications
You must be signed in to change notification settings - Fork 5
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
Box block, VariantProps fix #162
Changes from all commits
61c578e
34fd820
7f8672b
1d07a06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { styled } from '../stitches.config' | ||
import type { VariantProps } from '../utils' | ||
|
||
export const Box = styled('div') | ||
export const Box = styled('div', { | ||
display: 'block' | ||
}) | ||
|
||
export type BoxProps = VariantProps<typeof Box> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
import React, { Component, ComponentProps, ComponentType } from 'react' | ||
import React, { ComponentProps, ComponentType } from 'react' | ||
|
||
// XXX: export type { VariantProps } from '@stitches/react' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we just delete this? also, I think I'm confused on whether the stitches There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know, tbh. It doesn't hurt to keep the comment around as a reminder that we could bring back the stitches type if/when it's fixed upstream, though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sgtm! |
||
|
||
export type VariantProps<T> = JSX.IntrinsicAttributes & (T extends ComponentType ? ComponentProps<T> : T) | ||
|
||
export function identity (v: any) { | ||
return v | ||
|
@@ -21,5 +25,3 @@ export function withFixedProps ( | |
return <Component {...fixed} {...props} /> | ||
} | ||
} | ||
|
||
export type VariantProps<T, P extends {} = T extends ComponentType ? ComponentProps<T> : T> = T & JSX.IntrinsicAttributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FlexVariant
was a typo 😭 so I'm addingFlexProps
and aliasing it toFlexVariant
so that we don't have to release this as a breaking change. TheFIXME[1.0]
comment should remind us to remove the alias when we release 1.0.