Skip to content

Commit

Permalink
docs: fix type errors and build
Browse files Browse the repository at this point in the history
  • Loading branch information
segunadebayo committed May 10, 2024
1 parent 623e558 commit 7d1d76f
Show file tree
Hide file tree
Showing 10 changed files with 285 additions and 597 deletions.
28 changes: 12 additions & 16 deletions packages/react/src/styled-system/create-style-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,19 @@ export const createStyleContext = <R extends SlotRecipeKey>(recipe: R) => {
options: { defaultProps?: Partial<P> } = {},
): React.FC<React.PropsWithoutRef<P>> {
const { defaultProps } = options
const StyledComponent = forwardRef<any, any>(
({ unstyled, ...baseProps }) => {
const props = { ...defaultProps, ...baseProps }
const slotRecipe = useSlotRecipe(recipe, props.recipe)
// @ts-ignore
const [variantProps, otherProps] = slotRecipe.splitVariantProps(props)
const slotStyles = unstyled
? EMPTY_SLOT_STYLES
: slotRecipe(variantProps)
const StyledComponent = ({ unstyled, ...baseProps }: any) => {
const props = { ...defaultProps, ...baseProps }
const slotRecipe = useSlotRecipe(recipe, props.recipe)
// @ts-ignore
const [variantProps, otherProps] = slotRecipe.splitVariantProps(props)
const slotStyles = unstyled ? EMPTY_SLOT_STYLES : slotRecipe(variantProps)

return (
<RecipeStylesProvider value={slotStyles}>
<Component {...otherProps} />
</RecipeStylesProvider>
)
},
)
return (
<RecipeStylesProvider value={slotStyles}>
<Component {...otherProps} />
</RecipeStylesProvider>
)
}

// @ts-expect-error
StyledComponent.displayName = Component.displayName || Component.name
Expand Down

0 comments on commit 7d1d76f

Please sign in to comment.