Enforce Emotion (@emotion/styled and @emotion/react) as the only styling library; forbid styled-components usage.
95
97%
Does it follow best practices?
Impact
92%
1.61xAverage score across 4 eval scenarios
Passed
No known issues
The team is adding a new set of UI components to the shared component library and wants to author Storybook stories for each of them. The stories need to be rendered with the full project theme — including brand colors, web fonts, and global baseline styles — so that the design team can review components in context. Without the theme wired in, components render with fallback defaults that don't represent the real product.
An engineer needs to create a Storybook decorator that wraps every story in the appropriate theme context. The decorator should accept an optional theme prop so that individual stories can opt into a light or dark variant. It should compose cleanly with the existing story file format.
Produce a withStyling.js decorator file (e.g., at src/config/storybook/decorators/withStyling.js) that exports a default function. The decorator should be a higher-order function that takes optional decorator arguments (like { theme }) and returns a function that wraps the Story component in the correct provider. Also produce a brief example.stories.js file that demonstrates registering the decorator and writing one example story using it.