forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hooks.ts
36 lines (30 loc) · 1.09 KB
/
hooks.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { useGlobals as useStorybookGlobals, Args as StorybookArgs } from '@storybook/api';
import { StoryContext as StorybookContext, Parameters } from '@storybook/addons';
import { DIR_ID, STRICT_MODE_ID, THEME_ID } from './constants';
import type { ThemeIds } from './theme';
export interface FluentStoryContext extends StorybookContext {
globals: FluentGlobals;
parameters: FluentParameters;
}
/**
* Extends the storybook globals object to include fluent specific properties
*/
export interface FluentGlobals extends StorybookArgs {
[DIR_ID]?: 'ltr' | 'rtl';
[THEME_ID]?: ThemeIds;
[STRICT_MODE_ID]?: boolean;
}
/**
* Extends the storybook parameters object to include fluent specific properties
*/
export interface FluentParameters extends Parameters {
dir?: 'ltr' | 'rtl';
fluentTheme?: ThemeIds;
mode?: 'default' | 'vr-test';
}
export function useGlobals(): [FluentGlobals, (newGlobals: FluentGlobals) => void] {
return useStorybookGlobals();
}
export function parameters(options?: FluentParameters) {
return { dir: 'ltr', fluentTheme: 'web-light', mode: 'default', ...options };
}