-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ShareAutosuggest): Align correctly loading state
Following the addition of the chips in the sharing input and the cozy-ui updates, the spinner was aligned at the top of the input. This commit allows it to be centred again
- Loading branch information
Showing
4 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
packages/cozy-sharing/src/components/ShareAutosuggest.stories.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React, { useState } from 'react' | ||
|
||
import ShareAutosuggest from './ShareAutosuggest' | ||
|
||
const meta = { | ||
component: ShareAutosuggest, | ||
args: {} | ||
} | ||
|
||
export default meta | ||
|
||
const ShareAutosuggestRender = props => { | ||
const [recipients, setRecipients] = useState([]) | ||
const onPick = contactOrGroup => { | ||
setRecipients([...recipients, contactOrGroup]) | ||
} | ||
|
||
const onRemove = contactOrGroup => { | ||
setRecipients(recipients.filter(r => r.id !== contactOrGroup.id)) | ||
} | ||
return ( | ||
<ShareAutosuggest | ||
{...props} | ||
recipients={recipients} | ||
onPick={onPick} | ||
onRemove={onRemove} | ||
/> | ||
) | ||
} | ||
|
||
export const Default = { | ||
name: 'Default', | ||
render: ShareAutosuggestRender, | ||
args: { | ||
loading: false, | ||
contactsAndGroups: [ | ||
{ | ||
id: 'group1', | ||
name: 'Family', | ||
_type: 'io.cozy.contacts.groups', | ||
members: [ | ||
{ | ||
id: 'contact1', | ||
name: 'John Doe', | ||
_type: 'io.cozy.contacts' | ||
}, | ||
{ | ||
id: 'contact2', | ||
name: 'Jane Doe', | ||
_type: 'io.cozy.contacts' | ||
} | ||
] | ||
}, | ||
{ | ||
id: 'contact3', | ||
name: 'Alice Wonderland', | ||
_type: 'io.cozy.contacts', | ||
email: 'alice@wonder.land' | ||
} | ||
], | ||
placeholder: 'Type a name or email address' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters