Skip to content

Commit

Permalink
chore[DST-68]: unify switch api (#3227)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahgm authored Jul 26, 2023
1 parent 8977129 commit 54416dc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .changeset/forty-toes-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@marigold/docs": patch
"@marigold/components": patch
---

chore: unify switch api
8 changes: 4 additions & 4 deletions docs/content/components/switch/switch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ import { Switch } from '@marigold/components';
default: 'false',
},
{
property: 'checked',
property: 'selected',
type: 'boolean',
description: 'With this prop you can set the switch checked.',
description: 'With this prop you can set the switch selected.',
default: 'false',
},
{
Expand All @@ -44,9 +44,9 @@ import { Switch } from '@marigold/components';
default: '100%',
},
{
property: 'defaultChecked',
property: 'defaultSelected',
type: 'boolean',
description: 'Set the default checked status of the switch.',
description: 'Set the default selected status of the switch.',
default: 'false',
},
{
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/Switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type CustomSwitchProps =
export interface SwitchProps
extends Omit<AriaSwitchProps, 'isSelected'>,
Omit<HtmlProps<'input'>, CustomSwitchProps> {
checked?: boolean;
selected?: boolean;
variant?: string;
size?: string;
width?: string;
Expand All @@ -39,7 +39,7 @@ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
variant,
size,
width = '100%',
checked,
selected,
disabled,
readOnly,
defaultChecked,
Expand All @@ -50,7 +50,7 @@ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
const inputRef = useObjectRef(ref);
// Adjust props to the react-aria API
const props = {
isSelected: checked,
isSelected: selected,
isDisabled: disabled,
isReadOnly: readOnly,
defaultSelected: defaultChecked,
Expand Down

2 comments on commit 54416dc

@vercel
Copy link

@vercel vercel bot commented on 54416dc Jul 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

marigold-storybook – ./

marigold-storybook-git-main-marigold.vercel.app
marigold-storybook-marigold.vercel.app
marigold-latest.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 54416dc Jul 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

marigold-docs – ./

marigold-docs.vercel.app
marigold-docs-marigold.vercel.app
marigold-docs-git-main-marigold.vercel.app

Please sign in to comment.