11import React from "react" ;
22
33import styled from "styled-components" ;
4+ import { faInfoCircle } from "@fortawesome/free-solid-svg-icons" ;
5+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
6+ import getSchoolIconPath from "@app/utils/get-school-icon-path" ;
47
58const StyledListItem = styled ( "li" ) `
69 display: flex;
@@ -13,29 +16,61 @@ const StyledListItem = styled("li")`
1316 border-right-style: solid;
1417` ;
1518
16- const StyledSpan = styled ( "span" ) `
17- font-size: 1.5em;
18- font-weight: 600;
19- ` ;
19+ type OtherPeriod = {
20+ school : string ;
21+ s : string | number ;
22+ e : string | number ;
23+ }
2024
21- const StyledTime = styled ( "time" ) `
22- font-size: 0.8em;
23- ` ;
25+ type Period = {
26+ s : string | number ;
27+ p : string | number ;
28+ e : string | number ;
29+ o ?: OtherPeriod [ ]
30+ }
2431
2532type Props = {
26- period : {
27- s : string | number ;
28- p : string | number ;
29- e : string | number ;
30- } ;
33+ period : Period ;
3134} ;
3235
36+ const schoolIconImage = ( school : string ) => (
37+ < img
38+ src = { getSchoolIconPath ( school , "en" ) }
39+ width = "24px"
40+ height = "24px"
41+ alt = { school }
42+ className = "inline"
43+ />
44+ ) ;
45+
46+ const OtherPeriod = ( { periods } : { periods : OtherPeriod [ ] } ) => (
47+ < div className = "pt-2" >
48+ {
49+ periods . map ( period => < p className = "mb-2" > { schoolIconImage ( period . school ) } { period . s } ~ { period . e } </ p > )
50+ }
51+ </ div >
52+ ) ;
53+
3354const TimeRowItem = ( { period } : Props ) => {
3455 return (
3556 < StyledListItem className = "text-light-text2 border-r-gray-100 dark:text-dark-text2 dark:border-r-dark-text3" >
36- < StyledTime > { period . s } </ StyledTime >
37- < StyledSpan > { period . p } </ StyledSpan >
38- < StyledTime > { period . e } </ StyledTime >
57+ < time className = "text-lg" > { period . s } </ time >
58+ {
59+ period . o ? (
60+ < div className = "group relative flex justify-center" >
61+ < span className = "text-3xl font-semibold" > { period . p } </ span >
62+ < span className = "text-sm font-semibold" > < FontAwesomeIcon icon = { faInfoCircle } size = "1x" /> </ span >
63+ < span className = "absolute left-10 bottom-0 scale-0 w-48 rounded bg-gray-500 p-2 text-2xs text-white group-hover:scale-100" >
64+ < OtherPeriod periods = { period . o } />
65+ </ span >
66+ </ div >
67+ ) : (
68+ < span className = "text-3xl font-semibold" >
69+ { period . p }
70+ </ span >
71+ )
72+ }
73+ < time className = "text-lg" > { period . e } </ time >
3974 </ StyledListItem >
4075 ) ;
4176} ;
0 commit comments