Skip to content

Commit

Permalink
Add explicit MenuProps to improve TS performance
Browse files Browse the repository at this point in the history
  • Loading branch information
ciampo committed Dec 13, 2024
1 parent daf3f08 commit c8b8c5c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/components/src/menu/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Button from '../../button';
import Modal from '../../modal';
import { createSlotFill, Provider as SlotFillProvider } from '../../slot-fill';
import { ContextSystemProvider } from '../../context';
import type { MenuProps } from '../types';

const meta: Meta< typeof Menu > = {
id: 'components-experimental-menu',
Expand Down Expand Up @@ -66,7 +67,7 @@ const meta: Meta< typeof Menu > = {
};
export default meta;

export const Default: StoryFn< typeof Menu > = ( props ) => (
export const Default: StoryFn< typeof Menu > = ( props: MenuProps ) => (
<Menu { ...props }>
<Menu.TriggerButton
render={ <Button __next40pxDefaultSize variant="secondary" /> }
Expand Down Expand Up @@ -118,7 +119,7 @@ export const Default: StoryFn< typeof Menu > = ( props ) => (
);
Default.args = {};

export const WithSubmenu: StoryFn< typeof Menu > = ( props ) => (
export const WithSubmenu: StoryFn< typeof Menu > = ( props: MenuProps ) => (
<Menu { ...props }>
<Menu.TriggerButton
render={ <Button __next40pxDefaultSize variant="secondary" /> }
Expand Down Expand Up @@ -162,7 +163,7 @@ WithSubmenu.args = {
...Default.args,
};

export const WithCheckboxes: StoryFn< typeof Menu > = ( props ) => {
export const WithCheckboxes: StoryFn< typeof Menu > = ( props: MenuProps ) => {
const [ isAChecked, setAChecked ] = useState( false );
const [ isBChecked, setBChecked ] = useState( true );
const [ multipleCheckboxesValue, setMultipleCheckboxesValue ] = useState<
Expand Down Expand Up @@ -296,7 +297,7 @@ WithCheckboxes.args = {
...Default.args,
};

export const WithRadios: StoryFn< typeof Menu > = ( props ) => {
export const WithRadios: StoryFn< typeof Menu > = ( props: MenuProps ) => {
const [ radioValue, setRadioValue ] = useState( 'two' );
const onRadioChange: React.ComponentProps<
typeof Menu.RadioItem
Expand Down Expand Up @@ -366,7 +367,7 @@ const modalOnTopOfMenuPopover = css`
`;

// For more examples with `Modal`, check https://ariakit.org/examples/menu-wordpress-modal
export const WithModals: StoryFn< typeof Menu > = ( props ) => {
export const WithModals: StoryFn< typeof Menu > = ( props: MenuProps ) => {
const [ isOuterModalOpen, setOuterModalOpen ] = useState( false );
const [ isInnerModalOpen, setInnerModalOpen ] = useState( false );

Expand Down Expand Up @@ -477,7 +478,7 @@ const Fill = ( { children }: { children: React.ReactNode } ) => {
);
};

export const WithSlotFill: StoryFn< typeof Menu > = ( props ) => {
export const WithSlotFill: StoryFn< typeof Menu > = ( props: MenuProps ) => {
return (
<SlotFillProvider>
<Menu { ...props }>
Expand Down Expand Up @@ -525,7 +526,7 @@ const toolbarVariantContextValue = {
variant: 'toolbar',
},
};
export const ToolbarVariant: StoryFn< typeof Menu > = ( props ) => (
export const ToolbarVariant: StoryFn< typeof Menu > = ( props: MenuProps ) => (
// TODO: add toolbar
<ContextSystemProvider value={ toolbarVariantContextValue }>
<Menu { ...props }>
Expand Down Expand Up @@ -560,7 +561,7 @@ ToolbarVariant.args = {
...Default.args,
};

export const InsideModal: StoryFn< typeof Menu > = ( props ) => {
export const InsideModal: StoryFn< typeof Menu > = ( props: MenuProps ) => {
const [ isModalOpen, setModalOpen ] = useState( false );
return (
<>
Expand Down

0 comments on commit c8b8c5c

Please sign in to comment.