Skip to content

Commit

Permalink
Wrap storybook preview in <Profiler> component (#4746)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrohan authored Jul 18, 2024
1 parent caa0001 commit 2ec6d14
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions packages/react/.storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import clsx from 'clsx'

import './storybook.css'
import './primitives-v8.css'
import {Profiler} from 'react'

let storybookViewports = {}
Object.entries(PrimerBreakpoints).forEach(([viewport, value]) => {
Expand Down Expand Up @@ -219,17 +220,23 @@ export const decorators = [
</ThemeProvider>
))
) : (
<ThemeProvider dayScheme={context.globals.colorScheme} nightScheme={context.globals.colorScheme} colorMode="day">
<div className={clsx('story-wrap')}>
<BaseStyles>
{showSurroundingElements ? <a href="https://github.com/primer/react">Primer documentation</a> : ''}
<FeatureFlags flags={{primer_react_action_list_item_as_button: true}}>
<Story {...context} />
</FeatureFlags>
{showSurroundingElements ? <a href="https://github.com/primer/react">Primer documentation</a> : ''}
</BaseStyles>
</div>
</ThemeProvider>
<Profiler id="storybook-preview">
<ThemeProvider
dayScheme={context.globals.colorScheme}
nightScheme={context.globals.colorScheme}
colorMode="day"
>
<div className={clsx('story-wrap')}>
<BaseStyles>
{showSurroundingElements ? <a href="https://github.com/primer/react">Primer documentation</a> : ''}
<FeatureFlags flags={{primer_react_action_list_item_as_button: true}}>
<Story {...context} />
</FeatureFlags>
{showSurroundingElements ? <a href="https://github.com/primer/react">Primer documentation</a> : ''}
</BaseStyles>
</div>
</ThemeProvider>
</Profiler>
)
},
]
Expand Down

0 comments on commit 2ec6d14

Please sign in to comment.