Skip to content

Commit

Permalink
Update stories
Browse files Browse the repository at this point in the history
  • Loading branch information
brookewp committed Nov 23, 2023
1 parent df54fe8 commit 45689ab
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const meta: Meta< typeof CustomSelect > = {
argTypes: {
children: { control: { type: null } },
renderSelectedValue: { control: { type: null } },
value: { control: { type: null } },
},
parameters: {
actions: { argTypesRegex: '^on.*' },
Expand Down Expand Up @@ -79,6 +80,11 @@ Default.args = {
),
};

/**
* Multiple selection can be enabled by using an array for the `value` and
* `defaultValue` props. The argument of the `onChange` function will also
* change accordingly.
*/
export const MultiSelect = Template.bind( {} );
MultiSelect.args = {
defaultValue: [ 'lavender', 'tangerine' ],
Expand All @@ -89,7 +95,7 @@ MultiSelect.args = {
}
if ( currentValue.length === 0 ) return 'No colors selected';
if ( currentValue.length === 1 ) return currentValue[ 0 ];
return <div>{ currentValue.length } colors selected</div>;
return `${ currentValue.length } colors selected`;
},
children: (
<>
Expand Down Expand Up @@ -118,7 +124,7 @@ const renderControlledValue = ( gravatar: string | string[] ) => {
key={ avatar }
src={ avatar }
alt=""
aria-hidden
aria-hidden="true"
/>
<span>{ gravatar }</span>
</div>
Expand Down

0 comments on commit 45689ab

Please sign in to comment.