File tree Expand file tree Collapse file tree 3 files changed +15
-17
lines changed Expand file tree Collapse file tree 3 files changed +15
-17
lines changed Original file line number Diff line number Diff line change 1+ import type { Decorator } from "@storybook/react"
2+
3+ // Function that creates a decorator with a limited width container
4+ // Provides consistent centering and configurable max-width constraint
5+ export const withLimitedWidth = ( maxWidth : number = 600 ) : Decorator => {
6+ return ( Story ) => (
7+ < div style = { { maxWidth : `${ maxWidth } px` , margin : "0 auto" } } >
8+ < Story />
9+ </ div >
10+ )
11+ }
Original file line number Diff line number Diff line change 11import type { Meta , StoryObj } from "@storybook/react"
22import AutoApproveMenu from "../../../webview-ui/src/components/chat/AutoApproveMenu"
3+ import { withLimitedWidth } from "../src/decorators/withLimitedWidth"
34
45const meta : Meta < typeof AutoApproveMenu > = {
56 title : "Chat/AutoApproveMenu" ,
67 component : AutoApproveMenu ,
7- parameters : {
8- layout : "padded" ,
9- } ,
10- decorators : [
11- ( Story ) => (
12- < div style = { { maxWidth : "400px" , margin : "0 auto" } } >
13- < Story />
14- </ div >
15- ) ,
16- ] ,
8+ decorators : [ withLimitedWidth ( 400 ) ] ,
179}
1810
1911export default meta
Original file line number Diff line number Diff line change 11import type { Meta , StoryObj } from "@storybook/react"
22import { AutoApproveSettings } from "../../../webview-ui/src/components/settings/AutoApproveSettings"
3+ import { withLimitedWidth } from "../src/decorators/withLimitedWidth"
34
45const meta : Meta < typeof AutoApproveSettings > = {
56 title : "Settings/AutoApproveSettings" ,
67 component : AutoApproveSettings ,
7- decorators : [
8- ( Story ) => (
9- < div style = { { maxWidth : "600px" , margin : "0 auto" } } >
10- < Story />
11- </ div >
12- ) ,
13- ] ,
8+ decorators : [ withLimitedWidth ( 600 ) ] ,
149}
1510
1611export default meta
You can’t perform that action at this time.
0 commit comments