Skip to content

Commit

Permalink
fix(Toggle): fix issue with size prop (#9546)
Browse files Browse the repository at this point in the history
Co-authored-by: Taylor Jones <[email protected]>
  • Loading branch information
tw15egan and tay1orjones authored Aug 31, 2021
1 parent bf4d776 commit 177689c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
35 changes: 23 additions & 12 deletions packages/react/src/components/Toggle/Toggle-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,34 @@ export default {
};

export const Default = () => (
<>
<Toggle
labelText="Toggle (md)"
size="md"
labelA="Off"
labelB="On"
defaultToggled
className="some-class"
id="toggle-1"
/>
<br />
<Toggle
labelText="Toggle (sm)"
size="sm"
defaultToggled
className="some-class"
id="toggle-2"
/>
</>
);

export const Playground = () => (
<Toggle
defaultToggled
{...toggleProps()}
className="some-class"
id="toggle-1"
id="toggle-3"
/>
);

Default.storyName = 'Toggle';

Default.parameters = {
info: {
text: `
Toggles are controls that are used to quickly switch between two possible states. The example below shows
an uncontrolled Toggle component. To use the Toggle component as a controlled component, set the toggled property.
Setting the toggled property will allow you to change the value dynamically, whereas setting the defaultToggled
prop will only set the value initially. This example has defaultToggled set to true.
`,
},
};
2 changes: 1 addition & 1 deletion packages/react/src/components/Toggle/Toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class Toggle extends React.Component {
});

const toggleClasses = classNames(`${prefix}--toggle-input`, {
[`${prefix}--toggle-input--small`]: size,
[`${prefix}--toggle-input--small`]: size === 'sm',
});

const checkedProps = {};
Expand Down

0 comments on commit 177689c

Please sign in to comment.