Skip to content

Commit

Permalink
[EuiIcon] Fix two-tone icons to inherit parent color when nested in s…
Browse files Browse the repository at this point in the history
…pecific components (#4760)

* Making app icons to inherit parent color when nested in specific components

* Improving example

* CL

* Improving comment msg

* Adding color inherit

* Checking if icon has color applied

* Color inherit example

* Addressing PR review

* WIP

* CL and list group icon props

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
  • Loading branch information
miukimiu and cchaos committed Apr 30, 2021
1 parent 658e5d2 commit aa71e7a
Show file tree
Hide file tree
Showing 55 changed files with 545 additions and 111 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added `autoFocus` prop and functionality to `EuiComboBox` ([#4772](https://github.com/elastic/eui/pull/4772))
- Added `inherit` color option to `EuiIcon` to force two-tone (app) icons to inherit their parent's color ([#4760](https://github.com/elastic/eui/pull/4760))
- Updated `EuiBetaBadge, EuiBadge, EuiButtonIcon, EuiButtonContent, EuiCallOut, EuiContextMenuItem, EuiListGroupItem` icon usage to inherit their parent's color ([#4760](https://github.com/elastic/eui/pull/4760))
- Added `iconProps` prop to `EuiListGroupItem` ([#4760](https://github.com/elastic/eui/pull/4760))

**Bug fixes**

Expand All @@ -14,7 +17,7 @@
**Bug fixes**

- Fixed missing i18n tokens for `EuiFilePicker` ([#4750](https://github.com/elastic/eui/pull/4750))
- Fixed `EuiComoboBox` to use correct placeholder text color ([#4744](https://github.com/elastic/eui/pull/4744))
- Fixed `EuiComboBox` to use correct placeholder text color ([#4744](https://github.com/elastic/eui/pull/4744))

## [`32.2.0`](https://github.com/elastic/eui/tree/v32.2.0)

Expand Down
4 changes: 4 additions & 0 deletions src-docs/src/views/badge/badge_with_icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export default () => (

<EuiBadge iconType="check">Default</EuiBadge>

<EuiBadge iconType="lensApp" color="primary">
Primary with an app icon
</EuiBadge>

<EuiBadge iconType="returnKey" />
</div>
);
2 changes: 2 additions & 0 deletions src-docs/src/views/badge/beta_badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default () => (
/>
&emsp;
<EuiBetaBadge label="Lab" iconType="beaker" />
&emsp;
<EuiBetaBadge label="Lens" iconType="lensApp" />
<EuiSpacer />
<EuiTitle size="s">
<h3>
Expand Down
26 changes: 23 additions & 3 deletions src-docs/src/views/button/button_empty.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,36 @@ export default () => (
<EuiFlexGroup gutterSize="s" alignItems="center">
<EuiFlexItem grow={false}>
<EuiButtonEmpty onClick={() => {}} iconType="arrowDown">
Icon left
Primary with icon left
</EuiButtonEmpty>
</EuiFlexItem>

<EuiFlexItem grow={false}>
<EuiButtonEmpty
onClick={() => {}}
iconType="arrowDown"
iconSide="right">
Icon right
iconSide="right"
size="xs">
Extra small with icon right
</EuiButtonEmpty>
</EuiFlexItem>
</EuiFlexGroup>

<EuiFlexGroup gutterSize="s" alignItems="center">
<EuiFlexItem grow={false}>
<EuiButtonEmpty color="text" onClick={() => {}} iconType="dashboardApp">
Text with app icon left
</EuiButtonEmpty>
</EuiFlexItem>

<EuiFlexItem grow={false}>
<EuiButtonEmpty
color="text"
onClick={() => {}}
iconType="dashboardApp"
iconSide="right"
size="xs">
Extra small with app icon right
</EuiButtonEmpty>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
28 changes: 28 additions & 0 deletions src-docs/src/views/button/button_icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,33 @@ export default () => (
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="m" />
<EuiTitle size="xxs">
<h3>Icons inherit by default the button color</h3>
</EuiTitle>
<EuiSpacer size="s" />
<EuiFlexGroup responsive={false} gutterSize="s" alignItems="center">
<EuiFlexItem grow={false}>
<EuiButtonIcon iconType="heart" aria-label="Heart" color="accent" />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
iconType="dashboardApp"
aria-label="Dashboard"
color="success"
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
display="base"
iconType="trash"
aria-label="Delete"
color="danger"
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon display="base" iconType="lensApp" aria-label="Lens" />
</EuiFlexItem>
</EuiFlexGroup>
</>
);
28 changes: 12 additions & 16 deletions src-docs/src/views/button/button_with_icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,47 @@ export default () => (
<div>
<EuiFlexGroup gutterSize="s" alignItems="center">
<EuiFlexItem grow={false}>
<EuiButton onClick={() => {}} iconType="arrowUp">
<EuiButton onClick={() => {}} iconType="heart">
Primary
</EuiButton>
</EuiFlexItem>

<EuiFlexItem grow={false}>
<EuiButton fill iconType="arrowDown" onClick={() => {}}>
<EuiButton fill iconType="lensApp" onClick={() => {}}>
Filled
</EuiButton>
</EuiFlexItem>

<EuiFlexItem grow={false}>
<EuiButton iconType="arrowLeft" size="s" onClick={() => {}}>
<EuiButton iconType="heart" size="s" onClick={() => {}}>
small
</EuiButton>
</EuiFlexItem>

<EuiFlexItem grow={false}>
<EuiButton iconType="arrowRight" size="s" fill onClick={() => {}}>
<EuiButton iconType="lensApp" size="s" fill onClick={() => {}}>
small and filled
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>

<EuiFlexGroup gutterSize="s" alignItems="center">
<EuiFlexItem grow={false}>
<EuiButton iconSide="right" onClick={() => {}} iconType="arrowUp">
<EuiButton iconSide="right" onClick={() => {}} iconType="heart">
Primary
</EuiButton>
</EuiFlexItem>

<EuiFlexItem grow={false}>
<EuiButton
iconSide="right"
fill
iconType="arrowDown"
onClick={() => {}}>
<EuiButton iconSide="right" fill iconType="lensApp" onClick={() => {}}>
Filled
</EuiButton>
</EuiFlexItem>

<EuiFlexItem grow={false}>
<EuiButton
iconSide="right"
iconType="arrowLeft"
iconType="heart"
size="s"
onClick={() => {}}>
small
Expand All @@ -64,7 +60,7 @@ export default () => (
<EuiFlexItem grow={false}>
<EuiButton
iconSide="right"
iconType="arrowRight"
iconType="lensApp"
size="s"
fill
onClick={() => {}}>
Expand All @@ -78,7 +74,7 @@ export default () => (
<EuiButton
iconSide="right"
onClick={() => {}}
iconType="arrowUp"
iconType="heart"
isDisabled>
Disabled
</EuiButton>
Expand All @@ -88,7 +84,7 @@ export default () => (
<EuiButton
iconSide="right"
fill
iconType="arrowDown"
iconType="lensApp"
onClick={() => {}}
isDisabled>
Filled
Expand All @@ -98,7 +94,7 @@ export default () => (
<EuiFlexItem grow={false}>
<EuiButton
iconSide="right"
iconType="arrowLeft"
iconType="heart"
size="s"
onClick={() => {}}
isDisabled>
Expand All @@ -109,7 +105,7 @@ export default () => (
<EuiFlexItem grow={false}>
<EuiButton
iconSide="right"
iconType="arrowRight"
iconType="lensApp"
size="s"
fill
onClick={() => {}}
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/call_out/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default () => (

<EuiCallOut
title="Callouts can exist as just a title. Simply omit the child content."
iconType="gear"
iconType="lensApp"
/>

<EuiSpacer size="m" />
Expand Down
16 changes: 12 additions & 4 deletions src-docs/src/views/context_menu/context_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default () => {
items: [
{
name: 'Handle an onClick',
icon: <EuiIcon type="search" size="m" />,
icon: 'search',
onClick: () => {
closePopover();
},
Expand All @@ -41,19 +41,27 @@ export default () => {
},
{
name: 'Nest panels',
icon: 'user',
icon: 'wrench',
panel: 1,
},
{
name: 'You can add a tooltip',
icon: 'user',
name: 'Add a tooltip',
icon: 'document',
toolTipTitle: 'Optional tooltip',
toolTipContent: 'Optional content for a tooltip',
toolTipPosition: 'right',
onClick: () => {
closePopover();
},
},
{
name: 'Use an app icon',
icon: 'visualizeApp',
},
{
name: 'Pass an icon as a component to customize it',
icon: <EuiIcon type="trash" size="m" color="danger" />,
},
{
name: 'Disabled option',
icon: 'user',
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/icon/icon_colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {

const iconColors = [
'default',
'inherit',
'primary',
'success',
'accent',
Expand All @@ -22,7 +23,6 @@ const iconColors = [
'text',
'subdued',
'ghost',
'#490',
'#DA8B45',
'#DDDDDD',
];
Expand Down
Loading

0 comments on commit aa71e7a

Please sign in to comment.