-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSpeakerDetail.tsx
More file actions
172 lines (162 loc) · 7.79 KB
/
Copy pathSpeakerDetail.tsx
File metadata and controls
172 lines (162 loc) · 7.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
import {BIG_BREAKPOINT} from "../../constants/BreakPoints";
import {FC, Suspense, useEffect} from "react";
import MoreThanIcon from "../../assets/images/MoreThanBlueIcon.svg";
import LessThan from "../../assets/images/MoreThanIcon.svg";
import SlashesWhite from "../../assets/images/SlashesWhite.svg";
import linkedinIcon from "../../assets/images/linkedinIcon.svg";
import twitterIcon from "../../assets/images/twitterIcon.svg";
import {useWindowSize} from "react-use";
import {ROUTE_SPEAKERS, ROUTE_TALK_DETAIL} from "../../constants/routes";
import {Link} from "react-router";
import {Color} from "../../styles/colors";
import conferenceData from "../../data/2024.json";
import {ISpeaker} from "../../views/Speakers/Speaker.types";
import {
StyledDetailsContainer,
StyledFlexCol,
StyledImageContainer,
StyledInfoContainer,
StyledLink,
StyledMoreThanIcon,
StyledMoreThanIconContainer,
StyledName,
StyledNameContainer,
StyledRightContainer,
StyledSlashes,
StyledSocialMediaContainer,
StyledSocialMediaIcon,
StyledSpeakerDescription,
StyledSpeakerDetailContainer,
StyledSpeakerImg,
StyledSpeakerTitle
} from "../../views/SpeakerDetail/Speaker.style";
import {
StyledTalkDescription
} from "../../views/SpeakerDetail/SpeakerDetail.style";
interface ISpeakerDetailProps {
speaker: ISpeaker;
}
const SpeakerDetail: FC<React.PropsWithChildren<ISpeakerDetailProps>> = ({speaker}) => {
const {width} = useWindowSize();
useEffect(() => {
document.title = `${speaker.fullName} — ${conferenceData.title} — ${conferenceData.edition}`;
}, [speaker.fullName]);
const hasSessions = (): boolean =>
(speaker.sessions && speaker.sessions.length > 0) || false;
return (
<StyledSpeakerDetailContainer className="DetailsContainer">
<StyledDetailsContainer className="DetailsContainerInner">
{width > BIG_BREAKPOINT && (
<StyledImageContainer>
<Suspense fallback={<p>loading</p>}>
<StyledSpeakerImg
src={speaker.speakerImage}
alt={speaker.fullName}
/>
</Suspense>
<StyledSocialMediaContainer>
{speaker.twitterUrl && (
<StyledLink href={speaker.twitterUrl.url}
target={"_blank"}>
<StyledSocialMediaIcon src={twitterIcon}/>
</StyledLink>
)}
{speaker.linkedInUrl && (
<StyledLink href={speaker.linkedInUrl.url}
target={"_blank"}>
<StyledSocialMediaIcon src={linkedinIcon}
noMargin/>
</StyledLink>
)}
</StyledSocialMediaContainer>
</StyledImageContainer>
)}
<StyledRightContainer>
<StyledNameContainer>
<StyledName>{speaker.fullName}</StyledName>
{width < BIG_BREAKPOINT && (
<>
<Suspense fallback={<p>loading</p>}>
<StyledSpeakerImg
src={speaker.speakerImage}
alt={speaker.fullName}
/>
</Suspense>
<StyledSocialMediaContainer>
{speaker.twitterUrl && (
<StyledLink
href={speaker.twitterUrl.url}
target={"_blank"}>
<StyledSocialMediaIcon
src={twitterIcon}/>
</StyledLink>
)}
{speaker.linkedInUrl && (
<StyledLink
href={speaker.linkedInUrl.url}
target={"_blank"}
>
<StyledSocialMediaIcon
src={linkedinIcon} noMargin/>
</StyledLink>
)}
</StyledSocialMediaContainer>
</>
)}
<StyledSlashes src={SlashesWhite}/>
</StyledNameContainer>
<StyledInfoContainer>
<StyledFlexCol>
<StyledSpeakerTitle>{speaker.tagLine}</StyledSpeakerTitle>
<StyledSpeakerDescription>{speaker.bio}</StyledSpeakerDescription>
{hasSessions() && (
<>
<h2>Sessions</h2>
<ul
style={{
paddingLeft: "40px",
paddingTop: "20px",
listStyleType: "none",
}}
>
{speaker?.sessions?.map((session) => (
<li key={session.id}>
<StyledTalkDescription
to={`${ROUTE_TALK_DETAIL}/${session.id}`}
>
<StyledSpeakerTitle>
<img
src={LessThan}
height={12}
alt="session"
style={{paddingRight: "0.5rem"}}
/>
{session.name}
</StyledSpeakerTitle>
</StyledTalkDescription>
</li>
))}
</ul>
</>
)}
<Link
to={ROUTE_SPEAKERS}
style={{
color: Color.BLACK_BLUE,
fontWeight: "bold",
textDecoration: "none",
}}
>
Go back
</Link>
</StyledFlexCol>
<StyledMoreThanIconContainer>
<StyledMoreThanIcon src={MoreThanIcon}/>
</StyledMoreThanIconContainer>
</StyledInfoContainer>
</StyledRightContainer>
</StyledDetailsContainer>
</StyledSpeakerDetailContainer>
);
};
export default SpeakerDetail;