From 6c4b39913ff2d38b3bdba0a9f19713abdd0b95f0 Mon Sep 17 00:00:00 2001 From: Jean-Marc Millet Date: Mon, 20 Nov 2023 12:15:42 +0100 Subject: [PATCH] add a localeArgType for errorpages --- stories/controls.ts | 6 ++++++ stories/errorpage401.stories.tsx | 4 ++++ stories/errorpage404.stories.tsx | 4 ++++ stories/errorpage500.stories.tsx | 6 ++---- stories/errorpageauth.stories.tsx | 6 ++---- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/stories/controls.ts b/stories/controls.ts index 56763cde4f..945d0ad9c0 100644 --- a/stories/controls.ts +++ b/stories/controls.ts @@ -2,6 +2,12 @@ import { iconTable } from "../src/lib/components/icon/Icon.component"; export const iconOptions = Object.keys(iconTable); +export const localeArgtype = { + control: { type: 'radio' }, + options: ['en', 'fr'], + description: 'Set language for the component', +}; + export const iconArgType = { control: { type: 'select' }, options: iconOptions, diff --git a/stories/errorpage401.stories.tsx b/stories/errorpage401.stories.tsx index 0c4b015bc3..21eed1d6e7 100644 --- a/stories/errorpage401.stories.tsx +++ b/stories/errorpage401.stories.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { ErrorPage401 } from '../src/lib/components/error-pages/ErrorPage401.component'; import { Wrapper } from './common'; +import { localeArgtype } from './controls'; export default { title: 'Components/Navigation/ErrorPages/401', component: ErrorPage401, @@ -11,6 +12,9 @@ export default { supportLink: 'https://www.scality.com/support/', onReturnHomeClick: () => {}, }, + argTypes: { + locale: localeArgtype, + }, }; export const Default = {}; diff --git a/stories/errorpage404.stories.tsx b/stories/errorpage404.stories.tsx index c7d73f381d..463210f857 100644 --- a/stories/errorpage404.stories.tsx +++ b/stories/errorpage404.stories.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { ErrorPage404 } from '../src/lib/components/error-pages/ErrorPage404.component'; import { Wrapper } from './common'; +import { localeArgtype } from './controls'; export default { title: 'Components/Navigation/ErrorPages/404', component: ErrorPage404, @@ -10,6 +11,9 @@ export default { args: { onReturnHomeClick: () => {}, }, + argTypes: { + locale: localeArgtype, + }, }; export const Default = {}; diff --git a/stories/errorpage500.stories.tsx b/stories/errorpage500.stories.tsx index cffff66215..d354b5e423 100644 --- a/stories/errorpage500.stories.tsx +++ b/stories/errorpage500.stories.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { ErrorPage500 } from '../src/lib/components/error-pages/ErrorPage500.component'; import { Wrapper } from './common'; +import { localeArgtype } from './controls'; export default { title: 'Components/Navigation/ErrorPages/500', component: ErrorPage500, @@ -11,10 +12,7 @@ export default { onReturnHomeClick: () => {}, }, argTypes: { - locale: { - options: ['en', 'fr'], - control: { type: 'radio' }, - }, + locale: localeArgtype, errorMessage: { control: { type: 'object', diff --git a/stories/errorpageauth.stories.tsx b/stories/errorpageauth.stories.tsx index da78030e23..915437a44f 100644 --- a/stories/errorpageauth.stories.tsx +++ b/stories/errorpageauth.stories.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { ErrorPageAuth } from '../src/lib/components/error-pages/ErrorPageAuth.component'; import { Wrapper } from './common'; +import { localeArgtype } from './controls'; export default { title: 'Components/Navigation/ErrorPages/Auth', component: ErrorPageAuth, @@ -11,10 +12,7 @@ export default { onReturnHomeClick: () => {}, }, argTypes: { - locale: { - options: ['en', 'fr'], - control: { type: 'radio' }, - }, + locale: localeArgtype, }, }; export const Default = {};