File tree Expand file tree Collapse file tree 1 file changed +19
-14
lines changed
frontends/ol-components/src/components/LearningResourceCard Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -66,13 +66,18 @@ const Info = ({
66
66
size : Size
67
67
} ) => {
68
68
const prices = getLearningResourcePrices ( resource )
69
- const certificatePrice =
70
- size === "small" && prices . certificate . display ?. includes ( "–" )
71
- ? ""
72
- : prices . certificate . display
73
- ? prices . certificate . display
74
- : ""
75
- const separator = size === "small" ? "" : ": "
69
+ const getCertPriceAndLabel = ( ) => {
70
+ if ( size === "small" ) {
71
+ const label = ""
72
+ const hasRange = prices . course . display ?. includes ( "–" )
73
+ const certificatePrice = hasRange ? "" : prices . certificate . display
74
+ return { certificatePrice, label }
75
+ }
76
+ const certificatePrice = prices . certificate . display
77
+ const label = certificatePrice ? "Certificate:" : "Certificate"
78
+ return { certificatePrice, label }
79
+ }
80
+ const { certificatePrice, label } = getCertPriceAndLabel ( )
76
81
return (
77
82
< >
78
83
< span > { getReadableResourceType ( resource . resource_type ) } </ span >
@@ -84,14 +89,14 @@ const Info = ({
84
89
< RiAwardFill />
85
90
</ Tooltip >
86
91
) : (
87
- < RiAwardFill />
92
+ < >
93
+ < RiAwardFill />
94
+ { label }
95
+ { certificatePrice ? (
96
+ < CertificatePrice > { certificatePrice } </ CertificatePrice >
97
+ ) : null }
98
+ </ >
88
99
) }
89
- { size === "small" ? "" : "Certificate" }
90
- { certificatePrice ? (
91
- < CertificatePrice >
92
- { `${ separator } ${ certificatePrice } ` }
93
- </ CertificatePrice >
94
- ) : null }
95
100
</ Certificate >
96
101
) }
97
102
< Price > { prices . course . display } </ Price >
You can’t perform that action at this time.
0 commit comments