@@ -18,17 +18,17 @@ const Landing: React.FC<LandingProps> = () => {
18
18
19
19
const Logo = require ( '../resources/radiology-interview-prep-logo.png' ) ;
20
20
21
- const sections = React . useMemo ( ( ) => { return [ 'welcome' , 'structure' , 'questions' , 'method' , 'answers ' ] } , [ ] ) ;
22
- const sectionTitles = { 'welcome' : 'Welcome' , 'structure' : 'Interview Structure' , 'questions' : 'Example Questions' , 'method' : 'My Method' , 'answers' : '£ My Answers ' }
21
+ const sections = React . useMemo ( ( ) => { return [ 'welcome' , 'structure' , 'questions' , 'method' , 'question-bank ' ] } , [ ] ) ;
22
+ const sectionTitles = { [ sections [ 0 ] ] : 'Welcome' , [ sections [ 1 ] ] : 'Interview Structure' , [ sections [ 2 ] ] : 'Example Questions' , [ sections [ 3 ] ] : 'My Method' , [ sections [ 4 ] ] : '£ Question Bank ' }
23
23
24
24
// state to track active section
25
- const [ activeSection , setActiveSection ] = React . useState ( 'welcome' ) ;
25
+ const [ activeSection , setActiveSection ] = React . useState ( sections [ 0 ] ) ;
26
26
27
27
// set active section when clicked + scroll to bring it into view
28
28
const handleSectionClick = ( section ) => {
29
29
setActiveSection ( section ) ;
30
30
const element = document . getElementsByClassName ( section ) [ 0 ] ;
31
- if ( section === 'welcome' )
31
+ if ( section === sections [ 0 ] )
32
32
document . getElementsByClassName ( 'content' ) [ 0 ] . scrollTo ( { top : 0 , behavior : 'smooth' } ) ;
33
33
else if ( element )
34
34
element . scrollIntoView ( { behavior : 'smooth' } ) ;
@@ -88,7 +88,7 @@ const Landing: React.FC<LandingProps> = () => {
88
88
level = 'h1'
89
89
fontSize = 'inherit'
90
90
startDecorator = { < img src = { Logo } alt = "Logo" style = { { width : '2em' } } /> }
91
- onClick = { ( ) => handleSectionClick ( 'welcome' ) }
91
+ onClick = { ( ) => handleSectionClick ( sections [ 0 ] ) }
92
92
sx = { { cursor : 'pointer' } }
93
93
>
94
94
Radiology Interview Prep.
@@ -103,9 +103,9 @@ const Landing: React.FC<LandingProps> = () => {
103
103
< Menu >
104
104
{ sections . map ( section => {
105
105
return < MenuItem
106
- color = { section === 'answers ' ? 'success' : 'neutral' }
106
+ color = { section === 'question-bank ' ? 'success' : 'neutral' }
107
107
onClick = { ( ) => handleSectionClick ( section ) }
108
- sx = { activeSection === section ? ( section === 'answers ' ? activeSuccessMenuItemSx : activeMenuItemSx ) : { } }
108
+ sx = { activeSection === section ? ( section === 'question-bank ' ? activeSuccessMenuItemSx : activeMenuItemSx ) : { } }
109
109
>
110
110
{ sectionTitles [ section ] }
111
111
</ MenuItem >
@@ -119,25 +119,25 @@ const Landing: React.FC<LandingProps> = () => {
119
119
color = 'neutral'
120
120
onClick = { ( ) => handleSectionClick ( section ) }
121
121
sx = { [
122
- section === 'answers ' ? {
122
+ section === 'question-bank ' ? {
123
123
'&:hover' : {
124
124
backgroundColor : 'var(--joy-palette-success-outlinedHoverBg)'
125
125
} ,
126
126
'&:active' : {
127
127
backgroundColor : 'var(--joy-palette-success-outlinedActiveBg)'
128
128
}
129
129
} : { } ,
130
- activeSection === section ? ( section === 'answers ' ? activeSuccessButtonSx : activeButtonSx ) : { }
130
+ activeSection === section ? ( section === 'question-bank ' ? activeSuccessButtonSx : activeButtonSx ) : { }
131
131
] }
132
132
>
133
- { section === 'answers ' ? < Typography level = 'body-sm' color = 'success' > { sectionTitles [ section ] } </ Typography > : sectionTitles [ section ] }
133
+ { section === 'question-bank ' ? < Typography level = 'body-sm' color = 'success' > { sectionTitles [ section ] } </ Typography > : sectionTitles [ section ] }
134
134
</ Button >
135
135
} ) }
136
136
</ ButtonGroup >
137
137
</ nav >
138
138
</ header >
139
139
< div className = 'content' >
140
- < div className = 'welcome' >
140
+ < div className = { sections [ 0 ] } >
141
141
< Typography
142
142
level = 'h1' >
143
143
Hello from the < Typography
@@ -155,7 +155,7 @@ const Landing: React.FC<LandingProps> = () => {
155
155
I've made this site so you can smash yours too. 💪
156
156
</ Typography >
157
157
</ div >
158
- < Card className = 'structure' >
158
+ < Card className = { sections [ 1 ] } >
159
159
< Typography level = 'h2' > Interview Structure</ Typography >
160
160
< Typography >
161
161
< List >
@@ -241,7 +241,7 @@ const Landing: React.FC<LandingProps> = () => {
241
241
</ List >
242
242
</ Typography >
243
243
</ Card >
244
- < Card className = 'questions' >
244
+ < Card className = { sections [ 2 ] } >
245
245
< Typography level = 'h2' > Example Questions</ Typography >
246
246
< Card variant = 'soft' color = 'warning' >
247
247
< Typography level = 'h3' color = 'warning' > Prioritisation of Clinical Situations</ Typography >
@@ -444,7 +444,7 @@ const Landing: React.FC<LandingProps> = () => {
444
444
</ Grid >
445
445
</ Card >
446
446
</ Card >
447
- < Card className = 'method' >
447
+ < Card className = { sections [ 3 ] } >
448
448
< Typography level = 'h2' > My Method</ Typography >
449
449
450
450
< Typography >
@@ -525,8 +525,8 @@ const Landing: React.FC<LandingProps> = () => {
525
525
</ List >
526
526
</ Typography >
527
527
</ Card >
528
- < Card className = 'answers' variant = 'outlined' >
529
- < Typography level = 'h2' startDecorator = '£' color = 'success' > My Answers </ Typography >
528
+ < Card className = { sections [ 4 ] } variant = 'outlined' >
529
+ < Typography level = 'h2' color = 'success' > { sectionTitles [ sections [ 4 ] ] } </ Typography >
530
530
< Button color = 'success' sx = { { width : 'fit-content' } } onClick = { ( ) => navigate ( Paths . QuestionBank ) } > Access the Question Bank</ Button >
531
531
{ auth && auth . currentUser && < Typography > You're currently signed in as { auth . currentUser . email } . < Link onClick = { ( ) => auth . signOut ( ) } > Sign Out</ Link > .</ Typography > }
532
532
</ Card >
0 commit comments