Skip to content

Commit

Permalink
Fix ts issue with storybooks
Browse files Browse the repository at this point in the history
  • Loading branch information
nateweller committed Feb 23, 2025
1 parent 5052849 commit 55f232c
Show file tree
Hide file tree
Showing 25 changed files with 100 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import AdminPage from '../index.js';
import styles from './style.module.scss';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof AdminPage > = {
title: 'JS Packages/Components/Admin Page',
component: AdminPage,
argTypes: {
Expand All @@ -14,7 +14,9 @@ export default {
showFooter: { control: 'boolean', defaultValue: true },
showBackground: { control: 'boolean', defaultValue: true },
},
} as Meta< typeof AdminPage >;
};

export default meta;

// Export additional stories using pre-defined values
const Template: StoryFn< typeof AdminPage > = args => <AdminPage { ...args } />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import AdminSection from '../basic/index.js';
import AdminSectionHero from '../hero/index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof AdminSection > = {
title: 'JS Packages/Components/Admin Sections',
} as Meta< typeof AdminSection >;
};

export default meta;

// Export additional stories using pre-defined values
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import AutomatticBylineLogo from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof AutomatticBylineLogo > = {
title: 'JS Packages/Components/Automattic Byline Logo',
component: AutomatticBylineLogo,
} as Meta< typeof AutomatticBylineLogo >;
};

export default meta;

const Template: StoryFn< typeof AutomatticBylineLogo > = args => (
<AutomatticBylineLogo { ...args } />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import CopyToClipboard from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof CopyToClipboard > = {
title: 'JS Packages/Components/CopyToClipboard',
component: CopyToClipboard,
} as Meta< typeof CopyToClipboard >;
};

export default meta;

const Template: StoryFn< typeof CopyToClipboard > = args => <CopyToClipboard { ...args } />;
export const _default = Template.bind( {} );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import DecorativeCard from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof DecorativeCard > = {
title: 'JS Packages/Components/Decorative Card',
component: DecorativeCard,
} as Meta< typeof DecorativeCard >;
};

export default meta;

// Export additional stories using pre-defined values
const Template: StoryFn< typeof DecorativeCard > = args => <DecorativeCard { ...args } />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import Button from '../../button/index.js';
import { GlobalNotices, useGlobalNotices } from '../index.js';
import type { Meta } from '@storybook/react';

export default {
const meta: Meta< typeof GlobalNotices > = {
title: 'JS Packages/Components/GlobalNotices',
component: GlobalNotices,
decorators: [ story => <div style={ { padding: '3rem' } }>{ story() }</div> ],
} satisfies Meta< typeof GlobalNotices >;
};

export default meta;

const Template = args => {
const { createErrorNotice, createSuccessNotice, createInfoNotice, createWarningNotice } =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import Gridicon from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof Gridicon > = {
title: 'JS Packages/Components/Gridicon',
component: Gridicon,
} as Meta< typeof Gridicon >;
};

export default meta;

// Export additional stories using pre-defined values
const Template: StoryFn< typeof Gridicon > = args => <Gridicon { ...args } />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import * as allIcons from '../index.js';
import styles from './style.module.scss';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof allIcons > = {
title: 'JS Packages/Components/Icons',
component: allIcons,
parameters: {},
} as Meta< typeof allIcons >;
};

export default meta;

const sizes = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import IndeterminateProgressBar from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof IndeterminateProgressBar > = {
title: 'JS Packages/Components/Indeterminate Progress Bar',
component: IndeterminateProgressBar,
} as Meta< typeof IndeterminateProgressBar >;
};

export default meta;

const Template: StoryFn< typeof IndeterminateProgressBar > = args => {
return <IndeterminateProgressBar { ...args } />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import JetpackFooter from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof JetpackFooter > = {
title: 'JS Packages/Components/Jetpack Footer',
component: JetpackFooter,
} as Meta< typeof JetpackFooter >;
};

export default meta;

const Template: StoryFn< typeof JetpackFooter > = args => <JetpackFooter { ...args } />;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import JetpackLogo from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof JetpackLogo > = {
title: 'JS Packages/Components/Jetpack Logo',
component: JetpackLogo,
argTypes: {
logoColor: { control: 'color' },
},
} as Meta< typeof JetpackLogo >;
};

export default meta;

const Template: StoryFn< typeof JetpackLogo > = args => <JetpackLogo { ...args } />;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import JetpackProtectLogo from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof JetpackProtectLogo > = {
title: 'JS Packages/Components/Jetpack Protect Logo',
component: JetpackProtectLogo,
argTypes: {
logoColor: { control: 'color' },
},
} as Meta< typeof JetpackProtectLogo >;
};

export default meta;

