Skip to content

Commit b980ee7

Browse files
committed
adding the Start For Free
1 parent 587760e commit b980ee7

2 files changed

Lines changed: 101 additions & 46 deletions

File tree

Lines changed: 6 additions & 0 deletions
Loading

frontends/main/src/app-pages/ProductPages/ProductSummary.tsx

Lines changed: 95 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -383,18 +383,22 @@ const ProgramPaySection = styled.div(({ theme }) => ({
383383
flexDirection: "column",
384384
alignItems: "flex-start",
385385
gap: "4px",
386-
width: "100%",
387-
maxWidth: "346px",
386+
width: "346px",
387+
alignSelf: "stretch",
388+
flex: "none",
388389
color: theme.custom.colors.darkGray2,
389390
}))
390391

391392
const ProgramPayLabel = styled.span(({ theme }) => ({
392393
...theme.typography.body4,
393394
fontSize: "12px",
395+
lineHeight: "16px",
394396
fontWeight: theme.typography.fontWeightMedium,
395397
color: theme.custom.colors.silverGrayDark,
396398
textTransform: "uppercase",
397399
letterSpacing: "0.04em",
400+
width: "100%",
401+
alignSelf: "stretch",
398402
}))
399403

400404
const ProgramPayContent = styled.div(({ theme }) => ({
@@ -426,29 +430,40 @@ const ProgramPriceAmount = styled.span(({ theme }) => ({
426430
const ProgramPriceSuffix = styled.span(({ theme }) => ({
427431
...theme.typography.subtitle1,
428432
fontWeight: theme.typography.fontWeightMedium,
433+
fontSize: "18px",
434+
lineHeight: "26px",
429435
color: theme.custom.colors.silverGrayDark,
430436
}))
431437

432438
const ProgramDiscountBlock = styled.div(({ theme }) => ({
433439
display: "flex",
434440
flexDirection: "column",
441+
justifyContent: "center",
435442
alignItems: "flex-start",
436-
gap: "4px",
443+
gap: "8px",
437444
color: theme.custom.colors.darkGray2,
438445
}))
439446

440447
const ProgramSavingsText = styled.span(({ theme }) => ({
441448
...theme.typography.subtitle2,
442-
color: theme.custom.colors.green,
449+
color: "#008000",
443450
fontSize: "16px",
451+
lineHeight: "24px",
452+
fontWeight: theme.typography.fontWeightBold,
444453
}))
445454

446455
const ProgramListPriceText = styled.span(({ theme }) => ({
447456
...theme.typography.body2,
457+
fontSize: "14px",
458+
lineHeight: "18px",
459+
fontWeight: theme.typography.fontWeightMedium,
448460
color: theme.custom.colors.silverGrayDark,
449-
textDecoration: "line-through",
450461
}))
451462

463+
const ProgramListPriceAmount = styled.span({
464+
textDecoration: "line-through",
465+
})
466+
452467
const ProgramPriceDivider = styled.div(({ theme }) => ({
453468
width: "100%",
454469
maxWidth: "346px",
@@ -458,6 +473,41 @@ const ProgramPriceDivider = styled.div(({ theme }) => ({
458473
alignSelf: "stretch",
459474
}))
460475

476+
const ProgramStartForFreeBox = styled.div((_theme) => ({
477+
display: "flex",
478+
alignItems: "center",
479+
gap: "8px",
480+
padding: "8px 16px",
481+
borderRadius: "8px",
482+
background:
483+
"linear-gradient(0deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.94)), #004D1A",
484+
}))
485+
486+
const ProgramStartForFreeIcon = styled.svg(() => ({
487+
width: "24px",
488+
height: "24px",
489+
flexShrink: 0,
490+
"path": {
491+
fill: "#008000",
492+
},
493+
}))
494+
495+
const ProgramStartForFreeTextContainer = styled.span(({ theme }) => ({
496+
display: "flex",
497+
alignItems: "center",
498+
gap: "4px",
499+
...theme.typography.body2,
500+
}))
501+
502+
const ProgramStartForFreeTextStrong = styled.span(({ theme }) => ({
503+
color: "#008000",
504+
fontWeight: theme.typography.fontWeightMedium,
505+
}))
506+
507+
const ProgramStartForFreeTextRegular = styled.span(({ theme }) => ({
508+
color: theme.custom.colors.darkGray2,
509+
}))
510+
461511
const CertificateBoxRoot = styled.div(({ theme }) => ({
462512
width: "100%",
463513
backgroundColor: theme.custom.colors.lightGray1,
@@ -841,40 +891,6 @@ const ProgramPaceRow: React.FC<
841891
const PROGRAM_CERT_INFO_HREF =
842892
"https://mitxonline.zendesk.com/hc/en-us/articles/28158506908699-What-is-the-Certificate-Track-What-are-Course-and-Program-Certificates"
843893

844-
const ProgramCertificateBox: React.FC<{ program: V2ProgramDetail }> = ({
845-
program,
846-
}) => {
847-
const price = program.products[0]?.price
848-
if (!price) return null
849-
return (
850-
<CertificateBoxRoot>
851-
<InfoRowInner flexWrap="nowrap">
852-
<span>
853-
<UnderlinedLink
854-
href={PROGRAM_CERT_INFO_HREF}
855-
target="_blank"
856-
rel="noopener noreferrer"
857-
color="black"
858-
>
859-
<InfoLabel>Earn a certificate</InfoLabel>
860-
</UnderlinedLink>
861-
: {formatPrice(price, { avoidCents: true })}
862-
</span>
863-
</InfoRowInner>
864-
{program.page.financial_assistance_form_url ? (
865-
<UnderlinedLink
866-
color="black"
867-
href={mitxonlineLegacyUrl(program.page.financial_assistance_form_url)}
868-
target="_blank"
869-
rel="noopener noreferrer"
870-
style={{ minWidth: "fit-content" }}
871-
>
872-
Financial assistance available
873-
</UnderlinedLink>
874-
) : null}
875-
</CertificateBoxRoot>
876-
)
877-
}
878894

879895
type ProgramPriceRowProps = HTMLAttributes<HTMLDivElement> & {
880896
program: V2ProgramDetail
@@ -898,7 +914,7 @@ const ProgramPriceRow: React.FC<ProgramPriceRowProps> = ({
898914
const totalRequired = getTotalRequiredCourses(program)
899915

900916
const paidSection =
901-
enrollmentType === "paid" && currentPrice ? (
917+
currentPrice ? (
902918
<ProgramPaySection>
903919
<ProgramPayLabel>Price</ProgramPayLabel>
904920
<ProgramPayContent>
@@ -914,12 +930,48 @@ const ProgramPriceRow: React.FC<ProgramPriceRowProps> = ({
914930
Save {formatPrice(savingsAmount, { avoidCents: true })}
915931
</ProgramSavingsText>
916932
<ProgramListPriceText>
917-
{formatPrice(listAmount, { avoidCents: true })} total for{" "}
933+
<ProgramListPriceAmount>
934+
{formatPrice(listAmount, { avoidCents: true })}
935+
</ProgramListPriceAmount>{" "}
936+
total for{" "}
918937
{totalRequired} {pluralize("course", totalRequired)} purchased
919938
separately
920939
</ProgramListPriceText>
921940
</ProgramDiscountBlock>
922941
) : null}
942+
{enrollmentType === "both" ? (
943+
<ProgramStartForFreeBox>
944+
<ProgramStartForFreeIcon
945+
width="24"
946+
height="24"
947+
viewBox="0 0 22 19"
948+
fill="none"
949+
xmlns="http://www.w3.org/2000/svg"
950+
aria-hidden="true"
951+
>
952+
<path d="M14 0C16.2091 0 18 1.79086 18 4C18 4.72903 17.8049 5.41251 17.4642 6.00111L22 6V7.99999H20V18C20 18.5523 19.5523 19 19 19H3C2.44772 19 2 18.5523 2 18V7.99999H0V6L4.53577 6.00111C4.19504 5.41251 4 4.72903 4 4C4 1.79086 5.79086 0 8 0C9.19522 0 10.268 0.52421 11.0009 1.35526C11.732 0.52421 12.8048 0 14 0ZM10 7.99999H4V17H10V7.99999ZM18 7.99999H12V17H18V7.99999ZM8 2C6.89543 2 6 2.89543 6 4C6 5.05436 6.81588 5.91816 7.85074 5.99451L8 6H10V4C10 2.99835 9.26372 2.16869 8.30278 2.02277L8.14927 2.00548L8 2ZM14 2C12.9456 2 12.0818 2.81588 12.0055 3.85074L12 4V6H14C15.0543 6 15.9181 5.18412 15.9945 4.14926L16 4C16 2.89543 15.1046 2 14 2Z" />
953+
</ProgramStartForFreeIcon>
954+
<ProgramStartForFreeTextContainer>
955+
<ProgramStartForFreeTextStrong>
956+
Start for free
957+
</ProgramStartForFreeTextStrong>
958+
<ProgramStartForFreeTextRegular>
959+
or upgrade to certificate
960+
</ProgramStartForFreeTextRegular>
961+
</ProgramStartForFreeTextContainer>
962+
</ProgramStartForFreeBox>
963+
) : null}
964+
{program.page.financial_assistance_form_url ? (
965+
<UnderlinedLink
966+
color="black"
967+
href={mitxonlineLegacyUrl(program.page.financial_assistance_form_url)}
968+
target="_blank"
969+
rel="noopener noreferrer"
970+
style={{ minWidth: "fit-content" }}
971+
>
972+
Financial assistance available
973+
</UnderlinedLink>
974+
) : null}
923975
</ProgramPayContent>
924976
</ProgramPaySection>
925977
) : (
@@ -928,9 +980,9 @@ const ProgramPriceRow: React.FC<ProgramPriceRowProps> = ({
928980

929981
return (
930982
<Stack {...others} gap="0px" width="100%">
931-
{enrollmentType === "paid" ? <ProgramPriceDivider /> : null}
983+
{enrollmentType === "paid" || enrollmentType === "both" ? <ProgramPriceDivider /> : null}
932984
<InfoRow>
933-
{enrollmentType === "paid" ? (
985+
{enrollmentType === "paid" || enrollmentType === "both" ? (
934986
paidSection
935987
) : (
936988
<>
@@ -939,9 +991,6 @@ const ProgramPriceRow: React.FC<ProgramPriceRowProps> = ({
939991
</InfoRowIcon>
940992
<InfoRowInner>
941993
<InfoLabelValue label="Price" value="Free to Learn" />
942-
{enrollmentType === "both" ? (
943-
<ProgramCertificateBox program={program} />
944-
) : null}
945994
</InfoRowInner>
946995
</>
947996
)}

0 commit comments

Comments
 (0)