Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiIcon] Fix two-tone icons to inherit parent color when nested in specific components #4760

Merged
merged 13 commits into from
Apr 30, 2021
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `32.3.0`.
**Bug fixes**

- Fixed a bug in `EuiIcon` where two-tone icons were not inheriting their parent color when nested in specific components ([#4760](https://github.com/elastic/eui/pull/4760))
miukimiu marked this conversation as resolved.
Show resolved Hide resolved

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

Expand All @@ -9,7 +11,7 @@ No public interface changes since `32.3.0`.
**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
40 changes: 38 additions & 2 deletions src-docs/src/views/icon/icon_colors_apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,33 @@ export default () => (
className="eui-textCenter"
grow={false}
style={{ minWidth: 96 }}>
<EuiIcon type="gisApp" color="text" size="xl" />
<EuiIcon type="gisApp" color="inherit" size="xl" />
</EuiSplitPanel.Inner>
<EuiSplitPanel.Inner paddingSize="s" color="subdued">
<EuiCodeBlock
language="html"
isCopyable
transparentBackground
paddingSize="m">
{'<EuiIcon type="gisApp" color="text" size="xl" />'}
{'<EuiIcon type="gisApp" color="inherit" size="xl" />'}
</EuiCodeBlock>
</EuiSplitPanel.Inner>
</EuiSplitPanel.Outer>
<EuiSpacer />
<EuiSplitPanel.Outer hasShadow={false} hasBorder={true} direction="row">
miukimiu marked this conversation as resolved.
Show resolved Hide resolved
<EuiSplitPanel.Inner
className="eui-textCenter"
grow={false}
style={{ minWidth: 96 }}>
<EuiIcon type="gisApp" color="default" size="xl" />
</EuiSplitPanel.Inner>
<EuiSplitPanel.Inner paddingSize="s" color="subdued">
<EuiCodeBlock
language="html"
isCopyable
transparentBackground
paddingSize="m">
{'<EuiIcon type="gisApp" color="default" size="xl" />'}
</EuiCodeBlock>
</EuiSplitPanel.Inner>
</EuiSplitPanel.Outer>
Expand All @@ -63,6 +81,24 @@ export default () => (
</EuiSplitPanel.Inner>
</EuiSplitPanel.Outer>
<EuiSpacer />
<EuiSplitPanel.Outer hasShadow={false} hasBorder={true} direction="row">
<EuiSplitPanel.Inner
className="eui-textCenter"
grow={false}
style={{ minWidth: 96 }}>
<EuiIcon type="gisApp" color="text" size="xl" />
</EuiSplitPanel.Inner>
<EuiSplitPanel.Inner paddingSize="s" color="subdued">
<EuiCodeBlock
language="html"
isCopyable
transparentBackground
paddingSize="m">
{'<EuiIcon type="gisApp" color="text" size="xl" />'}
</EuiCodeBlock>
</EuiSplitPanel.Inner>
</EuiSplitPanel.Outer>
<EuiSpacer />
<EuiSplitPanel.Outer hasShadow={false} hasBorder={true} direction="row">
<EuiSplitPanel.Inner
className="eui-textCenter"
Expand Down
8 changes: 5 additions & 3 deletions src-docs/src/views/icon/icon_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ export const IconExample = {
<p>
Two-tone icons, like our app style icons, will behave similarly to
normal glyphs when provided a specific color by applying the color
to <strong>all</strong> the shapes within.
to <strong>all</strong> the shapes within. Most of the time, you
just need to pass <EuiCode>color="default"</EuiCode> to force the
icon to inherit its color from its parent.
miukimiu marked this conversation as resolved.
Show resolved Hide resolved
</p>
</EuiText>
<EuiSpacer />
Expand All @@ -218,8 +220,8 @@ export const IconExample = {
<p>
The <EuiCode>type</EuiCode> prop can accept a valid enum, string or
React SVG Element. When using a custom SVG, please make sure it sits
on a square canvas and preferably utilizes one of EUI&apos;s sizes
(<EuiCode>16x16</EuiCode> or <EuiCode>32x32</EuiCode>).
on a square canvas and preferably utilizes one of EUI&apos;s sizes (
<EuiCode>16x16</EuiCode> or <EuiCode>32x32</EuiCode>).
</p>
<p>
When using custom SVGs for simple glyphs,{' '}
Expand Down
3 changes: 3 additions & 0 deletions src/components/badge/__snapshots__/badge.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ exports[`EuiBadge props iconSide left is rendered 1`] = `
</span>
<span
class="euiBadge__icon"
color="inherit"
data-euiicon-type="user"
/>
</span>
Expand All @@ -330,6 +331,7 @@ exports[`EuiBadge props iconSide right is rendered 1`] = `
</span>
<span
class="euiBadge__icon"
color="inherit"
data-euiicon-type="user"
/>
</span>
Expand All @@ -351,6 +353,7 @@ exports[`EuiBadge props iconType is rendered 1`] = `
</span>
<span
class="euiBadge__icon"
color="inherit"
data-euiicon-type="user"
/>
</span>
Expand Down
2 changes: 2 additions & 0 deletions src/components/badge/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ export const EuiBadge: FunctionComponent<EuiBadgeProps> = ({
<EuiIcon
type={iconType}
size="s"
color="inherit" // forces the icon to inherit its parent color
{...closeButtonProps}
className={closeClassNames}
/>
Expand All @@ -270,6 +271,7 @@ export const EuiBadge: FunctionComponent<EuiBadgeProps> = ({
type={iconType}
size={children ? 's' : 'm'}
className="euiBadge__icon"
color="inherit" // forces the icon to inherit its parent color
/>
);
}
Expand Down
1 change: 1 addition & 0 deletions src/components/badge/beta_badge/beta_badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export const EuiBetaBadge: FunctionComponent<EuiBetaBadgeProps> = ({
type={iconType}
size="m"
aria-hidden="true"
color="inherit" // forces the icon to inherit its parent color
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ exports[`CollapsedItemActions render 1`] = `
<span
aria-hidden="true"
class="euiButtonIcon__icon"
color="inherit"
data-euiicon-type="boxesHorizontal"
/>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,13 @@ exports[`EuiInMemoryTable behavior pagination 1`] = `
>
<EuiIcon
className="euiButtonContent__icon"
color="inherit"
size="s"
type="arrowDown"
>
<span
className="euiButtonContent__icon"
color="inherit"
data-euiicon-type="arrowDown"
size="s"
/>
Expand Down Expand Up @@ -474,12 +476,14 @@ exports[`EuiInMemoryTable behavior pagination 1`] = `
<EuiIcon
aria-hidden="true"
className="euiButtonIcon__icon"
color="inherit"
size="m"
type="arrowLeft"
>
<span
aria-hidden="true"
className="euiButtonIcon__icon"
color="inherit"
data-euiicon-type="arrowLeft"
size="m"
/>
Expand Down Expand Up @@ -688,12 +692,14 @@ exports[`EuiInMemoryTable behavior pagination 1`] = `
<EuiIcon
aria-hidden="true"
className="euiButtonIcon__icon"
color="inherit"
size="m"
type="arrowRight"
>
<span
aria-hidden="true"
className="euiButtonIcon__icon"
color="inherit"
data-euiicon-type="arrowRight"
size="m"
/>
Expand Down
3 changes: 3 additions & 0 deletions src/components/button/__snapshots__/button.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ exports[`EuiButton props iconSide left is rendered 1`] = `
>
<span
class="euiButtonContent__icon"
color="inherit"
data-euiicon-type="user"
/>
<span
Expand All @@ -206,6 +207,7 @@ exports[`EuiButton props iconSide right is rendered 1`] = `
>
<span
class="euiButtonContent__icon"
color="inherit"
data-euiicon-type="user"
/>
<span
Expand All @@ -227,6 +229,7 @@ exports[`EuiButton props iconType is rendered 1`] = `
>
<span
class="euiButtonContent__icon"
color="inherit"
data-euiicon-type="user"
/>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ exports[`EuiButtonContent props iconSide is rendered 1`] = `
>
<span
class="euiButtonContent__icon"
color="inherit"
data-euiicon-type="bolt"
/>
<span />
Expand All @@ -38,6 +39,7 @@ exports[`EuiButtonContent props iconType is rendered 1`] = `
>
<span
class="euiButtonContent__icon"
color="inherit"
data-euiicon-type="bolt"
/>
<span />
Expand Down
1 change: 1 addition & 0 deletions src/components/button/button_content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const EuiButtonContent: FunctionComponent<
className="euiButtonContent__icon"
type={iconType}
size={iconSize}
color="inherit" // forces the icon to inherit its parent color
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ exports[`EuiButtonEmpty props iconSide left is rendered 1`] = `
>
<span
class="euiButtonContent__icon"
color="inherit"
data-euiicon-type="user"
/>
<span
Expand All @@ -221,6 +222,7 @@ exports[`EuiButtonEmpty props iconSide right is rendered 1`] = `
>
<span
class="euiButtonContent__icon"
color="inherit"
data-euiicon-type="user"
/>
<span
Expand All @@ -242,6 +244,7 @@ exports[`EuiButtonEmpty props iconType is rendered 1`] = `
>
<span
class="euiButtonContent__icon"
color="inherit"
data-euiicon-type="user"
/>
<span
Expand Down
Loading