Skip to content

Commit

Permalink
feat(ffe-form-react): modernisering av skjemaelementer
Browse files Browse the repository at this point in the history
  • Loading branch information
tuva-odegard committed Jan 10, 2025
1 parent c802a23 commit e6e7219
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/ffe-form-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
},
"devDependencies": {
"@sb1/ffe-buildtool": "^0.9.0",
"@sb1/ffe-icons-react": "^11.0.14",
"eslint": "^8.57.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
27 changes: 24 additions & 3 deletions packages/ffe-form-react/src/ToggleSwitch.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,41 @@ export const Standard: Story = {
children: 'Jeg vil gjerne ha reklame',
},
render: function Render(args) {
return <ToggleSwitch {...args} />;
const [checked, setChecked] = React.useState(true);
return (
<ToggleSwitch
{...args}
checked={checked}
onChange={e => setChecked(e.target.checked)}
/>
);
},
};

export const HideOnOff: Story = {
args: { ...Standard.args, hideOnOff: true },
render: function Render(args) {
return <ToggleSwitch {...args} />;
const [checked, setChecked] = React.useState(true);
return (
<ToggleSwitch
{...args}
checked={checked}
onChange={e => setChecked(e.target.checked)}
/>
);
},
};

export const Description: Story = {
args: { ...Standard.args, description: 'Send meg spam' },
render: function Render(args) {
return <ToggleSwitch {...args} />;
const [checked, setChecked] = React.useState(true);
return (
<ToggleSwitch
{...args}
checked={checked}
onChange={e => setChecked(e.target.checked)}
/>
);
},
};

0 comments on commit e6e7219

Please sign in to comment.