Skip to content

Commit e9d4845

Browse files
authored
Add speaker headshot to dialog button (#128)
* Add speaker headshot to dialog button on schedule * Add margin to sponsor logo on mobile * Use SpeakerButton component on talk page * Make headshot a part of speaker button * Update css
1 parent 75e64b9 commit e9d4845

File tree

5 files changed

+33
-36
lines changed

5 files changed

+33
-36
lines changed

src/components/event/event.module.css

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,22 @@
3131
.grid {
3232
margin-top: 1em;
3333
}
34-
@media screen and (min-width: 30em) {
34+
35+
.sponsorLogo {
36+
max-width: 125px;
37+
margin-top: 1em;
38+
}
39+
40+
@media screen and (min-width: 50em) {
3541
.grid {
3642
display: grid;
3743
grid-template-columns: 2fr 1fr;
3844
grid-column-gap: 1em;
3945
margin-top: 0;
4046
}
41-
}
42-
43-
.sponsorLogo {
44-
max-width: 125px;
47+
.sponsorLogo {
48+
margin-top: 0;
49+
}
4550
}
4651

4752
.food {

src/components/speaker/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @TODO Create separate component files for all the components in this file
12
import React, { useState } from 'react'
23
import { Link } from 'gatsby'
34
import { Dialog } from '@reach/dialog'
@@ -119,11 +120,17 @@ const randomPlaceholder = () => {
119120
export const SpeakerButton = ({ speaker }) => {
120121
const [dialogIsOpen, setDialogIsOpen] = useState(false)
121122
return (
122-
<span className={styles.speakerBtn}>
123+
<>
123124
<button
124125
onClick={() => setDialogIsOpen(true)}
125126
className={styles.dialogButton}
126127
>
128+
{speaker.headshot && (
129+
<img
130+
src={speaker.headshot}
131+
alt={`${speaker.name} headshot thumbnail`}
132+
/>
133+
)}
127134
{speaker.name}
128135
</button>
129136
<SpeakerDialog
@@ -132,7 +139,7 @@ export const SpeakerButton = ({ speaker }) => {
132139
speaker={speaker}
133140
showLinkToTalk={false}
134141
/>
135-
</span>
142+
</>
136143
)
137144
}
138145

src/components/speaker/speaker.module.css

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
/* Speaker Regular Button Styles */
22
.dialogButton {
3-
display: block;
3+
display: flex;
4+
align-items: center;
5+
margin: 1em 0;
6+
padding: 0;
7+
padding-right: 0.5em;
48
color: var(--navy);
59
background: transparent;
610
font-weight: var(--semi-bold);
7-
padding-bottom: 0.25em;
8-
margin-top: 1em;
911
border-color: inherit;
1012
border-style: solid;
1113
font-size: 0.9em;
@@ -14,12 +16,9 @@
1416
cursor: pointer;
1517
color: var(--tan);
1618
}
17-
}
18-
19-
@media screen and (min-width: 30em) {
20-
.speakerBtn {
21-
display: inline-flex;
22-
padding-right: 1em;
19+
img {
20+
max-width: 30px;
21+
margin-right: 0.5em;
2322
}
2423
}
2524

src/components/talk/index.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react'
1+
import React from 'react'
22
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
33
import {
44
faLaptopCode,
@@ -7,7 +7,7 @@ import {
77
faStar,
88
faBookOpen,
99
} from '@fortawesome/free-solid-svg-icons'
10-
import { SpeakerDialog } from '../speaker'
10+
import { SpeakerButton } from '../speaker'
1111
import { parameterize } from '../../utils/helpers'
1212

1313
import styles from './talk.module.css'
@@ -30,28 +30,18 @@ export const TalkType = ({ type, secondary }) => {
3030
}
3131

3232
const Talk = ({ speaker }) => {
33-
const [dialogIsOpen, setDialogIsOpen] = useState(false)
3433
const talk = speaker.talks[0]
3534
if (talk.year && talk.title && talk.desc && talk.desc && talk.type) {
3635
return (
3736
<section className={styles.section} id={parameterize(talk.title)}>
3837
<div>
3938
<h2 className="title">{talk.title}</h2>
40-
<TalkType type={talk.type} />
41-
<button
42-
onClick={() => setDialogIsOpen(true)}
43-
className={styles.dialogButton}
44-
>
45-
{speaker.name}
46-
</button>
39+
<div>
40+
<TalkType type={talk.type} />
41+
</div>
42+
<SpeakerButton speaker={speaker} />
4743
</div>
4844
<p>{talk.desc}</p>
49-
<SpeakerDialog
50-
dialogIsOpen={dialogIsOpen}
51-
setDialogIsOpen={setDialogIsOpen}
52-
speaker={speaker}
53-
showLinkToTalk={false}
54-
/>
5545
</section>
5646
)
5747
}

src/components/talk/talk.module.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
margin-right: 0.5em;
1818
}
1919

20-
.type {
21-
font-weight: var(--light);
22-
}
23-
2420
.secondary {
2521
font-size: 0.8em;
2622
margin: 0 0.5em;

0 commit comments

Comments
 (0)