@@ -14,6 +14,8 @@ import {IconArrowSmall} from '../../Icon/IconArrowSmall';
14
14
interface ChallengesProps {
15
15
children : React . ReactElement [ ] ;
16
16
isRecipes ?: boolean ;
17
+ titleText ?: string ;
18
+ titleId ?: string ;
17
19
}
18
20
19
21
export interface ChallengeContents {
@@ -66,7 +68,12 @@ const parseChallengeContents = (
66
68
return contents ;
67
69
} ;
68
70
69
- export function Challenges ( { children, isRecipes} : ChallengesProps ) {
71
+ export function Challenges ( {
72
+ children,
73
+ isRecipes,
74
+ titleText = isRecipes ? 'Try out some examples' : 'Try out some challenges' ,
75
+ titleId = isRecipes ? 'examples' : 'challenges' ,
76
+ } : ChallengesProps ) {
70
77
const challenges = parseChallengeContents ( children ) ;
71
78
const scrollAnchorRef = React . useRef < HTMLDivElement > ( null ) ;
72
79
@@ -112,12 +119,12 @@ export function Challenges({children, isRecipes}: ChallengesProps) {
112
119
) } >
113
120
< div ref = { scrollAnchorRef } className = "py-2 px-5 sm:px-8 pb-0 md:pb-0" >
114
121
< H2
115
- id = { isRecipes ? 'recipes' : 'challenges' }
122
+ id = { titleId }
116
123
className = { cn (
117
124
'text-3xl mb-2 leading-10 relative' ,
118
125
isRecipes ? 'text-purple-50 dark:text-purple-30' : 'text-link'
119
126
) } >
120
- { isRecipes ? 'Try out some recipes' : 'Try out some challenges' }
127
+ { titleText }
121
128
</ H2 >
122
129
{ challenges . length > 1 && (
123
130
< Navigation
@@ -132,8 +139,8 @@ export function Challenges({children, isRecipes}: ChallengesProps) {
132
139
< div key = { activeChallenge } >
133
140
< h3 className = "text-xl text-primary dark:text-primary-dark mb-2" >
134
141
< div className = "font-bold block md:inline" >
135
- { isRecipes ? 'Recipe ' : 'Challenge' } { currentChallenge . order } of { ' ' }
136
- { challenges . length }
142
+ { isRecipes ? 'Example ' : 'Challenge' } { currentChallenge . order } { ' ' }
143
+ of { challenges . length }
137
144
< span className = "text-primary dark:text-primary-dark" > : </ span >
138
145
</ div >
139
146
{ currentChallenge . name }
@@ -179,7 +186,7 @@ export function Challenges({children, isRecipes}: ChallengesProps) {
179
186
setShowSolution ( false ) ;
180
187
} }
181
188
active >
182
- Next { isRecipes ? 'Recipe ' : 'Challenge' }
189
+ Next { isRecipes ? 'Example ' : 'Challenge' }
183
190
< IconArrowSmall
184
191
displayDirection = "right"
185
192
className = "block ml-1.5"
0 commit comments