diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d7a41ac73..415aeb63f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### BREAKING CHANGES - Changed types of the slot's inside the `ListItem` component (`media`, `content`, `contentMedia`, `header`, `headerMedia` and `endMedia`) from `any` to `ShorthandValue` @mnajdova ([#886](https://github.com/stardust-ui/react/pull/886)) - Changed class names of the slots inside the `ListItem` (`ItemLayout`'s classnames were replaced with `ListItem`'s) @mnajdova ([#886](https://github.com/stardust-ui/react/pull/886)) +- Replace the `outline` variable with the `outline` prop in `Icon` @layershifter ([#1002](https://github.com/stardust-ui/react/pull/1002)) ### Fixes - Remove space between `Button.Group` items without `circular` prop @Bugaa92 ([#973](https://github.com/stardust-ui/react/pull/973)) diff --git a/docs/src/examples/components/Icon/Usage/IconSetExample.shorthand.tsx b/docs/src/examples/components/Icon/Usage/IconSetExample.shorthand.tsx index d81e64fde0..162b82d2dc 100644 --- a/docs/src/examples/components/Icon/Usage/IconSetExample.shorthand.tsx +++ b/docs/src/examples/components/Icon/Usage/IconSetExample.shorthand.tsx @@ -31,7 +31,7 @@ const IconSetExampleShorthand = () => ( {Object.keys(theme.icons).map(name => (
- +
{name} outline
diff --git a/docs/src/examples/components/Icon/Variations/IconExampleColor.shorthand.tsx b/docs/src/examples/components/Icon/Variations/IconExampleColor.shorthand.tsx index 65448be2f2..03ca50df42 100644 --- a/docs/src/examples/components/Icon/Variations/IconExampleColor.shorthand.tsx +++ b/docs/src/examples/components/Icon/Variations/IconExampleColor.shorthand.tsx @@ -12,9 +12,9 @@ const IconExampleColor = () => ( - - - + + + USING THE color VARIABLE: diff --git a/docs/src/examples/components/Menu/Usages/MenuExampleToolbar.shorthand.tsx b/docs/src/examples/components/Menu/Usages/MenuExampleToolbar.shorthand.tsx index b6bae13171..6b6d0794a7 100644 --- a/docs/src/examples/components/Menu/Usages/MenuExampleToolbar.shorthand.tsx +++ b/docs/src/examples/components/Menu/Usages/MenuExampleToolbar.shorthand.tsx @@ -6,7 +6,7 @@ const items = [ key: 'format', icon: { name: 'format', - variables: { outline: true }, + outline: true, }, accessibility: toolbarButtonBehavior, 'aria-label': 'Format Tool', @@ -15,7 +15,7 @@ const items = [ key: 'paperclip', icon: { name: 'paperclip', - variables: { outline: true }, + outline: true, }, accessibility: toolbarButtonBehavior, 'aria-label': 'Paperclip Tool', @@ -24,7 +24,7 @@ const items = [ key: 'emoji', icon: { name: 'emoji', - variables: { outline: true }, + outline: true, }, accessibility: toolbarButtonBehavior, 'aria-label': 'Emoji Tool', @@ -33,7 +33,7 @@ const items = [ key: 'giphy', icon: { name: 'giphy', - variables: { outline: true }, + outline: true, }, accessibility: toolbarButtonBehavior, 'aria-label': 'Giphy tool', @@ -42,7 +42,7 @@ const items = [ key: 'sticker', icon: { name: 'sticker', - variables: { outline: true }, + outline: true, }, accessibility: toolbarButtonBehavior, 'aria-label': 'Sticker Tool', @@ -51,7 +51,7 @@ const items = [ key: 'meetup', icon: { name: 'video-camera-emphasis', - variables: { outline: true }, + outline: true, }, accessibility: toolbarButtonBehavior, 'aria-label': 'Meetup Tool', @@ -60,7 +60,7 @@ const items = [ key: 'book', icon: { name: 'book', - variables: { outline: true }, + outline: true, }, accessibility: toolbarButtonBehavior, 'aria-label': 'Book Tool', @@ -69,7 +69,7 @@ const items = [ key: 'menuButton', icon: { name: 'more', - variables: { outline: true }, + outline: true, }, accessibility: toolbarButtonBehavior, 'aria-label': 'More options', diff --git a/docs/src/prototypes/IconViewer/index.tsx b/docs/src/prototypes/IconViewer/index.tsx index e4c299653a..767fb2415f 100644 --- a/docs/src/prototypes/IconViewer/index.tsx +++ b/docs/src/prototypes/IconViewer/index.tsx @@ -1,5 +1,6 @@ import * as React from 'react' import { Provider, Grid, Divider, Header, Icon, Menu, Segment } from '@stardust-ui/react' +import CopyToClipboard from 'docs/src/components/CopyToClipboard' import themeWithProcessedIcons from 'src/themes/teams/withProcessedIcons' import { TeamsProcessedSvgIconSpec } from 'src/themes/teams/components/Icon/svg/types' @@ -13,9 +14,20 @@ const renderStardustIconName = (icon, isOutline = false) => { const maybeExportedAs = (icon as any).exportedAs return ( maybeExportedAs && ( - - => {maybeExportedAs} {isOutline && 'outline'} - + <> + + => {maybeExportedAs} {isOutline && 'outline'} + +
+ ( + + )} + value={``} + /> + ) ) } @@ -53,8 +65,8 @@ class IconViewerExample extends React.Component { {Object.keys(this.iconFilters).map(filterName => ( this.setState({ filter: filterName })} /> @@ -94,7 +106,7 @@ class IconViewerExample extends React.Component { .sort() .map(name => (
- +
{name.replace(processedIconsNamePrefix, '')} outline
diff --git a/docs/src/prototypes/chatPane/chatPaneHeader.tsx b/docs/src/prototypes/chatPane/chatPaneHeader.tsx index caf8817d5c..f1b7da262a 100644 --- a/docs/src/prototypes/chatPane/chatPaneHeader.tsx +++ b/docs/src/prototypes/chatPane/chatPaneHeader.tsx @@ -93,13 +93,14 @@ class ChatPaneHeader extends React.PureComponent { ({ color: siteVars.gray04, outline: true })} + variables={siteVars => ({ color: siteVars.gray04 })} /> ))}
diff --git a/packages/react/src/components/Icon/Icon.tsx b/packages/react/src/components/Icon/Icon.tsx index 98ed9fc35d..a7cb347cbb 100644 --- a/packages/react/src/components/Icon/Icon.tsx +++ b/packages/react/src/components/Icon/Icon.tsx @@ -37,6 +37,9 @@ export interface IconProps extends UIComponentProps, ColorComponentProps { /** Name of the icon. */ name?: string + /** An icon can provide an outline variant. */ + outline?: boolean + /** An icon can be rotated by the degree specified as number. */ rotate?: number @@ -67,6 +70,7 @@ class Icon extends UIComponent, any> { circular: PropTypes.bool, disabled: PropTypes.bool, name: PropTypes.string, + outline: PropTypes.bool, rotate: PropTypes.number, size: customPropTypes.size, xSpacing: PropTypes.oneOf(['none', 'before', 'after', 'both']), diff --git a/packages/react/src/themes/teams/components/Icon/iconStyles.ts b/packages/react/src/themes/teams/components/Icon/iconStyles.ts index 29eceda75b..db5ca276a3 100644 --- a/packages/react/src/themes/teams/components/Icon/iconStyles.ts +++ b/packages/react/src/themes/teams/components/Icon/iconStyles.ts @@ -139,19 +139,19 @@ const iconStyles: ComponentSlotStylesInput = { }), }), - outlinePart: ({ variables: v }): ICSSInJSStyle => { + outlinePart: ({ props: p }): ICSSInJSStyle => { return { display: 'none', - ...(v.outline && { + ...(p.outline && { display: 'block', }), } }, - filledPart: ({ variables: v }): ICSSInJSStyle => { + filledPart: ({ props: p }): ICSSInJSStyle => { return { - ...(v.outline && { + ...(p.outline && { display: 'none', }), } diff --git a/packages/react/src/themes/teams/components/Icon/iconVariables.ts b/packages/react/src/themes/teams/components/Icon/iconVariables.ts index 4afe13cd15..f86bba94ce 100644 --- a/packages/react/src/themes/teams/components/Icon/iconVariables.ts +++ b/packages/react/src/themes/teams/components/Icon/iconVariables.ts @@ -16,7 +16,6 @@ export interface IconVariables { disabledColor: string horizontalSpace: string - outline?: boolean sizeModifier?: IconSizeModifier } @@ -33,5 +32,4 @@ export default (siteVars): IconVariables => ({ disabledColor: siteVars.gray06, horizontalSpace: pxToRem(10), - outline: undefined, })