Skip to content

Commit

Permalink
docs: improve Toolbar docs examples
Browse files Browse the repository at this point in the history
  • Loading branch information
chpalac committed Oct 18, 2022
1 parent 5280dfe commit 0fba0cd
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { TextBold24Regular, TextItalic24Regular } from '@fluentui/react-icons';
import { Toolbar, ToolbarToggleButton, ToolbarProps } from '@fluentui/react-toolbar';

export const ControlledToggleButton = () => {
Expand All @@ -11,12 +12,8 @@ export const ControlledToggleButton = () => {

return (
<Toolbar checkedValues={checkedValues} onCheckedValueChange={onChange}>
<ToolbarToggleButton name="edit" value="cut">
Enable Group
</ToolbarToggleButton>
<ToolbarToggleButton name="edit" value="paste">
Enable Group
</ToolbarToggleButton>
<ToolbarToggleButton icon={<TextBold24Regular />} name="edit" value="cut" />
<ToolbarToggleButton icon={<TextItalic24Regular />} name="edit" value="paste" />
</Toolbar>
);
};
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
import * as React from 'react';
import {
TextBold24Regular,
TextItalic24Regular,
TextUnderline24Regular,
AlertSnooze24Regular,
MoreHorizontal24Filled,
} from '@fluentui/react-icons';
import { Menu, MenuTrigger, MenuPopover, MenuList, MenuItem } from '@fluentui/react-components';
import { Toolbar, ToolbarButton, ToolbarDivider, ToolbarToggleButton } from '@fluentui/react-toolbar';
import type { ToolbarProps } from '@fluentui/react-toolbar';

export const Default = (props: Partial<ToolbarProps>) => (
<Toolbar {...props}>
<ToolbarButton>Click me</ToolbarButton>
<ToolbarButton>Click me</ToolbarButton>
<ToolbarDivider />
<ToolbarButton>Click me</ToolbarButton>
<ToolbarToggleButton name="toggle" value="toggle">
Click me to Toggle
</ToolbarToggleButton>
<ToolbarButton appearance="primary" icon={<TextBold24Regular />} />
<ToolbarButton icon={<TextItalic24Regular />} />
<ToolbarButton icon={<TextUnderline24Regular />} />
<ToolbarDivider />
<ToolbarToggleButton name="toggle" value="toggle" icon={<AlertSnooze24Regular />} />
<Menu>
<MenuTrigger>
<ToolbarButton icon={<MoreHorizontal24Filled />} />
</MenuTrigger>

<MenuPopover>
<MenuList>
<MenuItem>New </MenuItem>
<MenuItem>New Window</MenuItem>
<MenuItem disabled>Open File</MenuItem>
<MenuItem>Open Folder</MenuItem>
</MenuList>
</MenuPopover>
</Menu>
</Toolbar>
);
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ export const OverflowItems = (props: Partial<ToolbarProps>) => (
icon={<TextItalic16Regular />}
/>

<ToolbarOverflowDivider groupId="3" />

<OverflowMenu
itemIds={[
['underline-1', 'bold-1'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import * as React from 'react';
import {
TextBold16Regular,
TextItalic16Regular,
TextUnderline16Regular,
AlertSnooze16Regular,
} from '@fluentui/react-icons';
import { Toolbar, ToolbarButton, ToolbarDivider, ToolbarToggleButton } from '@fluentui/react-toolbar';
import type { ToolbarProps } from '@fluentui/react-toolbar';

export const Small = (props: Partial<ToolbarProps>) => (
<Toolbar {...props} size="small">
<ToolbarButton>Click me</ToolbarButton>
<ToolbarButton>Click me</ToolbarButton>
<ToolbarDivider />
<ToolbarButton>Click me</ToolbarButton>
<ToolbarToggleButton name="toggle" value="toggle">
Click me to Toggle
</ToolbarToggleButton>
<ToolbarButton appearance="primary" icon={<TextBold16Regular />} />
<ToolbarButton icon={<TextItalic16Regular />} />
<ToolbarButton icon={<TextUnderline16Regular />} />
<ToolbarDivider />
<ToolbarToggleButton name="toggle" value="toggle" icon={<AlertSnooze16Regular />} />
</Toolbar>
);
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import * as React from 'react';
import { Toolbar, ToolbarButton, ToolbarDivider, ToolbarToggleButton } from '@fluentui/react-toolbar';
import { TextBold24Regular, TextItalic24Regular, TextUnderline24Regular } from '@fluentui/react-icons';
import { Toolbar, ToolbarButton } from '@fluentui/react-toolbar';
import type { ToolbarProps } from '@fluentui/react-toolbar';

export const Subtle = (props: Partial<ToolbarProps>) => (
<Toolbar {...props}>
<ToolbarButton appearance="subtle">Click me</ToolbarButton>
<ToolbarButton appearance="subtle">Click me</ToolbarButton>
<ToolbarButton appearance="subtle">Click me</ToolbarButton>
<ToolbarDivider />
<ToolbarToggleButton name="toggle" value="toggle" appearance="subtle">
Click me to Toggle
</ToolbarToggleButton>
<ToolbarButton appearance="subtle" icon={<TextBold24Regular />} />
<ToolbarButton appearance="subtle" icon={<TextItalic24Regular />} />
<ToolbarButton appearance="subtle" icon={<TextUnderline24Regular />} />
</Toolbar>
);
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import { CalendarMonthRegular } from '@fluentui/react-icons';

export const WithPopover = (props: Partial<ToolbarProps>) => (
<Toolbar {...props} size="small">
<Popover>
<Popover withArrow>
<PopoverTrigger>
<ToolbarButton>Click here</ToolbarButton>
<ToolbarButton appearance="primary">See more...</ToolbarButton>
</PopoverTrigger>
<PopoverSurface>
<div>Popover content</div>
</PopoverSurface>
</Popover>
<ToolbarDivider />
<Popover>
<Popover withArrow>
<PopoverTrigger>
<ToolbarButton icon={<CalendarMonthRegular />} />
</PopoverTrigger>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@ import * as React from 'react';
import { Toolbar, ToolbarButton, ToolbarDivider } from '@fluentui/react-toolbar';
import type { ToolbarProps } from '@fluentui/react-toolbar';
import { Tooltip } from '@fluentui/react-components';
import { CalendarMonthRegular } from '@fluentui/react-icons';
import { CalendarMonthRegular, TextBold24Regular } from '@fluentui/react-icons';

export const WithTooltip = (props: Partial<ToolbarProps>) => (
<Toolbar {...props} size="small">
<Tooltip content="No Icon On this one" relationship="label" withArrow>
<ToolbarButton>Hover me</ToolbarButton>
<Tooltip content="Makes text bold" relationship="label" withArrow>
<ToolbarButton appearance="primary" icon={<TextBold24Regular />} />
</Tooltip>
<ToolbarDivider />
<Tooltip content="With calendar icon" relationship="label" withArrow>
<ToolbarButton icon={<CalendarMonthRegular />} />
</Tooltip>
<ToolbarButton>Click me</ToolbarButton>
<ToolbarButton>Hover me</ToolbarButton>
<ToolbarDivider />
</Toolbar>
);

0 comments on commit 0fba0cd

Please sign in to comment.