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

Updating components to use success over secondary color option #4888

Merged
merged 27 commits into from
Jun 21, 2021
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9ca630c
add 'success' as an acceptable prop value for color
babs20 Jun 16, 2021
84ad386
add snapshot of 'success' badge
babs20 Jun 16, 2021
63be299
update docs to use 'success'
babs20 Jun 16, 2021
b1843bb
add 'success' to Expression and make it the default color
babs20 Jun 16, 2021
35b5c13
add deprecation notice
babs20 Jun 16, 2021
cfa524a
update to use the color prop 'success' over 'secondary'
babs20 Jun 16, 2021
2e3488d
update snapshots to use the euiProgress--success class
babs20 Jun 16, 2021
8ca5126
update to use 'success' over 'secondary'
babs20 Jun 16, 2021
78be489
update to use 'success' over 'secondary'
babs20 Jun 16, 2021
fa27c29
add 'success' as color prop option
babs20 Jun 16, 2021
71c301e
use 'success' over 'secondary'
babs20 Jun 16, 2021
5409f23
use color prop 'success' over 'secondary'
babs20 Jun 16, 2021
a70af97
add deprecation notice
babs20 Jun 16, 2021
bc11fb6
update changelog
babs20 Jun 16, 2021
b9527f6
Merge branch 'master' into sucess_color_prop
babs20 Jun 17, 2021
31fec21
remove secondary from list
babs20 Jun 18, 2021
d5425e5
Update CHANGELOG.md
babs20 Jun 18, 2021
c2e6ab4
update docs
babs20 Jun 18, 2021
2bcbad9
add deprecation notice
babs20 Jun 18, 2021
6690dd5
update to use 'success' in test
babs20 Jun 18, 2021
cc367ca
add success as color option
babs20 Jun 18, 2021
ec02e4f
update changelog
babs20 Jun 18, 2021
76ed608
update to use success color variable
babs20 Jun 18, 2021
4249b42
Revert "update to use success color variable"
babs20 Jun 21, 2021
19116fb
change icon to use success sass var
babs20 Jun 21, 2021
405ff56
Merge branch 'master' into sucess_color_prop
babs20 Jun 21, 2021
952e191
resolve changelog conflicts
babs20 Jun 21, 2021
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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added `success` as `color` option to `EuiBadge`, `EuiTextColor`, `EuiText`, `EuiStat`, and `EuiExpression` ([#4888](https://github.com/elastic/eui/pull/4888))
- Changed default `color` props from `secondary` to `success` where necessary ([#4888](https://github.com/elastic/eui/pull/4888))
- Reverted `z-index: 1` on `EuiPageBody` ([#4892](https://github.com/elastic/eui/pull/4892))
## [`34.4.0`](https://github.com/elastic/eui/tree/v34.4.0)

Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/components/guide_rule/guide_rule_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const GuideRuleExample = ({
{children}
</EuiSplitPanel.Inner>
<EuiSplitPanel.Inner color="transparent">
<EuiText color={type === 'do' ? 'secondary' : 'danger'} size="s">
<EuiText color={type === 'do' ? 'success' : 'danger'} size="s">
<p>
{doOrDont && <strong>{doOrDont}.</strong>} {text}
</p>
Expand Down
4 changes: 2 additions & 2 deletions src-docs/src/views/badge/badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const badges = [
'default',
'hollow',
'primary',
'secondary',
'success',
'accent',
'warning',
'danger',
Expand Down Expand Up @@ -82,7 +82,7 @@ export default () => {
<EuiSpacer size="m" />
<EuiFlexGroup wrap responsive={false} gutterSize="xs">
<EuiFlexItem grow={false}>
<EuiBadge color="secondary" isDisabled={isDisabled}>
<EuiBadge color="success" isDisabled={isDisabled}>
{isDisabled ? 'Disabled badge' : 'Disable me!'}
</EuiBadge>
</EuiFlexItem>
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/badge/badge_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default () => (
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiBadge
color="secondary"
color="success"
iconType="cross"
iconSide="right"
onClick={() => {}}
Expand Down
6 changes: 3 additions & 3 deletions src-docs/src/views/badge/badge_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const badgeSnippet = [
`,
`<EuiBadge color="#BADA55">Custom</EuiBadge>
`,
`<EuiBadge color="secondary" isDisabled>Disabled</EuiBadge>
`<EuiBadge color="success" isDisabled>Disabled</EuiBadge>
`,
];

Expand Down Expand Up @@ -66,7 +66,7 @@ const badgeButtonSnippet = [
`<EuiBadge
iconType="cross"
iconSide="right"
color="secondary"
color="success"
onClick={onBadgeClick}
onClickAriaLabel="Aria label applied to text button"
iconOnClick={onBadgeIconClick}
Expand All @@ -80,7 +80,7 @@ import BadgeHealth from './badge_health';
const badgeHealthSource = require('!!raw-loader!./badge_health');
const badgeHealthHtml = renderToHtml(BadgeHealth);
const badgeHealthSnippet = [
`<EuiBadge color="secondary">Healthy</EuiBadge>
`<EuiBadge color="success">Healthy</EuiBadge>
`,
`<EuiBadge color="warning">Warning</EuiBadge>
`,
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/badge/badge_health.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
export default () => (
<EuiFlexGroup wrap responsive={false} gutterSize="xs">
<EuiFlexItem grow={false}>
<EuiBadge color="secondary">Healthy</EuiBadge>
<EuiBadge color="success">Healthy</EuiBadge>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiBadge color="warning">Warning</EuiBadge>
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/badge/badge_href.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default () => (
</EuiBadge>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiBadge color="secondary" href="/#/display/badge" isDisabled={true}>
<EuiBadge color="success" href="/#/display/badge" isDisabled={true}>
disabled anchor badge
</EuiBadge>
</EuiFlexItem>
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/comment/comment_list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const complexEvent = (
<EuiBadge color="primary">sample</EuiBadge>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiBadge color="secondary">review</EuiBadge>
<EuiBadge color="success">review</EuiBadge>
</EuiFlexItem>
</EuiFlexGroup>
);
Expand Down
4 changes: 2 additions & 2 deletions src-docs/src/views/elastic_charts/sparklines.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const Sparklines = () => {
<EuiStat
title=""
description="Increase over time"
titleColor="secondary"
titleColor="success"
textAlign="right">
<EuiSpacer size="s" />
<Chart size={{ height: 48 }}>
Expand All @@ -93,7 +93,7 @@ export const Sparklines = () => {
/>
</Chart>
<EuiSpacer size="s" />
<EuiText size="xs" color="secondary">
<EuiText size="xs" color="success">
<EuiIcon type="sortUp" /> <strong>15%</strong>
</EuiText>
</EuiStat>
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/expression/colors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { EuiSpacer } from '../../../../src/components/spacer';

export default () => (
<div>
<EuiExpression description="Secondary" value="isDefault()" />
<EuiExpression description="Success" value="isDefault()" />
<EuiSpacer size="s" />
<EuiExpression description="Primary" value="color()" color="primary" />
<EuiSpacer size="s" />
Expand Down
4 changes: 1 addition & 3 deletions src-docs/src/views/facet/facet.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ export default () => (
Simple, selected
</EuiFacetButton>
<br />
<EuiFacetButton
quantity={6}
icon={<EuiIcon type="dot" color="secondary" />}>
<EuiFacetButton quantity={6} icon={<EuiIcon type="dot" color="success" />}>
Label or color indicator
</EuiFacetButton>
<br />
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/facet/facet_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const facetSource = require('!!raw-loader!./facet');
const facetHtml = renderToHtml(Facet);
const facetSnippet = `<EuiFacetButton
quantity={6}
icon={<EuiIcon type="dot" color="secondary" />}
icon={<EuiIcon type="dot" color="success" />}
isSelected>
<!-- Facet with EuiIcon content -->
</EuiFacetButton>
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/progress/progress_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default () => (
<EuiProgress
valueText={true}
max={100}
color="secondary"
color="success"
size="s"
{...item}
/>
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/resize_observer/resize_observer_hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const ResizeObserverHookExample = () => {
<EuiText>
{hasResizeObserver ? (
<p>
<EuiIcon type="checkInCircleFilled" color="secondary" /> Browser
<EuiIcon type="checkInCircleFilled" color="success" /> Browser
supports ResizeObserver API.
</p>
) : (
Expand Down
1 change: 1 addition & 0 deletions src-docs/src/views/stat/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default () => {
options: {
primary: 'primary',
secondary: 'secondary',
success: 'success',
danger: 'danger',
accent: 'accent',
text: 'text',
Expand Down
4 changes: 2 additions & 2 deletions src-docs/src/views/stat/stat_colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export default () => (
<EuiFlexItem>
<EuiStat
title="1,000"
description="Secondary color"
titleColor="secondary"
description="Success color"
titleColor="success"
/>
</EuiFlexItem>
<EuiFlexItem>
Expand Down
4 changes: 2 additions & 2 deletions src-docs/src/views/stat/stat_combos.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export default () => {
<EuiStat
title="6,800"
description="Success widgets"
titleColor="secondary"
titleColor="success"
textAlign="right"
isLoading={isLoading}>
<EuiIcon type="check" color="secondary" />
<EuiIcon type="check" color="success" />
</EuiStat>
</EuiPanel>
</EuiFlexItem>
Expand Down
12 changes: 6 additions & 6 deletions src-docs/src/views/tables/custom/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class extends Component {
type: 'user',
dateCreated: 'Tue Dec 28 2016',
magnitude: 1,
health: <EuiBadge color="secondary">Healthy</EuiBadge>,
health: <EuiBadge color="success">Healthy</EuiBadge>,
},
{
id: 1,
Expand All @@ -70,7 +70,7 @@ export default class extends Component {
type: 'user',
dateCreated: 'Tue Dec 01 2016',
magnitude: 1,
health: <EuiBadge color="secondary">Healthy</EuiBadge>,
health: <EuiBadge color="success">Healthy</EuiBadge>,
},
{
id: 2,
Expand Down Expand Up @@ -104,7 +104,7 @@ export default class extends Component {
type: 'user',
dateCreated: 'Tue Dec 16 2016',
magnitude: 100,
health: <EuiBadge color="secondary">Healthy</EuiBadge>,
health: <EuiBadge color="success">Healthy</EuiBadge>,
},
{
id: 4,
Expand All @@ -126,7 +126,7 @@ export default class extends Component {
type: 'user',
dateCreated: 'Tue Dec 11 2016',
magnitude: 10000,
health: <EuiBadge color="secondary">Healthy</EuiBadge>,
health: <EuiBadge color="success">Healthy</EuiBadge>,
},
{
id: 6,
Expand Down Expand Up @@ -170,7 +170,7 @@ export default class extends Component {
type: 'user',
dateCreated: 'Tue Dec 11 2016',
magnitude: 10000,
health: <EuiBadge color="secondary">Healthy</EuiBadge>,
health: <EuiBadge color="success">Healthy</EuiBadge>,
},
{
id: 10,
Expand Down Expand Up @@ -203,7 +203,7 @@ export default class extends Component {
type: 'user',
dateCreated: 'Tue Dec 11 2016',
magnitude: 10000,
health: <EuiHealth color="secondary">Healthy</EuiHealth>,
health: <EuiHealth color="success">Healthy</EuiHealth>,
},
{
id: 13,
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/text/text_align.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default () => (
prop
</p>
</EuiText>
<EuiText textAlign="center" color="secondary">
<EuiText textAlign="center" color="success">
<p>And in conjunction with coloring.</p>
</EuiText>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src-docs/src/views/text/text_color.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default () => (
<EuiTitle>
<h2>
<EuiTextColor color="default">You </EuiTextColor>
<EuiTextColor color="secondary">use </EuiTextColor>
<EuiTextColor color="success">use </EuiTextColor>
<EuiTextColor color="accent">it </EuiTextColor>
<EuiTextColor color="warning">on </EuiTextColor>
<EuiTextColor color="danger">anything!</EuiTextColor>
Expand All @@ -29,7 +29,7 @@ export default () => (
<EuiTextColor color="subdued">Subdued text color</EuiTextColor>
</p>
<p>
<EuiTextColor color="secondary">Secondary text color</EuiTextColor>
<EuiTextColor color="success">Success text color</EuiTextColor>
</p>
<p>
<EuiTextColor color="accent">Accent text color</EuiTextColor>
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/text_diff/text_diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default () => {
</EuiText>
<EuiSpacer />
<EuiCode>
<EuiTextColor color="secondary"> {ins} </EuiTextColor> Insertions,
<EuiTextColor color="success"> {ins} </EuiTextColor> Insertions,
<EuiTextColor color="danger"> {del} </EuiTextColor>
Deletions
</EuiCode>
Expand Down
34 changes: 34 additions & 0 deletions src/components/badge/__snapshots__/badge.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,23 @@ exports[`EuiBadge props color secondary is rendered 1`] = `
</span>
`;

exports[`EuiBadge props color success is rendered 1`] = `
<span
class="euiBadge euiBadge--iconLeft"
style="background-color:#6dccb1;color:#000"
>
<span
class="euiBadge__content"
>
<span
class="euiBadge__text"
>
Content
</span>
</span>
</span>
`;

exports[`EuiBadge props color warning is rendered 1`] = `
<span
class="euiBadge euiBadge--iconLeft"
Expand Down Expand Up @@ -479,6 +496,23 @@ exports[`EuiBadge props style is rendered with secondary 1`] = `
</span>
`;

exports[`EuiBadge props style is rendered with success 1`] = `
<span
class="euiBadge euiBadge--iconLeft"
style="background-color:#6dccb1;color:#000;border:4px solid tomato"
>
<span
class="euiBadge__content"
>
<span
class="euiBadge__text"
>
Content
</span>
</span>
</span>
`;

exports[`EuiBadge props style is rendered with warning 1`] = `
<span
class="euiBadge euiBadge--iconLeft"
Expand Down
4 changes: 3 additions & 1 deletion src/components/badge/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ export type EuiBadgeProps = {
iconSide?: IconSide;

/**
* Accepts either our palette colors (primary, secondary ..etc) or a hex value `#FFFFFF`, `#000`.
* Accepts either our palette colors (primary, success ..etc) or a hex value `#FFFFFF`, `#000`.
* **`secondary` color is DEPRECATED, use `success` instead**
*/
color?: IconColor;
/**
Expand Down Expand Up @@ -116,6 +117,7 @@ const colorToHexMap: { [color in IconColor]: string } = {
// TODO - replace with variable once https://github.com/elastic/eui/issues/2731 is closed
default: '#d3dae6',
primary: visColors[1],
success: visColors[0],
secondary: visColors[0],
accent: visColors[2],
warning: visColors[5],
Expand Down
Loading