Skip to content

Commit a9a44fd

Browse files
authored
Merge pull request #537 from topcoder-platform/TCA-1078
TCA-1078 progressbar new look&feel
2 parents 9c2bb60 + ace1eb0 commit a9a44fd

File tree

14 files changed

+146
-66
lines changed

14 files changed

+146
-66
lines changed

src-ts/lib/progress-bar/ProgressBar.module.scss

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,60 @@
33
.wrap {
44
background: $black-10;
55
border-radius: $space-xs;
6-
height: $space-sm;
6+
height: $space-lg;
77
width: 100%;
8-
98
display: flex;
109

1110
:global(.progress) {
1211
background: $turq-75;
1312
border-radius: inherit;
1413
width: calc(var(--progress, 0) * 100%);
14+
position: relative;
15+
16+
.percentage {
17+
position: absolute;
18+
top: 1px;
19+
font-family: $font-barlow;
20+
font-style: normal;
21+
font-weight: $font-weight-bold;
22+
font-size: 11px;
23+
line-height: 14px;
24+
color: $black-100;
25+
}
26+
}
27+
28+
:global(.completed) {
29+
border-radius: inherit;
30+
width: calc(var(--progress, 0) * 100%);
31+
position: relative;
32+
33+
.completedText {
34+
position: absolute;
35+
top: 1px;
36+
left: $space-xs;
37+
font-family: $font-barlow;
38+
font-style: normal;
39+
font-weight: $font-weight-bold;
40+
font-size: 11px;
41+
line-height: 14px;
42+
text-transform: uppercase;
43+
color: $tc-white;
44+
}
45+
}
46+
47+
:global(.completed-dev) {
48+
background: $tc-dev-grad;
49+
}
50+
51+
:global(.completed-datascience) {
52+
background: $tc-datascience-grad;
53+
}
54+
55+
:global(.completed-design) {
56+
background: $tc-design-grad;
57+
}
58+
59+
:global(.completed-qa) {
60+
background: $tc-qa-grad;
1561
}
16-
}
62+
}

src-ts/lib/progress-bar/ProgressBar.tsx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,50 @@
11
import React, { FC } from 'react'
2+
import classNames from 'classnames'
23

34
import styles from './ProgressBar.module.scss'
45

56
interface ProgressBarProps {
67
progress: number
8+
track?: string
79
}
810

