Skip to content

Commit

Permalink
build: 👷 adjust styled-components dep
Browse files Browse the repository at this point in the history
  • Loading branch information
edvansts committed Oct 20, 2023
1 parent 57f756b commit ea19692
Show file tree
Hide file tree
Showing 5 changed files with 241 additions and 140 deletions.
24 changes: 0 additions & 24 deletions example/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
import React from 'react';

import { StyleSheetManager } from 'styled-components';
import isPropValid from '@emotion/is-prop-valid';

// This implements the default behavior from styled-components v5
function shouldForwardProp(propName, target) {
if (typeof target === 'string') {
// For HTML elements, forward the prop if it is a valid HTML attribute
return isPropValid(propName);
}
// For other elements, forward all props
return true;
}

export const decorators = [
Story => {
return (
<StyleSheetManager shouldForwardProp={shouldForwardProp}>
<Story />
</StyleSheetManager>
);
},
];
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "^5.0.1",
"styled-components": "^6.1.0"
"styled-components": "^5.3.11"
},
"devDependencies": {
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
Expand Down
Loading

0 comments on commit ea19692

Please sign in to comment.