1
1
import { TableCell , TableRow , Typography } from '@mui/material' ;
2
2
import dayjs , { Dayjs } from 'dayjs' ;
3
+ import { ReactNode } from 'react' ;
3
4
import { CustomButtonLink , Text } from 'shared/components' ;
4
5
import { Color , Variant } from 'shared/enums' ;
5
6
import { useWindowProperties } from 'shared/hooks' ;
@@ -108,7 +109,8 @@ const AdmissionPeriodText = ({ examSession }: { examSession: ExamSession }) => {
108
109
} else {
109
110
return (
110
111
< >
111
- { translateCommon ( 'postAdmission' ) } :< br aria-hidden = { true } />
112
+ { translateCommon ( 'postAdmission' ) } :
113
+ < br aria-hidden = { true } />
112
114
{ renderAdmissionPeriod ( relevantPeriod ) }
113
115
</ >
114
116
) ;
@@ -155,6 +157,22 @@ const PublicExamSessionListingCellsForDesktop = ({
155
157
) ;
156
158
} ;
157
159
160
+ const TableCellForPhone = ( {
161
+ columnName,
162
+ children,
163
+ } : {
164
+ columnName : string ;
165
+ children : ReactNode ;
166
+ } ) => (
167
+ < TableCell >
168
+ < Text >
169
+ < b aria-hidden = { true } > { columnName } </ b >
170
+ < br aria-hidden = { true } />
171
+ { children }
172
+ </ Text >
173
+ </ TableCell >
174
+ ) ;
175
+
158
176
const PublicExamSessionListingCellsForPhone = ( {
159
177
examSession,
160
178
locationInfo,
@@ -175,51 +193,28 @@ const PublicExamSessionListingCellsForPhone = ({
175
193
{ ExamSessionUtils . languageAndLevelText ( examSession ) }
176
194
</ Typography >
177
195
</ TableCell >
178
- < TableCell >
179
- < Text >
180
- < b aria-hidden = { true } > { translateCommon ( 'examDate' ) } </ b >
181
- < br aria-hidden = { true } />
182
- { DateUtils . formatOptionalDate ( examSession . session_date , 'l' ) }
183
- </ Text >
184
- </ TableCell >
185
- < TableCell >
186
- < Text >
187
- < b aria-hidden = { true } > { translateCommon ( 'institution' ) } </ b >
188
- < br aria-hidden = { true } />
189
- { locationInfo . name }
190
- < br aria-hidden = { true } />
191
- { ExamSessionUtils . getMunicipality ( locationInfo ) }
192
- </ Text >
193
- </ TableCell >
194
- < TableCell >
195
- < Text >
196
- < b aria-hidden = { true } > { translateCommon ( 'registrationPeriod' ) } </ b >
197
- < br aria-hidden = { true } />
198
- < AdmissionPeriodText examSession = { examSession } />
199
- </ Text >
200
- </ TableCell >
201
- < TableCell >
202
- < Text >
203
- < b aria-hidden = { true } > { translateCommon ( 'price' ) } </ b >
204
- < br aria-hidden = { true } />
205
- { examSession . exam_fee } €
206
- </ Text >
207
- </ TableCell >
208
- < TableCell >
209
- < Text >
210
- < b aria-hidden = { true } > { translateCommon ( 'placesAvailable' ) } </ b >
211
- < br aria-hidden = { true } />
212
- { availablePlacesText }
213
- </ Text >
214
- </ TableCell >
196
+ < TableCellForPhone columnName = { translateCommon ( 'examDate' ) } >
197
+ { DateUtils . formatOptionalDate ( examSession . session_date , 'l' ) }
198
+ </ TableCellForPhone >
199
+ < TableCellForPhone columnName = { translateCommon ( 'institution' ) } >
200
+ { locationInfo . name }
201
+ < br aria-hidden = { true } />
202
+ { ExamSessionUtils . getMunicipality ( locationInfo ) }
203
+ </ TableCellForPhone >
204
+ < TableCellForPhone columnName = { translateCommon ( 'registrationPeriod' ) } >
205
+ < AdmissionPeriodText examSession = { examSession } />
206
+ </ TableCellForPhone >
207
+ < TableCellForPhone columnName = { translateCommon ( 'price' ) } >
208
+ { examSession . exam_fee } €
209
+ </ TableCellForPhone >
210
+ < TableCellForPhone columnName = { translateCommon ( 'placesAvailable' ) } >
211
+ { availablePlacesText }
212
+ </ TableCellForPhone >
215
213
< TableCell >
216
214
{ registerActionAvailable ? (
217
215
< RegisterToExamButton examSession = { examSession } />
218
216
) : (
219
- < Text
220
- className = "centered uppercase"
221
- aria-label = { translateCommon ( 'actions' ) }
222
- >
217
+ < Text className = "centered uppercase" >
223
218
< RegistrationUnavailableText examSession = { examSession } />
224
219
</ Text >
225
220
) }
0 commit comments