Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

RFC: drop support for primitive shorthand values #2206

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ In addition to behaviors, ARIA [landmarks][5] and [naming props][6] need to be a
For example, to make an icon-only Button accessible, `aria-label` prop needs to be used:

```html
<button icon="star" iconOnly aria-label="Favorites" primary />
<button icon={{ name: "star" }} iconOnly aria-label="Favorites" primary />
```

### Focus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class ComponentExample extends React.Component<ComponentExampleProps, ComponentE
disabled: !canCodeBeFormatted,
},
{
icon: 'refresh',
icon: { name: 'refresh' },
content: 'Reset',
key: 'reset',
onClick: this.resetSourceCode,
Expand All @@ -359,7 +359,7 @@ class ComponentExample extends React.Component<ComponentExampleProps, ComponentE
},
{
disabled: currentCodeLanguage !== 'ts',
icon: 'github',
icon: { name: 'github' },
content: 'Edit',
href: ghEditHref,
rel: 'noopener noreferrer',
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/DocsLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { mergeThemes } from '@fluentui/react/src/utils'

const anchors = new AnchorJS({
class: 'anchor-link',
icon: '#',
icon: { name: '#' },
})

class DocsLayout extends React.Component<any, any> {
Expand Down
4 changes: 2 additions & 2 deletions docs/src/components/GuidesNavigationFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const GuidesNavigationFooter: React.FC<GuidesNavigationFooterProps> = ({ previou
<Button
as={Link}
content={previous.name}
icon="arrow left"
icon={{ name: 'arrow left' }}
iconPosition="before"
primary
to={previous.url}
Expand All @@ -32,7 +32,7 @@ const GuidesNavigationFooter: React.FC<GuidesNavigationFooterProps> = ({ previou
<Button
as={Link}
content={next.name}
icon="arrow right"
icon={{ name: 'arrow right' }}
iconPosition="after"
primary
to={next.url}
Expand Down
10 changes: 5 additions & 5 deletions docs/src/components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class Sidebar extends React.Component<any, any> {
return [
{
key: 'concepts',
title: 'Concepts',
title: { content: 'Concepts' },
items: [
{
key: 'intro',
Expand Down Expand Up @@ -169,7 +169,7 @@ class Sidebar extends React.Component<any, any> {
},
{
key: 'guides',
title: 'Guides',
title: { content: 'Guides' },
items: [
{
key: 'quickstart',
Expand Down Expand Up @@ -249,7 +249,7 @@ class Sidebar extends React.Component<any, any> {
prototypes = this.removePublicTags(prototypes)
const prototypeTreeSection = {
key: 'prototypes',
title: 'Prototypes',
title: { content: 'Prototypes' },
items: prototypes,
}
return currentSections.concat(prototypeTreeSection)
Expand Down Expand Up @@ -388,7 +388,7 @@ class Sidebar extends React.Component<any, any> {

const componentTreeSection = {
key: 'components',
title: 'Components',
title: { content: 'Components' },
items: treeItemsByType[0].items,
}

Expand Down Expand Up @@ -540,7 +540,7 @@ class Sidebar extends React.Component<any, any> {
inverted
fluid
clearable
icon="search"
icon={{ name: 'search' }}
placeholder="Search"
iconPosition="end"
role="search"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const AccordionPanelCustomTitleExample = () => {
title: (
<Layout
key="title"
start={<Label icon="error" iconPosition="start" circular content="Warnings" />}
start={
<Label icon={{ name: 'error' }} iconPosition="start" circular content="Warnings" />
}
/>
),
content: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const AlertExampleDismissActionRtl = () => (
content: 'عالم',
},
]}
icon="exclamation-triangle"
icon={{ name: 'exclamation-triangle' }}
content="مرحبا العالم"
/>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react'
import { Alert } from '@fluentui/react'

const AlertExampleIcon = () => (
<Alert icon="exclamation-triangle" content="This is an alert with a warning icon" />
<Alert icon={{ name: 'exclamation-triangle' }} content="This is an alert with a warning icon" />
)

export default AlertExampleIcon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react'
import { Alert } from '@fluentui/react'

const AlertExampleIcon = () => (
<Alert icon="exclamation-triangle" content="This is an alert with a warning icon" />
<Alert icon={{ name: 'exclamation-triangle' }} content="This is an alert with a warning icon" />
)

export default AlertExampleIcon
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Alert } from '@fluentui/react'
const AlertExampleImportantMessage = () => (
<Alert
warning
icon="exclamation-triangle"
icon={{ name: 'exclamation-triangle' }}
header="Your password may have been compromised"
content="Please change your password"
dismissible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Alert } from '@fluentui/react'
const AlertExampleImportantMessage = () => (
<Alert
warning
icon="exclamation-triangle"
icon={{ name: 'exclamation-triangle' }}
header="Your password may have been compromised"
content="Please change your password"
dismissible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const AlertExampleWidth = () => {
actions={[{ content: 'Join and add the room', primary: true }]}
header="There is a conference room close to you."
dismissible
icon="screencast"
icon={{ name: 'screencast' }}
/>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import * as React from 'react'
const AttachmentSlotsPerf = () => (
<Attachment
actionable
icon="table"
icon={{ name: 'table' }}
header="Document.docx"
description="800 Kb"
action={{ icon: 'more', title: 'More Action' }}
action={{ icon: { name: 'more' }, title: 'More Action' }}
progress={33}
/>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react'
import { Attachment } from '@fluentui/react'

const AttachmentExampleRtl = () => (
<Attachment header="مرحبا العالم" icon="file word outline" progress={70} />
<Attachment header="مرحبا العالم" icon={{ name: 'file word outline' }} progress={70} />
)

export default AttachmentExampleRtl
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ class AttachmentActionExampleShorthand extends React.Component {
<div>
<Attachment
header="Picture.jpg"
action={{ icon: 'close', onClick: this.handleClick('Remove'), title: 'Close' }}
action={{ icon: { name: 'close' }, onClick: this.handleClick('Remove'), title: 'Close' }}
/>
<Attachment
header="Document.docx"
action={{ icon: 'more', onClick: this.handleClick('Show more'), title: 'Show more' }}
action={{
icon: { name: 'more' },
onClick: this.handleClick('Show more'),
title: 'Show more',
}}
/>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Attachment } from '@fluentui/react'

const AttachmentIconExampleShorthand = () => (
<div>
<Attachment icon="word-color" header="MeetingNotes.docx" />
<Attachment icon="excel-color" header="Budget.xlsx" />
<Attachment icon="powerpoint-color" header="Presentation.pptx" />
<Attachment icon={{ name: 'word-color' }} header="MeetingNotes.docx" />
<Attachment icon={{ name: 'excel-color' }} header="Budget.xlsx" />
<Attachment icon={{ name: 'powerpoint-color' }} header="Presentation.pptx" />
</div>
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Attachment } from '@fluentui/react'
const AttachmentProgressExampleShorthand = () => (
<Attachment
header="Photo.jpg"
action={{ icon: 'close', onClick: () => alert("'X' is clicked!"), title: 'Close' }}
action={{ icon: { name: 'close' }, onClick: () => alert("'X' is clicked!"), title: 'Close' }}
progress={33}
/>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ class AttachmentActionableExampleShorthand extends React.Component {
return (
<Attachment
actionable
icon="table"
icon={{ name: 'table' }}
header="Document.docx"
description="800 Kb"
action={{ icon: 'more', onClick: this.handleClick('More Action'), title: 'More Action' }}
action={{
icon: { name: 'more' },
onClick: this.handleClick('More Action'),
title: 'More Action',
}}
progress={33}
onClick={this.handleClick('Attachment')}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const AvatarExampleRtl = () => (
name="جون دو"
status={{
color: 'green',
icon: 'icon-checkmark',
icon: { name: 'icon-checkmark' },
}}
/>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react'
import { Avatar } from '@fluentui/react'

const status = { color: 'green', icon: 'icon-checkmark', title: 'Available' }
const status = { color: 'green', icon: { name: 'icon-checkmark' }, title: 'Available' }

const AvatarUsageExampleShorthand = () => (
<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react'
import { Avatar } from '@fluentui/react'

const status = { color: 'green', icon: 'icon-checkmark', title: 'Available' }
const status = { color: 'green', icon: { name: 'icon-checkmark' }, title: 'Available' }

const AvatarExampleExcludedInitialsShorthand = () => (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const AvatarExampleGetInitialsShorthand = () => (
<Avatar
name="John Doe"
getInitials={getInitials}
status={{ color: 'green', icon: 'icon-checkmark', title: 'Available' }}
status={{ color: 'green', icon: { name: 'icon-checkmark' }, title: 'Available' }}
/>
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ const AvatarExampleImageCustomizationShorthand = () => (
<>
<Avatar
image={{ src: 'public/images/avatar/small/matt.jpg', alt: 'Profile picture of John Doe' }}
status={{ color: 'green', icon: 'icon-checkmark', title: 'Available' }}
status={{ color: 'green', icon: { name: 'icon-checkmark' }, title: 'Available' }}
/>
&emsp;
<Avatar
image="public/images/avatar/large/jerry.png"
status={{ color: 'green', icon: 'icon-checkmark', title: 'Available' }}
status={{ color: 'green', icon: { name: 'icon-checkmark' }, title: 'Available' }}
/>
&emsp;
<Avatar
Expand All @@ -29,7 +29,7 @@ const AvatarExampleImageCustomizationShorthand = () => (
/>
),
}}
status={{ color: 'green', icon: 'icon-checkmark', title: 'Available' }}
status={{ color: 'green', icon: { name: 'icon-checkmark' }, title: 'Available' }}
/>
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const AvatarExampleNameShorthand = () => (
name="John Doe"
status={{
color: 'green',
icon: 'icon-checkmark',
icon: { name: 'icon-checkmark' },
title: 'Available',
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react'
import { Avatar, Grid, SizeValue } from '@fluentui/react'

const statusProps = {
icon: 'icon-checkmark',
icon: { name: 'icon-checkmark' },
color: 'green',
title: 'Available',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const AvatarExampleStatusShorthand = () => (
<div>
<Avatar
image="public/images/avatar/small/matt.jpg"
status={{ color: 'green', icon: 'icon-checkmark', title: 'Available' }}
status={{ color: 'green', icon: { name: 'icon-checkmark' }, title: 'Available' }}
/>
&emsp;
<Avatar image="public/images/avatar/small/matt.jpg" status={{ color: 'red', title: 'Busy' }} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const defaultAvatar = (
image={{ src: 'public/images/avatar/small/matt.jpg', alt: 'Profile picture of Matt' }}
status={{
color: 'green',
icon: 'icon-checkmark',
icon: { name: 'icon-checkmark' },
title: 'Available',
}}
/>
Expand All @@ -23,7 +23,7 @@ const AvatarExampleStatusCustomizationShorthand = () => (
image={{ src: 'public/images/avatar/small/matt.jpg', alt: 'Profile picture of Matt' }}
status={{
color: 'green',
icon: 'icon-checkmark',
icon: { name: 'icon-checkmark' },
title: 'Available',
}}
variables={{ statusBorderColor: 'orange' }}
Expand All @@ -35,7 +35,7 @@ const AvatarExampleStatusCustomizationShorthand = () => (
size="larger"
status={{
color: 'green',
icon: 'icon-checkmark',
icon: { name: 'icon-checkmark' },
title: 'Available',
}}
/>
Expand All @@ -45,7 +45,7 @@ const AvatarExampleStatusCustomizationShorthand = () => (
image={{ src: 'public/images/avatar/small/matt.jpg', alt: 'Profile picture of Matt' }}
status={{
color: 'green',
icon: 'icon-checkmark',
icon: { name: 'icon-checkmark' },
title: 'Available',
size: 'larger',
}}
Expand All @@ -57,7 +57,7 @@ const AvatarExampleStatusCustomizationShorthand = () => (
size="larger"
status={{
color: 'green',
icon: 'icon-checkmark',
icon: { name: 'icon-checkmark' },
title: 'Available',
size: 'medium',
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const ButtonGroupCircularExampleShorthand = () => (
<Button.Group
circular
buttons={[
{ key: 'emoji', icon: 'emoji', primary: true, title: 'Emoji' },
{ key: 'translation', icon: 'translation', title: 'Translation' },
{ key: 'play', icon: 'play', primary: true, title: 'Play' },
{ key: 'emoji', icon: { name: 'emoji' }, primary: true, title: 'Emoji' },
{ key: 'translation', icon: { name: 'translation' }, title: 'Translation' },
{ key: 'play', icon: { name: 'play' }, primary: true, title: 'Play' },
]}
/>
)
Expand Down
Loading