Skip to content

Commit bcd955a

Browse files
talissoncostaclaude
andcommitted
refactor(usage): stop the story importing a stylesheet for one rule
The harness fakes the project select rather than rendering UsageFilters, so it was reaching into that component's stylesheet for the width alone. A constant in the story says the same thing without coupling a story to a component it does not render. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 6cebfd1 commit bcd955a

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

frontend/documentation/components/UsageDashboard.stories.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ import { BillingPeriod, PeriodOption } from 'common/types/requests'
3131
import { PlanLimit } from 'components/shared/UsageBar/utils'
3232
import { Subscription } from 'common/types/responses'
3333
import { toUsageResponse, USAGE_SCENARIOS } from './fixtures/usage'
34-
// The harness fakes the project select, so it never renders UsageFilters and
35-
// would otherwise miss the width its stylesheet sets.
36-
import 'components/pages/usage/components/UsageFilters/UsageFilters.scss'
34+
35+
// UsageFilters sets this in its stylesheet, which the harness never loads:
36+
// it fakes the project select rather than rendering the real component.
37+
const FILTER_WIDTH = { minWidth: 210 }
3738

3839
const PROJECTS = [
3940
'All Projects',
@@ -170,7 +171,7 @@ const UsagePage: FC<HarnessProps> = ({
170171
hint='Narrow the chart and the breakdown by period or project.'
171172
action={
172173
<Row className='gap-2'>
173-
<div className='usage-filters__field'>
174+
<div style={FILTER_WIDTH}>
174175
<Select
175176
aria-label='Period'
176177
onChange={(option: PeriodOption) =>
@@ -180,7 +181,7 @@ const UsagePage: FC<HarnessProps> = ({
180181
value={periods.find((option) => option.value === billingPeriod)}
181182
/>
182183
</div>
183-
<div className='usage-filters__field'>
184+
<div style={FILTER_WIDTH}>
184185
<Select
185186
aria-label='Project'
186187
onChange={(option: { value: string }) =>

0 commit comments

Comments
 (0)