911
const ProgressBar: FC<ProgressBarProps> = (props: ProgressBarProps) => {
1012

11-
const progressProps: React.CSSProperties & {'--progress': number} = {
13+
const progressProps: React.CSSProperties & { '--progress': number } = {
1214
'--progress': props.progress,
1315
}
1416

17+
const persentageProps: React.CSSProperties = {
18+
[props.progress >= 0.05 ? 'right' : 'left']: '4px',
19+
}
20+
21+
const showPercentage: boolean = props.progress > 0 && props.progress < 1
22+
const showCompleted: boolean = props.progress === 1
23+
1524
return (
1625
<div className={styles.wrap}>
17-
<div className='progress' style={progressProps} />
26+
<div
27+
className={classNames(
28+
showCompleted ? 'completed' : 'progress',
29+
showCompleted ? `completed-${props.track?.toLowerCase() || 'dev'}` : '',
30+
)}
31+
style={progressProps}
32+
>
33+
{
34+
!!showPercentage && (
35+
<span className={styles.percentage} style={persentageProps}>
36+
{Number(props.progress * 100)
37+
.toFixed(0)}
38+
%
39+
</span>
40+
)
41+
}
42+
{
43+
!!showCompleted && (
44+
<span className={styles.completedText}>Completed </span>
45+
)
46+
}
47+
</div>
1848
</div>
1949
)
2050
}

src-ts/lib/styles/variables/_palette.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,22 @@ $white-100-opacity-10: rgba(0, 0, 0, 0.1);
207207

208208
/* SHADOW */
209209
$tips-shadow: 0 1px 6px 1px rgba(0, 0, 0, 0.2);
210+
211+
/* TRACK COLORS & GRADIENTS */
212+
$tc-dev-track-color: #048467;
213+
$tc-design-track-color: #065D6E;
214+
$tc-qa-track-color: #363D8C;
215+
$tc-datascience-track-color: #723390;
216+
$tc-dev-grad: linear-gradient(84.92deg, #048467 2.08%, #064871 97.43%);
217+
$tc-design-grad: linear-gradient(84.92deg, #065D6E 2.08%, #06596E 2.09%, #3E3B91 97.43%);
218+
$tc-qa-grad: linear-gradient(84.92deg, #363D8C 2.08%, #723390 97.43%);
219+
$tc-datascience-grad: linear-gradient(84.92deg, #723390 2.08%, #8C384F 97.43%);
220+
$tc-interview-grad: linear-gradient(84.92deg, #048467 2.08%, #064871 33.85%, #6831A8 66.15%, #8C384D 97.43%);
221+
$tc-security-grad: linear-gradient(84.92deg, #048467 2.08%, #064871 97.43%);
222+
223+
@mixin grad-text-color($grad) {
224+
background: $grad;
225+
-webkit-background-clip: text;
226+
background-clip: text;
227+
-webkit-text-fill-color: transparent;
228+
}

src-ts/tools/learn/certification-details/certification-details-sidebar/CertificationDetailsSidebar.module.scss

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020

2121
.certification-details-list {
2222
margin-top: $space-xxl;
23+
2324
li {
2425
display: flex;
2526
align-items: center;
2627
margin-top: $space-sm;
28+
2729
.icon {
2830
width: 24px;
2931
height: 24px;
@@ -33,7 +35,7 @@
3335
margin-right: $space-sm;
3436
color: $blue-140;
3537

36-
> svg {
38+
>svg {
3739
display: block;
3840
width: 100%;
3941
height: 100%;
@@ -80,7 +82,7 @@
8082
.providers {
8183
margin-top: $space-sm;
8284

83-
> span {
85+
>span {
8486
@extend .body-small-medium;
8587
}
8688
}
@@ -105,14 +107,25 @@
105107
display: block;
106108
padding: $space-xs calc($space-sm + $border);
107109
border-radius: $space-xs;
110+
color: $tc-white;
108111

109112
&.enrolled {
110113
background: $blue-140;
111-
color: $tc-white;
112114
}
113115

114-
&.completed {
115-
background: $turq-75;
116-
color: $black-100;
116+
&.completed-dev {
117+
background: $tc-dev-grad;
117118
}
118-
}
119+
120+
&.completed-datascience {
121+
background: $tc-datascience-grad;
122+
}
123+
124+
&.completed-design {
125+
background: $tc-design-grad;
126+
}
127+
128+
&.completed-qa {
129+
background: $tc-qa-grad;
130+
}
131+
}

src-ts/tools/learn/certification-details/certification-details-sidebar/CertificationDetailsSidebar.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,15 @@ const CertificationDetailsSidebar: FC<CertificationDetailsSidebarProps> = (props
132132

133133
<div className={styles.btns}>
134134
{(props.enrolled || completed) ? (
135-
<div className={classNames(styles.tag, completed ? styles.completed : styles.enrolled)}>
135+
<div className={classNames(
136+
styles.tag,
137+
completed
138+
? styles[
139+
`completed-${props.certification.certificationCategory.track.toLowerCase() || 'dev'}`
140+
]
141+
: styles.enrolled,
142+
)}
143+
>
136144
<span className='body-main-medium'>{completed ? 'Completed' : 'Enrolled'}</span>
137145
</div>
138146
) : (

src-ts/tools/learn/course-certificate/certificate-view/certificate/Certificate.module.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@import '../../../../../lib/styles/includes';
2-
@import './includes';
32

43
.wrap {
54
display: flex;

src-ts/tools/learn/course-certificate/certificate-view/certificate/certificate-bg-pattern/CertificateBgPattern.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../includes';
1+
@import '../../../../../../lib/styles/includes';
22

33
@mixin wave-bg-pattern($grad) {
44
background: url('./wave-bg-2.png') 0 0 no-repeat,

src-ts/tools/learn/course-certificate/certificate-view/certificate/includes.scss

Lines changed: 0 additions & 17 deletions
This file was deleted.

src-ts/tools/learn/learn-lib/tca-certificate-preview/tca-certificate/TCACertificate.module.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@import '../../../../../lib/styles/includes';
2-
@import '../../../course-certificate/certificate-view/certificate/includes.scss';
32

43
.wrap {
54
background-color: $tc-white;

src-ts/tools/learn/tca-certificate/validate-certificate/ValidateTCACertificate.module.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@import '../../../../lib/styles/includes';
2-
@import '../../course-certificate/certificate-view/certificate/includes.scss';
32

43
.hero {
54
display: flex;

src-ts/tools/learn/welcome/courses-card/CoursesCard.module.scss

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575

7676
.cardHeaderDividerWrap {
7777
margin-top: auto;
78+
margin-bottom: $space-lg;
79+
padding-top: $space-sm;
7880

7981
.cardHeaderDivider {
8082
height: 1px;
@@ -118,18 +120,6 @@
118120
flex-direction: column;
119121
align-items: flex-start;
120122
}
121-
122-
.completedLabel {
123-
background-color: $turq-75;
124-
padding: $space-xs $space-sm;
125-
border-radius: $space-xs;
126-
color: $black-100;
127-
font-weight: $font-weight-medium;
128-
129-
@include ltexs {
130-
margin-top: $space-lg;
131-
}
132-
}
133123
}
134124
}
135125

src-ts/tools/learn/welcome/courses-card/CoursesCard.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface CoursesCardProps {
2222
progress?: LearnUserCertificationProgress
2323
}
2424

25-
const EXCERPT_TEXT_LEN: number = 99
25+
const EXCERPT_TEXT_LEN: number = 95
2626

2727
const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
2828
const desc: string = props.certification.description?.slice(0, EXCERPT_TEXT_LEN)
@@ -49,7 +49,6 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
4949
<Button buttonStyle='secondary' size='xs' label='Details' route={detailsRoute} />
5050

5151
</div>
52-
<div className={styles.completedLabel}>Completed</div>
5352
</div>
5453
)
5554
case UserCertificationProgressStatus.inProgress:
@@ -88,7 +87,12 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
8887
</div>
8988

9089
<div className={styles.cardHeaderDividerWrap}>
91-
{isInProgress && <ProgressBar progress={(props.progress?.courseProgressPercentage ?? 0) / 100} />}
90+
{(isInProgress || isCompleted) && (
91+
<ProgressBar
92+
progress={(props.progress?.courseProgressPercentage ?? 0) / 100}
93+
track={props.certification.certificationCategory.track}
94+
/>
95+
)}
9296
{!isInProgress && !isCompleted && <div className={styles.cardHeaderDivider} />}
9397
</div>
9498

src-ts/tools/learn/welcome/tc-certifications/cert-card/TCCertCard.module.scss

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@
7777

7878
.separatorBar {
7979
border-bottom: 2px solid $black-10;
80-
margin: $space-lg 0;
80+
margin: $space-xl 0 $space-xxl;
8181
}
8282

8383
.progressBar {
84-
margin: $space-lg 0;
84+
margin: $space-lg 0 $space-xxl;
8585
}
8686

8787
.providers {
@@ -104,18 +104,6 @@
104104
flex-direction: column;
105105
align-items: flex-start;
106106
}
107-
108-
.completedLabel {
109-
background-color: $turq-75;
110-
padding: $space-xs $space-sm;
111-
border-radius: $space-xs;
112-
color: $black-100;
113-
font-weight: $font-weight-medium;
114-
115-
@include ltesm {
116-
margin-top: $space-lg;
117-
}
118-
}
119107
}
120108

121109
.certCTAButtons {

src-ts/tools/learn/welcome/tc-certifications/cert-card/TCCertCard.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ const TCCertCard: FC<TCCertCardProps> = (props: TCCertCardProps) => {
5555
{getCtaBtn('primary', 'View Certificate', getTCACertificateUrl(dashedName))}
5656
{getCtaBtn('secondary', 'Details', getTCACertificationPath(dashedName))}
5757
</div>
58-
<div className={styles.completedLabel}>Completed</div>
5958
</div>
6059
)
6160
}
@@ -64,13 +63,16 @@ const TCCertCard: FC<TCCertCardProps> = (props: TCCertCardProps) => {
6463
}
6564

6665
function renderProgressBar(): ReactNode {
67-
if (props.progress?.status !== 'enrolled') {
66+
if (!isEnrolled && !isCompleted) {
6867
return <div className={styles.separatorBar} />
6968
}
7069

7170
return (
7271
<div className={styles.progressBar}>
73-
<ProgressBar progress={props.progress.certificationProgress / 100} />
72+
<ProgressBar
73+
progress={props.progress.certificationProgress / 100}
74+
track={props.certification.certificationCategory.track}
75+
/>
7476
</div>
7577
)
7678
}

0 commit comments

Comments
 (0)