Skip to content

Commit a43d4c2

Browse files
committed
TCA-868 status of a course into the course cards
1 parent 4824a52 commit a43d4c2

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
}
1818
}
1919

20+
.completed {
21+
background: $tc-white;
22+
border: 1px solid $black-20;
23+
}
24+
2025
.cardHeader {
2126
display: flex;
2227

@@ -94,4 +99,8 @@
9499

95100
.cardBottom {
96101
color: $blue-140;
102+
103+
a:nth-child(2) {
104+
margin-left: $space-sm;
105+
}
97106
}

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
2828
= useState<string>('secondary')
2929
const [courseProgress, setCourseProgress]: [number | undefined, Dispatch<SetStateAction<number | undefined>>]
3030
= useState<number | undefined>(undefined)
31+
const [linkCompleted, setLinkCompleted]: [string, Dispatch<SetStateAction<string>>]
32+
= useState<string>('')
3133

3234
useEffect(() => {
3335

@@ -46,10 +48,15 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
4648
if (isCompleted) {
4749
// if the course is completed, View the Certificate
4850
setButtonLabel('View Certificate')
51+
setButtonStyle('primary')
4952
setLink(getCertificatePath(
5053
props.certification.providerName,
5154
props.certification.certification,
5255
))
56+
setLinkCompleted(getCoursePath(
57+
props.certification.providerName,
58+
props.certification.certification,
59+
))
5360

5461
} else if (!inProgress) {
5562
// if there is no in-progress lesson for the course,
@@ -80,7 +87,7 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
8087
])
8188

8289
return (
83-
<div className={classNames(styles.wrap, !link && 'soon')}>
90+
<div className={classNames(styles.wrap, !link && 'soon', linkCompleted && styles.completed)}>
8491
<div className={styles.cardHeader}>
8592
<CourseBadge type={props.certification.trackType ?? 'DEV'} />
8693
<div className={styles.cardHeaderTitleWrap}>
@@ -101,7 +108,7 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
101108
</div>
102109

103110
<div className={styles.cardHeaderDividerWrap}>
104-
{courseProgress === undefined ? (
111+
{courseProgress === undefined ? linkCompleted ? undefined : (
105112
<div className={styles.cardHeaderDivider} />
106113
) : (
107114
<ProgressBar progress={courseProgress} />
@@ -124,6 +131,14 @@ const CoursesCard: FC<CoursesCardProps> = (props: CoursesCardProps) => {
124131
route={link}
125132
/>
126133
)}
134+
{linkCompleted && (
135+
<Button
136+
buttonStyle='secondary'
137+
size='xs'
138+
label='Details'
139+
route={linkCompleted}
140+
/>
141+
)}
127142
{!courseEnabled && (
128143
<h4 className='details'>Coming Soon</h4>
129144
)}

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FC, memo, ReactNode } from 'react'
22
import classNames from 'classnames'
33

4-
import { FccLogoBlackSvg, IconLevel1, IconLevel2, IconLevel3, IconSolid } from '../../../../../lib'
4+
import { FccLogoBlackSvg, IconLevel1, IconLevel2, IconLevel3, IconSolid, Tooltip } from '../../../../../lib'
55
import { TCACertification } from '../../../learn-lib'
66
import { SkillLabel } from '../../skill'
77
import { ReactComponent as TCACertBadgeDEV1 } from '../assets/web-dev-cert-badge-1.svg'
@@ -62,7 +62,15 @@ const TCCertCard: FC<TCCertCardProps> = (props: TCCertCardProps) => {
6262

6363
<div className={styles.skills}>
6464
<span className={classNames('body-small', styles.infoText)}>skills taught</span>
65-
{skills.map(skill => <SkillLabel skill={skill} />)}
65+
{skills.slice(0, 3)
66+
.map(skill => <SkillLabel skill={skill} />)}
67+
{skills.length > 3 && (
68+
<Tooltip
69+
content={skills.slice(0, 3)
70+
.join(', ')}
71+
trigger={<SkillLabel skill={`+ ${skills.slice(0, 3).length}`} />}
72+
/>
73+
)}
6674
</div>
6775

6876
<div className={styles.contentFrom}>

0 commit comments

Comments
 (0)