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

fix(icon): update size values in Icon #640

Merged
merged 7 commits into from
Dec 21, 2018
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [Unreleased]

### BREAKING CHANGES
- Change available `size` prop values in `Icon` component @codepretty ([#640](https://github.com/stardust-ui/react/pull/640))
- renamed Teams theme menu variables the contains props names as prefixes @mnajdova ([#539](https://github.com/stardust-ui/react/pull/539))

### Fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ import { Grid, Icon } from '@stardust-ui/react'

const IconExampleSize = () => (
<Grid rows={2} style={{ textAlign: 'center' }}>
<Icon name="home" size="micro" />
<Icon name="call-video" size="micro" />
<Icon name="home" size="smallest" />
<Icon name="call-video" size="smallest" />

<Icon name="home" size="mini" />
<Icon name="call-video" size="mini" />

<Icon name="home" size="tiny" />
<Icon name="call-video" size="tiny" />
<Icon name="home" size="smaller" />
<Icon name="call-video" size="smaller" />

<Icon name="home" size="small" />
<Icon name="call-video" size="small" />
Expand All @@ -21,14 +18,11 @@ const IconExampleSize = () => (
<Icon name="home" size="large" />
<Icon name="call-video" size="large" />

<Icon name="home" size="big" />
<Icon name="call-video" size="big" />

<Icon name="home" size="huge" />
<Icon name="call-video" size="huge" />
<Icon name="home" size="larger" />
<Icon name="call-video" size="larger" />

<Icon name="home" size="massive" />
<Icon name="call-video" size="massive" />
<Icon name="home" size="largest" />
<Icon name="call-video" size="largest" />
</Grid>
)

Expand Down
6 changes: 2 additions & 4 deletions docs/src/prototypes/chatPane/chatPaneHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class ChatPaneHeader extends React.PureComponent<ChatPaneHeaderProps> {
<Segment
content={
<Icon
size="big"
name="team-create"
variables={siteVars => ({ color: siteVars.white, margin: 'auto 8px' })}
/>
Expand Down Expand Up @@ -70,14 +69,13 @@ class ChatPaneHeader extends React.PureComponent<ChatPaneHeaderProps> {
key: `${index}-${name}`,
icon: {
name,
size: 'big',
variables: siteVars => ({ color: siteVars.white, margin: 'auto 8px' }),
},
primary: true,
}))}
styles={{ marginRight: '20px' }}
/>
{['user plus', 'ellipsis horizontal'].map((name, index) => (
{['team-create', 'more'].map((name, index) => (
<Icon
key={`${index}-${name}`}
name={name}
Expand All @@ -87,7 +85,7 @@ class ChatPaneHeader extends React.PureComponent<ChatPaneHeaderProps> {
margin: 'auto',
...(!index && { margin: 'auto 1.6rem auto auto' }),
}}
variables={siteVars => ({ color: siteVars.gray04 })}
variables={siteVars => ({ color: siteVars.gray04, outline: true })}
/>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MSTeamsLogo extends React.Component<LogoProps, any> {
{Icon.create(icon, {
defaultProps: {
variables: { color: siteVariables.brand },
size: 'large',
size: 'largest',
xSpacing: 'after',
styles: { verticalAlign: 'middle' },
},
Expand Down
18 changes: 9 additions & 9 deletions docs/src/views/ThemingExamples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default () => (
<Button content="Button" />
<Button icon="plus" iconOnly primary />
<Button icon="at" content="Send email" secondary />
<Icon name="chess rook" size="big" />
<Icon name="chess rook" size="larger" />
<Label content="Label with icon" icon="close" />
</>
</Provider>
Expand All @@ -62,7 +62,7 @@ export default () => (
<Button content="Button" />
<Button icon="plus" iconOnly primary />
<Button icon="at" content="Send email" secondary />
<Icon name="chess rook" size="big" />
<Icon name="chess rook" size="larger" />
<Label content="Label with icon" icon="close" />
</>
)}
Expand Down Expand Up @@ -218,7 +218,7 @@ export default () => (
<Button content="Button" />
<Button icon="plus" iconOnly primary />
<Button icon="at" content="Send email" secondary />
<Icon name="chess rook" size="big" />
<Icon name="chess rook" size="larger" />
<Label content="Label with icon" icon="close" />
</div>
</Provider>
Expand Down Expand Up @@ -262,7 +262,7 @@ export default () => (
<Button content="Button" />
<Button icon="plus" iconOnly primary />
<Button icon="at" content="Send email" secondary />
<Icon name="chess rook" size="big" />
<Icon name="chess rook" size="larger" />
<Label content="Label with icon" icon="close" />
</div>
</Provider>
Expand Down Expand Up @@ -294,7 +294,7 @@ export default () => (
<Button content="Button" />
<Button icon="plus" iconOnly primary />
<Button icon="at" content="Send email" secondary />
<Icon name="chess rook" size="big" />
<Icon name="chess rook" size="larger" />
<Label content="Label with icon" icon="close" />

/* Second nested theming */
Expand All @@ -313,7 +313,7 @@ export default () => (
<Button content="Button" />
<Button icon="plus" iconOnly primary />
<Button icon="at" content="Send email" secondary />
<Icon name="chess rook" size="big" />
<Icon name="chess rook" size="larger" />
<Label content="Label with icon" icon="close" />
</div>
</Provider>
Expand All @@ -327,7 +327,7 @@ export default () => (
<Button content="Button" />
<Button icon="plus" iconOnly primary />
<Button icon="at" content="Send email" secondary />
<Icon name="chess rook" size="big" />
<Icon name="chess rook" size="larger" />
<Label content="Label with icon" icon="close" />

<Provider
Expand All @@ -341,7 +341,7 @@ export default () => (
<Button content="Button" />
<Button icon="plus" iconOnly primary />
<Button icon="at" content="Send email" secondary />
<Icon name="chess rook" size="big" />
<Icon name="chess rook" size="larger" />
<Label content="Label with icon" icon="close" />

<Provider
Expand All @@ -359,7 +359,7 @@ export default () => (
<Button content="Button" />
<Button icon="plus" iconOnly primary />
<Button icon="at" content="Send email" secondary />
<Icon name="chess rook" size="big" />
<Icon name="chess rook" size="larger" />
<Label content="Label with icon" icon="close" />
</>
</Provider>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Attachment/Attachment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Attachment extends UIComponent<Extendable<AttachmentProps>, any> {
{icon && (
<div className={classes.icon}>
{Icon.create(icon, {
defaultProps: { size: 'big' },
defaultProps: { size: 'larger' },
})}
</div>
)}
Expand Down
26 changes: 4 additions & 22 deletions src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,8 @@ import { SvgIconSpec } from '../../themes/types'
import { Extendable } from '../../../types/utils'

export type IconXSpacing = 'none' | 'before' | 'after' | 'both'
export type IconSize =
| 'micro'
| 'mini'
| 'tiny'
| 'small'
| 'normal'
| 'large'
| 'big'
| 'huge'
| 'massive'

export type IconSize = 'smallest' | 'smaller' | 'small' | 'medium' | 'large' | 'larger' | 'largest'

export interface IconProps extends UIComponentProps {
/**
Expand Down Expand Up @@ -71,23 +63,13 @@ class Icon extends UIComponent<Extendable<IconProps>, any> {
circular: PropTypes.bool,
disabled: PropTypes.bool,
name: PropTypes.string,
size: PropTypes.oneOf([
'micro',
'mini',
'tiny',
'small',
'normal',
'large',
'big',
'huge',
'massive',
]),
size: PropTypes.oneOf(['smallest', 'smaller', 'small', 'medium', 'large', 'larger', 'largest']),
xSpacing: PropTypes.oneOf(['none', 'before', 'after', 'both']),
}

static defaultProps = {
as: 'span',
size: 'normal',
size: 'medium',
accessibility: iconBehavior,
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/RadioGroup/RadioGroupItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class RadioGroupItem extends AutoControlledComponent<
{Icon.create(icon || '', {
defaultProps: {
circular: true,
size: 'mini',
size: 'smaller',
variables: variables.icon,
styles: styles.icon,
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/Status/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Status extends UIComponent<Extendable<StatusProps>, any> {
<ElementType {...rest} className={classes.root}>
{Icon.create(icon, {
defaultProps: {
size: 'micro',
size: 'smallest',
styles: styles.icon,
variables: variables.icon,
xSpacing: 'none',
Expand Down
14 changes: 6 additions & 8 deletions src/themes/teams/components/Icon/iconStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ import { pxToRem } from '../../utils'
import { getStyle as getSvgStyle } from './svg'

const sizes = new Map([
['micro', 7],
['mini', 10],
['tiny', 12],
['small', 14],
['normal', 16],
['smallest', 7],
['smaller', 10],
['small', 12],
['medium', 16],
['large', 20],
['big', 32],
['huge', 40],
['massive', 64],
['larger', 32],
['largest', 40],
])

const getDefaultFontIcon = (iconName: string) => {
Expand Down