Skip to content

Commit 31c7d8d

Browse files
authored
fix(simple-path): color fixes for simple path (#3511)
* fix(simple-path): replace tokens for legacy (simple) Path and add snapshot tests to ensure integrity of UI
1 parent f5199f6 commit 31c7d8d

10 files changed

+1578
-19
lines changed

ui/components/path-simple/__tests__/__snapshots__/SimplePath_renders_the_legacy_Simple_Path.json

Lines changed: 46 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/path-simple/__tests__/__snapshots__/SimplePath_renders_the_legacy_Simple_Path_in_Lost_state.json

Lines changed: 48 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/path-simple/__tests__/__snapshots__/SimplePath_renders_the_legacy_Simple_Path_in_Won_state.json

Lines changed: 48 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/path-simple/__tests__/__snapshots__/SimplePath_renders_the_legacy_Simple_Path_in_a_different_stage.json

Lines changed: 101 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/path-simple/__tests__/__snapshots__/SimplePath_renders_the_legacy_Simple_Path_with_Coaching.json

Lines changed: 50 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/path-simple/__tests__/__snapshots__/SimplePath_renders_the_legacy_Simple_Path_with_Visible_Coaching.json

Lines changed: 103 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* eslint-env jest */
2+
import React from 'react';
3+
import {
4+
PathSimple,
5+
PathSimpleCoaching,
6+
PathSimpleCoachingVisible,
7+
PathSimpleDifferentStage,
8+
PathSimpleLost,
9+
PathSimpleWon
10+
} from '../';
11+
12+
import createHelpers from '../../../../jest.helpers';
13+
14+
const { matchesMarkupAndStyle } = createHelpers(__dirname);
15+
16+
describe('SimplePath', () => {
17+
it('renders the legacy Simple Path', () =>
18+
matchesMarkupAndStyle(<PathSimple />));
19+
20+
it('renders the legacy Simple Path with Coaching', () =>
21+
matchesMarkupAndStyle(<PathSimpleCoaching />));
22+
23+
it('renders the legacy Simple Path with Visible Coaching', () =>
24+
matchesMarkupAndStyle(<PathSimpleCoachingVisible />));
25+
26+
it('renders the legacy Simple Path in a different stage', () =>
27+
matchesMarkupAndStyle(<PathSimpleDifferentStage />));
28+
29+
it('renders the legacy Simple Path in Lost state', () =>
30+
matchesMarkupAndStyle(<PathSimpleLost />));
31+
32+
it('renders the legacy Simple Path in Won state', () =>
33+
matchesMarkupAndStyle(<PathSimpleWon />));
34+
});

ui/components/path-simple/base/_deprecate.scss

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
// Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
22
// Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license
33

4+
$legacy-color-background-path-incomplete: #e0e5ee;
5+
$legacy-color-background-path-incomplete-hover: #d8dde6;
6+
$legacy-color-background-path-complete: #51c983;
7+
$legacy-color-background-path-complete-hover: #1f8956;
8+
$legacy-color-background-path-current: #1172cf;
9+
$legacy-color-background-path-current-hover: #0d61af;
10+
$legacy-color-background-path-lost: #c23934;
411

512
.slds-path-coach {
613
@include deprecate('4.0.0', 'Use .slds-path instead of .slds-path-coach') {
@@ -12,6 +19,11 @@
1219
padding-bottom: $spacing-medium;
1320
}
1421
}
22+
23+
.slds-path__mark-current {
24+
background-color: $color-background-inverse;
25+
border-color: $color-background-inverse;
26+
}
1527
}
1628

1729
.slds-tabs_path,
@@ -24,7 +36,7 @@
2436
}
2537

2638
.slds-is-complete {
27-
background-color: $color-background-path-complete;
39+
background-color: $legacy-color-background-path-complete;
2840

2941
.slds-tabs_path__stage,
3042
.slds-tabs--path__stage {
@@ -42,7 +54,7 @@
4254
}
4355

4456
&:hover {
45-
background-color: $color-background-path-complete-hover;
57+
background-color: $legacy-color-background-path-complete-hover;
4658

4759
.slds-tabs_path__stage,
4860
.slds-tabs--path__stage {
@@ -62,26 +74,26 @@
6274
}
6375

6476
.slds-is-current {
65-
background-color: $color-background-path-current;
77+
background-color: $legacy-color-background-path-current;
6678

6779
&:hover {
68-
background-color: $color-background-path-current-hover;
80+
background-color: $legacy-color-background-path-current-hover;
6981
}
7082

7183
+ .slds-is-incomplete:before {
72-
background-color: $color-background-path-current;
84+
background-color: $legacy-color-background-path-current;
7385
}
7486

7587
&:hover + .slds-is-incomplete:before {
76-
background-color: $color-background-path-current-hover;
88+
background-color: $legacy-color-background-path-current-hover;
7789
}
7890
}
7991

8092
.slds-is-incomplete {
81-
background-color: $color-background-path-incomplete;
93+
background-color: $legacy-color-background-path-incomplete;
8294

8395
&:hover {
84-
background-color: $color-background-path-incomplete-hover;
96+
background-color: $legacy-color-background-path-incomplete-hover;
8597
}
8698

8799
.slds-tabs_path__link,
@@ -92,7 +104,7 @@
92104

93105
.slds-is-lost,
94106
.slds-is-lost:hover {
95-
background-color: $color-background-path-lost;
107+
background-color: $legacy-color-background-path-lost;
96108
}
97109

98110
// Lets make sure we have the right color when these steps are activated
@@ -133,6 +145,7 @@
133145

134146
.slds-tabs_path__title,
135147
.slds-tabs--path__title {
148+
color: #fff;
136149
transform: rotateX(0deg);
137150
}
138151

@@ -189,22 +202,22 @@
189202
// The below logic makes the :before (which is actually a part of the previous section) the proper color based on tabs--path__item order
190203
+ .slds-is-complete:before,
191204
+ .slds-is-current:before {
192-
background-color: $color-background-path-complete;
205+
background-color: $legacy-color-background-path-complete;
193206
}
194207

195208
&:hover + .slds-is-complete:before,
196209
&:hover + .slds-is-current:before {
197-
background-color: $color-background-path-complete-hover;
210+
background-color: $legacy-color-background-path-complete-hover;
198211
}
199212

200213
+ .slds-is-incomplete:before,
201214
+ .slds-is-lost:before {
202-
background-color: $color-background-path-incomplete;
215+
background-color: $legacy-color-background-path-incomplete;
203216
}
204217

205218
&:hover + .slds-is-incomplete:before,
206219
&:hover + .slds-is-lost:before {
207-
background-color: $color-background-path-incomplete-hover;
220+
background-color: $legacy-color-background-path-incomplete-hover;
208221
}
209222
}
210223
}
@@ -223,7 +236,7 @@
223236
top: 50%;
224237
left: ($square-icon-medium-content / 2);
225238
width: 100%;
226-
margin-top: (($square-icon-medium-content - $spacing-xx-small) * -1);
239+
margin-top: ($spacing-x-small * -1);
227240
transform: rotateX(-180deg);
228241
}
229242
}

0 commit comments

Comments
 (0)