Skip to content

Commit

Permalink
add a localeArgType for errorpages
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanMarcMilletScality committed Nov 20, 2023
1 parent eb78012 commit 6c4b399
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
6 changes: 6 additions & 0 deletions stories/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions stories/errorpage401.stories.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -11,6 +12,9 @@ export default {
supportLink: 'https://www.scality.com/support/',
onReturnHomeClick: () => {},
},
argTypes: {
locale: localeArgtype,
},
};
export const Default = {};

Expand Down
4 changes: 4 additions & 0 deletions stories/errorpage404.stories.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -10,6 +11,9 @@ export default {
args: {
onReturnHomeClick: () => {},
},
argTypes: {
locale: localeArgtype,
},
};
export const Default = {};

Expand Down
6 changes: 2 additions & 4 deletions stories/errorpage500.stories.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -11,10 +12,7 @@ export default {
onReturnHomeClick: () => {},
},
argTypes: {
locale: {
options: ['en', 'fr'],
control: { type: 'radio' },
},
locale: localeArgtype,
errorMessage: {
control: {
type: 'object',
Expand Down
6 changes: 2 additions & 4 deletions stories/errorpageauth.stories.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -11,10 +12,7 @@ export default {
onReturnHomeClick: () => {},
},
argTypes: {
locale: {
options: ['en', 'fr'],
control: { type: 'radio' },
},
locale: localeArgtype,
},
};
export const Default = {};
Expand Down

0 comments on commit 6c4b399

Please sign in to comment.