Skip to content

Commit

Permalink
check if component is not html
Browse files Browse the repository at this point in the history
  • Loading branch information
siriwatknp committed May 1, 2024
1 parent a5f2b38 commit 1c20980
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/pigment-css-react/src/styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ export default function styled(tag, componentMeta = {}) {
getVariantClasses(inProps, variants),
);

if (shouldUseAs && !shouldForwardProp) {
// Reassign `shouldForwardProp` based on the incoming `as` prop
if (isHtmlTag(Component)) {
finalShouldForwardProp = isPropValid;
} else if (slot === 'Root' || slot === 'root') {
finalShouldForwardProp = rootShouldForwardProp;
} else {
finalShouldForwardProp = slotShouldForwardProp;
if (inProps.as && !shouldForwardProp) {
// Reassign `shouldForwardProp` if incoming `as` prop is a React component
if (!isHtmlTag(Component)) {
if (slot === 'Root' || slot === 'root') {
finalShouldForwardProp = rootShouldForwardProp;
} else {
finalShouldForwardProp = slotShouldForwardProp;
}
}
}

Expand Down

0 comments on commit 1c20980

Please sign in to comment.