const Template: StoryFn< typeof JetpackProtectLogo > = args => <JetpackProtectLogo { ...args } />;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import JetpackSearchLogo from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof JetpackSearchLogo > = {
title: 'JS Packages/Components/Jetpack Search Logo',
component: JetpackSearchLogo,
argTypes: {
logoColor: { control: 'color' },
},
} as Meta< typeof JetpackSearchLogo >;
};

export default meta;

const Template: StoryFn< typeof JetpackSearchLogo > = args => <JetpackSearchLogo { ...args } />;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import JetpackVaultPressBackupLogo from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof JetpackVaultPressBackupLogo > = {
title: 'JS Packages/Components/Jetpack VaultPress Backup Logo',
component: JetpackVaultPressBackupLogo,
argTypes: {},
} as Meta< typeof JetpackVaultPressBackupLogo >;
};

export default meta;

const Template: StoryFn< typeof JetpackVaultPressBackupLogo > = args => (
<JetpackVaultPressBackupLogo { ...args } />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import JetpackVideoPressLogo from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof JetpackVideoPressLogo > = {
title: 'JS Packages/Components/Jetpack VideoPress Logo',
component: JetpackVideoPressLogo,
argTypes: {},
} as Meta< typeof JetpackVideoPressLogo >;
};

export default meta;

const Template: StoryFn< typeof JetpackVideoPressLogo > = args => (
<JetpackVideoPressLogo { ...args } />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import LoadingPlaceholder from '../index.js';
*/
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof LoadingPlaceholder > = {
title: 'JS Packages/Components/Loading Placeholder',
component: LoadingPlaceholder,
parameters: {
layout: 'centered',
},
} as Meta< typeof LoadingPlaceholder >;
};

export default meta;

const Template: StoryFn< typeof LoadingPlaceholder > = args => <LoadingPlaceholder { ...args } />;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { useState } from 'react';
import NumberSlider from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof NumberSlider > = {
title: 'JS Packages/Components/Number Slider',
component: NumberSlider,
} as Meta< typeof NumberSlider >;
};

export default meta;

// Export additional stories using pre-defined values
const Template: StoryFn< typeof NumberSlider > = args => <NumberSlider { ...args } />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { action } from '@storybook/addon-actions';
import PricingCard from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof PricingCard > = {
title: 'JS Packages/Components/Pricing Card',
component: PricingCard,
argTypes: {
onCtaClick: { action: 'clicked' },
},
} as Meta< typeof PricingCard >;
};

export default meta;

// Export additional stories using pre-defined values
const Template: StoryFn< typeof PricingCard > = args => <PricingCard { ...args } />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import PricingTable, {
} from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof PricingTable > = {
title: 'JS Packages/Components/Pricing Table',
component: PricingTable,
subcomponents: { PricingTableColumn, PricingTableHeader, PricingTableItem },
} as Meta< typeof PricingTable >;
};

export default meta;

const Template: StoryFn< typeof PricingTable > = args => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import { IconsCard } from '../icons-card.js';
import ProductOffer from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof ProductOffer > = {
title: 'JS Packages/Components/Product Offer',
component: ProductOffer,
parameters: {
actions: { argTypesRegex: '^on.*' },
layout: 'centered',
},
} as Meta< typeof ProductOffer >;
};

export default meta;

const Template: StoryFn< typeof ProductOffer > = args => <ProductOffer { ...args } />;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CURRENCIES } from '@automattic/format-currency';
import ProductPrice from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof ProductPrice > = {
title: 'JS Packages/Components/Product Price',
component: ProductPrice,
argTypes: {
Expand All @@ -11,7 +11,9 @@ export default {
options: Object.keys( CURRENCIES ),
},
},
} as Meta< typeof ProductPrice >;
};

export default meta;

// Export additional stories using pre-defined values
const Template: StoryFn< typeof ProductPrice > = args => <ProductPrice { ...args } />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import ProgressBar from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof ProgressBar > = {
title: 'JS Packages/Components/Progress Bar',
component: ProgressBar,
} as Meta< typeof ProgressBar >;
};

export default meta;

const Template: StoryFn< typeof ProgressBar > = args => {
return <ProgressBar { ...args } />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SplitButton from '../index.js';
import type { StoryFn, Meta } from '@storybook/react';

export default {
const meta: Meta< typeof SplitButton > = {
title: 'JS Packages/Components/Split Button',
component: SplitButton,
argTypes: {
Expand All @@ -26,7 +26,9 @@ export default {
default: 'dark',
},
},
} as Meta< typeof SplitButton >;
};

export default meta;

const Template: StoryFn< typeof SplitButton > = args => (
<SplitButton { ...args }>Buy now!</SplitButton>
Expand Down
Loading

0 comments on commit 55f232c

Please sign in to comment.