Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: simple basic status, account and product switcher docs (#3255)
* docs: simple basic status, account and product switcher docs * chore: missing deps * Apply suggestions from code review Co-authored-by: Sarah <sali@twilio.com> * fix: pr feedback and examples improvements * chore: apply suggestions from code review Co-authored-by: Sarah <sali@twilio.com> * chore: status icons and vrt list * chore: changesets * chore: escape character --------- Co-authored-by: Sarah <sali@twilio.com>
- Loading branch information
1 parent
a2c1c91
commit 76b28cb
Showing
22 changed files
with
1,014 additions
and
130 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@twilio-paste/status': patch | ||
'@twilio-paste/core': patch | ||
--- | ||
|
||
[Status] paired iconography should be decorative and paired with visible, descriptive text |
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
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
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/paste-website/src/component-examples/AccountSwitcherExamples.ts
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 @@ | ||
export const accountSwitcherExample = ` | ||
const AccountSwitcherMenu = () => { | ||
const accountSwitcher = useAccountSwitcherState(); | ||
const [selectedAccount, setSelectedAccount] = React.useState('Owl Telehealth'); | ||
return ( | ||
<> | ||
<AccountSwitcherBadge {...accountSwitcher} i18nButtonLabel="Switch accounts"> | ||
Owl Telehealth | ||
</AccountSwitcherBadge> | ||
<AccountSwitcher {...accountSwitcher} aria-label="Avaiable accounts"> | ||
<AccountSwitcherGroup label="Recent accounts"> | ||
<AccountSwitcherItemRadio | ||
name="recent_accounts" | ||
value="Owl Telehealth" | ||
checked={selectedAccount === 'Owl Telehealth'} | ||
onChange={() => setSelectedAccount('Owl Telehealth')} | ||
{...accountSwitcher} | ||
> | ||
Owl Telehealth | ||
</AccountSwitcherItemRadio> | ||
<AccountSwitcherItemRadio | ||
name="recent_accounts" | ||
value="Owl Health Demo" | ||
checked={selectedAccount === 'Owl Health Demo'} | ||
onChange={() => setSelectedAccount('Owl Health Demo')} | ||
{...accountSwitcher} | ||
> | ||
Owl Health Demo | ||
</AccountSwitcherItemRadio> | ||
<AccountSwitcherItemRadio | ||
name="recent_accounts" | ||
value="Owl Subway" | ||
checked={selectedAccount === 'Owl Subway'} | ||
onChange={() => setSelectedAccount('Owl Subway')} | ||
{...accountSwitcher} | ||
> | ||
Owl Subway | ||
</AccountSwitcherItemRadio> | ||
</AccountSwitcherGroup> | ||
<AccountSwitcherSeparator /> | ||
<AccountSwitcherItem {...accountSwitcher} href="#"> | ||
Account settings | ||
</AccountSwitcherItem> | ||
<AccountSwitcherSeparator /> | ||
<AccountSwitcherItem {...accountSwitcher} href="#"> | ||
View all accounts | ||
</AccountSwitcherItem> | ||
<AccountSwitcherItem {...accountSwitcher} href="#"> | ||
View all subaccounts | ||
</AccountSwitcherItem> | ||
<AccountSwitcherSeparator /> | ||
<AccountSwitcherItem {...accountSwitcher} href="#"> | ||
Admin Center | ||
</AccountSwitcherItem> | ||
</AccountSwitcher> | ||
</> | ||
); | ||
}; | ||
render( | ||
<AccountSwitcherMenu /> | ||
) | ||
`.trim(); |
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
77 changes: 77 additions & 0 deletions
77
packages/paste-website/src/component-examples/ProductSwitcherExamples.ts
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,77 @@ | ||
export const productSwitcherExample = ` | ||
const ProductSwitcherMenu = () => { | ||
const productSwitcher = useProductSwitcherState(); | ||
const [product, setProduct] = React.useState('twilio'); | ||
return ( | ||
<> | ||
<ProductSwitcherButton {...productSwitcher} i18nButtonLabel="Switch products" /> | ||
<ProductSwitcher {...productSwitcher} aria-label="Avaiable accounts"> | ||
<ProductSwitcherItem | ||
{...productSwitcher} | ||
name="product" | ||
value="twilio" | ||
checked={product === 'twilio'} | ||
onChange={(e) => { | ||
setProduct('twilio'); | ||
}} | ||
productName="Twilio" | ||
productStrapline="SMS, Voice & Video" | ||
productIcon={<LogoTwilioIcon decorative />} | ||
/> | ||
<ProductSwitcherItem | ||
{...productSwitcher} | ||
name="product" | ||
value="segment" | ||
checked={product === 'segment'} | ||
onChange={(e) => { | ||
setProduct('segment'); | ||
}} | ||
productName="Segment" | ||
productStrapline="Customer data platform" | ||
productIcon={<ProductSegmentIcon decorative />} | ||
/> | ||
<ProductSwitcherItem | ||
{...productSwitcher} | ||
name="product" | ||
value="flex" | ||
checked={product === 'flex'} | ||
onChange={(e) => { | ||
setProduct('flex'); | ||
}} | ||
productName="Flex" | ||
productStrapline="Cloud-based contact center" | ||
productIcon={<ProductFlexIcon decorative />} | ||
/> | ||
<ProductSwitcherItem | ||
{...productSwitcher} | ||
name="product" | ||
value="sendgrid" | ||
checked={product === 'sendgrid'} | ||
onChange={(e) => { | ||
setProduct('sendgrid'); | ||
}} | ||
productName="SendGrid" | ||
productStrapline="Email delivery and API" | ||
productIcon={<ProductEmailAPIIcon decorative />} | ||
/> | ||
<ProductSwitcherItem | ||
{...productSwitcher} | ||
name="product" | ||
value="admin" | ||
checked={product === 'admin'} | ||
onChange={(e) => { | ||
setProduct('admin'); | ||
}} | ||
productName="Console Admin" | ||
productStrapline="Admin center" | ||
productIcon={<LogoTwilioIcon decorative />} | ||
/> | ||
</ProductSwitcher> | ||
</> | ||
); | ||
}; | ||
render( | ||
<ProductSwitcherMenu /> | ||
) | ||
`.trim(); |
Oops, something went wrong.