Skip to content

Commit 3503875

Browse files
authored
Merge pull request #498 from topcoder-platform/ui_fixes
Minor UI fixes for responsiveness & code cleanup -> dev
2 parents a0bad7d + a6a8a71 commit 3503875

File tree

10 files changed

+70
-144
lines changed

10 files changed

+70
-144
lines changed

src-ts/lib/styles/_modals.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
&.modal-body {
3535
width: 90vw;
3636
max-width: 1000px;
37+
@include ltemd {
38+
width: 100vw;
39+
}
3740
}
3841

3942
@include ltemd {

src-ts/tools/learn/certification-details/CertificationDetailsPage.module.scss

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,5 @@
11
@import '../../../lib/styles/includes';
22

3-
.hero-wrap {
4-
:global(.hero-content) {
5-
flex-direction: column;
6-
gap: $space-xxxxl;
7-
position: relative;
8-
9-
@include gtelg {
10-
padding-right: calc(40vw + $space-xxl);
11-
}
12-
13-
@include gtexl {
14-
padding-right: calc(445px + $space-xxl);
15-
}
16-
}
17-
}
18-
19-
.contentWrap {
20-
.outerContentWrap {
21-
padding-top: $space-mxx;
22-
padding-bottom: 120px;
23-
24-
@include ltexl {
25-
padding-top: $space-xxxxl;
26-
padding-bottom: $space-xxxxl;
27-
}
28-
29-
@include gtelg {
30-
padding-right: calc(40vw + $space-xxl * 2);
31-
}
32-
33-
@include gtexl {
34-
padding-right: calc(445px + $space-xxxl * 2);
35-
}
36-
}
37-
38-
.innerContentWrap.innerContentWrap.innerContentWrap {
39-
@include ltemd {
40-
overflow: visible;
41-
}
42-
}
43-
}
44-
453
.text-section.text-section {
464
margin-top: 80px;
475

src-ts/tools/learn/certification-details/CertificationDetailsPage.tsx

Lines changed: 39 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,25 @@ import { Dispatch, FC, ReactNode, SetStateAction, useContext, useState } from 'r
22
import { Params, useParams } from 'react-router-dom'
33
import classNames from 'classnames'
44

5-
import { PageSubheaderPortalId } from '../../../config'
65
import {
76
TCACertificationProgressProviderData,
87
TCACertificationProviderData,
98
useGetTCACertification,
109
useGetTCACertificationProgress,
1110
useGetUserCertifications,
12-
useLearnBreadcrumb,
1311
UserCertificationsProviderData,
14-
WaveHero,
1512
} from '../learn-lib'
1613
import {
17-
Breadcrumb,
18-
BreadcrumbItemModel,
1914
Button,
20-
ContentLayout,
21-
LoadingSpinner,
22-
Portal,
2315
profileContext,
2416
ProfileContextData,
25-
textFormatGetSafeString,
2617
} from '../../../lib'
2718

28-
import { HeroTitle } from './hero-title'
2919
import { CertificationDetailsSidebar } from './certification-details-sidebar'
3020
import { CertificationCurriculum } from './certification-curriculum'
3121
import { EnrollCtaBtn } from './enroll-cta-btn'
3222
import { CertifDetailsContent, CertificationDetailsModal } from './certification-details-modal'
23+
import { PageLayout } from './page-layout'
3324
import styles from './CertificationDetailsPage.module.scss'
3425

3526
const CertificationDetailsPage: FC<{}> = () => {
@@ -68,14 +59,6 @@ const CertificationDetailsPage: FC<{}> = () => {
6859
const isEnrolled: boolean = progressReady && !!progress
6960
const isNotEnrolledView: boolean = !progressReady || !progress
7061

71-
const breadcrumb: Array<BreadcrumbItemModel> = useLearnBreadcrumb([
72-
{
73-
74-
name: textFormatGetSafeString(certification?.title),
75-
url: '',
76-
},
77-
])
78-
7962
function renderCertificationCurriculum(): ReactNode {
8063
return (
8164
<div className={classNames(styles['text-section'], isEnrolled && styles['no-top'])}>
@@ -92,73 +75,52 @@ const CertificationDetailsPage: FC<{}> = () => {
9275
setCertifDetailsModalOpen(d => !d)
9376
}
9477

95-
function renderContents(): ReactNode {
96-
return (
97-
<>
98-
<Breadcrumb items={breadcrumb} />
99-
100-
<Portal portalId={PageSubheaderPortalId}>
101-
<div className={styles['hero-wrap']}>
102-
<WaveHero
103-
title={(
104-
<HeroTitle certification={certification} certTitle={certification.title} />
105-
)}
106-
theme='grey'
107-
text={certification.introText}
108-
>
109-
{!isEnrolled && (
110-
<EnrollCtaBtn certification={certification.dashedName} />
111-
)}
112-
</WaveHero>
113-
<CertificationDetailsSidebar
114-
certification={certification}
115-
enrolled={isEnrolled}
116-
profile={profile}
117-
certProgress={progress}
78+
function renderMainContent(): ReactNode {
79+
return ready ? (
80+
isNotEnrolledView ? (
81+
<CertifDetailsContent certification={certification} sectionClassName={styles['text-section']}>
82+
{renderCertificationCurriculum()}
83+
</CertifDetailsContent>
84+
) : (
85+
<>
86+
{renderCertificationCurriculum()}
87+
<div className={styles['text-section']}>
88+
<Button
89+
buttonStyle='link'
90+
label='Certification Details'
91+
onClick={toggleCertifDetailsModal}
11892
/>
11993
</div>
120-
</Portal>
94+
<CertificationDetailsModal
95+
isOpen={isCertifDetailsModalOpen}
96+
onClose={toggleCertifDetailsModal}
97+
certification={certification}
98+
/>
99+
</>
100+
)
101+
) : null
102+
}
121103

122-
{isNotEnrolledView ? (
123-
<CertifDetailsContent certification={certification} sectionClassName={styles['text-section']}>
124-
{renderCertificationCurriculum()}
125-
</CertifDetailsContent>
126-
) : (
127-
<>
128-
{renderCertificationCurriculum()}
129-
<div className={styles['text-section']}>
130-
<Button
131-
buttonStyle='link'
132-
label='Certification Details'
133-
onClick={toggleCertifDetailsModal}
134-
/>
135-
</div>
136-
</>
137-
)}
138-
</>
104+
function renderSidebar(): ReactNode {
105+
return (
106+
<CertificationDetailsSidebar
107+
certification={certification}
108+
enrolled={isEnrolled}
109+
profile={profile}
110+
certProgress={progress}
111+
/>
139112
)
140113
}
141114

142115
return (
143-
<ContentLayout
144-
contentClass={styles.contentWrap}
145-
outerClass={styles.outerContentWrap}
146-
innerClass={styles.innerContentWrap}
147-
>
148-
{!ready ? (
149-
<div className={styles.wrap}>
150-
<LoadingSpinner />
151-
</div>
152-
) : renderContents()}
153-
154-
{certificationReady && (
155-
<CertificationDetailsModal
156-
isOpen={isCertifDetailsModalOpen}
157-
onClose={toggleCertifDetailsModal}
158-
certification={certification}
159-
/>
116+
<PageLayout
117+
sidebarContents={renderSidebar()}
118+
mainContent={renderMainContent()}
119+
certification={certification}
120+
heroCTA={!isEnrolled && (
121+
<EnrollCtaBtn certification={certification.dashedName} />
160122
)}
161-
</ContentLayout>
123+
/>
162124
)
163125
}
164126

src-ts/tools/learn/certification-details/certificate-preview/CertificatePreview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface CertificatePreviewProps {
1515
const CertificatePreview: FC<CertificatePreviewProps> = (props: CertificatePreviewProps) => {
1616
const certificateWrapRef: MutableRefObject<HTMLDivElement | any> = useRef()
1717

18-
useCertificateScaling(certificateWrapRef, 780, 395)
18+
useCertificateScaling(certificateWrapRef, 780, 780)
1919

2020
function getPlaceholder(): ReactNode {
2121
return (

src-ts/tools/learn/certification-details/certification-curriculum/CertificationCurriculum.module.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
margin-right: -$space-lg;
1919
}
2020

21-
@include ltelg {
21+
@media (max-width: 1150px) {
2222
padding: $space-xxxxl $space-lg $space-lg;
2323
}
2424
}
@@ -38,6 +38,11 @@
3838
align-items: baseline;
3939
gap: $space-lg;
4040

41+
@media (max-width: 1250px) {
42+
flex-wrap: wrap;
43+
justify-content: flex-end;
44+
}
45+
4146
@include ltelg {
4247
margin-left: 0;
4348
margin-top: $space-xxl;
@@ -94,7 +99,7 @@
9499
padding: $space-xxxxl;
95100

96101
margin-top: $space-xxl;
97-
@include ltelg {
102+
@media (max-width: 1150px) {
98103
padding: $space-lg;
99104
}
100105
}

src-ts/tools/learn/certification-details/certification-curriculum/curriculum-cards/CurriculumCard.module.scss

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
display: flex;
99
gap: $space-xxl;
1010

11-
@include ltelg {
11+
@media (max-width: 1150px) {
1212
padding: $space-lg;
1313
flex-direction: column;
1414
gap: $space-lg;
@@ -26,7 +26,7 @@
2626
flex: 0 0 auto;
2727
display: flex;
2828

29-
@include ltelg {
29+
@media (max-width: 1150px) {
3030
display: none;
3131
}
3232
}
@@ -109,7 +109,12 @@
109109
.cta {
110110
margin-left: auto;
111111
justify-content: flex-end;
112-
@include ltelg {
112+
113+
@media (max-width: 1250px) {
114+
flex-wrap: wrap;
115+
}
116+
117+
@media (max-width: 1150px) {
113118
display: none;
114119
}
115120
}
@@ -118,12 +123,11 @@
118123
.cta, .bottomActions, .bottomCta {
119124
display: flex;
120125
align-items: center;
121-
flex-wrap: wrap;
122126
gap: $space-sm;
123127
}
124128

125129
.bottomActions {
126-
@include gtexl {
130+
@media (min-width: 1151px) {
127131
display: none;
128132
}
129133
}

src-ts/tools/learn/certification-details/certification-curriculum/curriculum-cards/course-card/CourseCard.module.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
color: $black-60;
1010

1111
margin-top: $space-xs;
12-
@include ltelg {
12+
@media (max-width: 1150px) {
1313
flex-wrap: wrap;
14+
}
15+
16+
@include ltelg {
1417
gap: 0 5px;
1518
margin-top: 0;
1619
}

src-ts/tools/learn/certification-details/page-layout/PageLayout.module.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
gap: $space-xxxxl;
77
position: relative;
88

9-
@include gtelg {
10-
padding-right: calc(40vw + $space-xxl);
9+
@media (min-width: 1151px) {
10+
padding-right: calc(445px + $space-xxl);
1111
}
1212

13-
@include gtexl {
14-
padding-right: calc(445px + $space-xxl);
13+
@include gtelg {
14+
padding-right: calc(40vw + $space-xxl);
1515
}
1616
}
1717
}
@@ -30,7 +30,7 @@
3030
padding-right: calc(40vw + $space-xxl * 2);
3131
}
3232

33-
@include gtexl {
33+
@media (min-width: 1151px) {
3434
padding-right: calc(445px + $space-xxxl * 2);
3535
}
3636
}
@@ -40,4 +40,4 @@
4040
overflow: visible;
4141
}
4242
}
43-
}
43+
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { TCACertificationEnrollmentBase } from '../tca-certification-enrollment-base.model'
2-
31
import { TCACertificationProgress } from './tca-certification-progress.model'
42

53
export interface TCACertificationProgressProviderData {
@@ -10,10 +8,3 @@ export interface TCACertificationProgressProviderData {
108
refetch: () => void,
119
setCertificateProgress: (progess: TCACertificationProgress) => void,
1210
}
13-
14-
export interface TCACertificationEnrollmentProviderData {
15-
enrollment: TCACertificationEnrollmentBase | TCACertificationProgress | undefined
16-
error: boolean
17-
loading: boolean
18-
ready: boolean
19-
}

src-ts/tools/learn/learn-lib/sticky-sidebar/StickySidebar.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
bottom: 0;
1515
}
1616

17-
@include lg {
17+
@media (min-width: $lg-min) and (max-width: 1150px){
1818
width: 40vw;
1919
}
2020

0 commit comments

Comments
 (0)