Skip to content

Commit

Permalink
Merge pull request #389 from tamascsaba/update-speaker-details
Browse files Browse the repository at this point in the history
update: speaker add social site links
  • Loading branch information
martinheidegger authored Nov 17, 2023
2 parents 1547b7d + bc6a22d commit 1f920fe
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 15 deletions.
5 changes: 5 additions & 0 deletions 2023/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ exports.createPages = ({ graphql, actions }) => {
nameReading
biography
biographyJa
github
mastodon
homepage
twitter
pronoun
}
}
}
Expand Down
54 changes: 39 additions & 15 deletions 2023/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 2023/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"*.{yml,yaml,ts,json}": "prettier"
},
"dependencies": {
"@styled-icons/remix-line": "^10.46.0",
"date-fns": "^2.30.0",
"gatsby": "^5.12.9",
"gatsby-image": "3.11.0",
Expand Down
3 changes: 3 additions & 0 deletions 2023/src/data/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ export type SpeakerType = {
biographyJa: string
presentations: string[]
github: string
mastodon: string
homepage: string
twitter: string
location: string
pronoun: string
}

export type Session = TalkType & {
Expand Down
4 changes: 4 additions & 0 deletions 2023/src/pages/schedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ const Area = styled(_Link)<{
color: ${({ theme }) => theme.colors.base };
font-size: 0.7em;
position: absolute;
font-family: ${({ theme }) => theme.fonts.text};
font-weight: bold;
color: ${({ theme }) => theme.colors.base};
font-size: 0.7em;
top: -8px;
left: -10px;
display: inline-flex;
Expand Down
89 changes: 89 additions & 0 deletions 2023/src/templates/speaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import { enOrJa } from "../util/languages"
import { EventTime } from "../components/EventTime"
import { Room } from "../components/RoomLegend"
import { Rooms } from "../util/misc"
import { ExternalLink } from "@styled-icons/remix-line/ExternalLink"
import { Mastodon } from "@styled-icons/remix-line/Mastodon"
import { Github } from "@styled-icons/remix-line/Github"
import { Twitter } from "@styled-icons/remix-line/Twitter"
import { Link } from "gatsby"

type Props = {
pageContext: {
Expand Down Expand Up @@ -85,6 +90,88 @@ const TalkTitle = styled.h2`
text-align: left;
`

type SocialLinksProps = {
speaker: SpeakerType
}

const SocialLinkContainer = styled.ul`
&,
& > li {
list-style-type: none;
padding: 0;
margin: 0;
}
& {
display: flex;
}
& > li > a {
padding: 0.4em;
color: ${({ theme }) => theme.colors.disabledText};
&:hover {
color: ${({ theme }) => theme.colors.primary};
}
}
svg {
width: 1.6em;
}
`

function SocialLinks(props: SocialLinksProps) {
const { speaker } = props
const socialLinks = [
speaker.homepage ? (
<Link to={speaker.homepage}>
<ExternalLink />
</Link>
) : null,
speaker.github ? (
<Link to={`https://github.com/${speaker.github}`}>
<Github />
</Link>
) : null,
speaker.mastodon ? (
<Link to={speaker.mastodon}>
<Mastodon />
</Link>
) : null,
speaker.twitter ? (
<Link to={`https://twitter.com/${speaker.twitter}`}>
<Twitter />
</Link>
) : null,
]
.filter(Boolean)
.map(entry => <li>{entry}</li>)

if (!socialLinks.length) {
return <></>
}

return <SocialLinkContainer>{socialLinks}</SocialLinkContainer>
}

const SpeakerPronounWrap = styled.em`
margin-left: 0.5em;
font-size: 0.75em;
`

type SpeakerPronounProps = {
speaker: SpeakerType
}

const SpeakerPronoun = ({ speaker }: SpeakerPronounProps) => {
if (!speaker.pronoun) {
return <></>
}
return (
<SpeakerPronounWrap>
{"("}
{speaker.pronoun}
{")"}
</SpeakerPronounWrap>
)
}

export default function Speaker(props: Props) {
const { t, i18n } = useTranslation()
const {
Expand Down Expand Up @@ -118,10 +205,12 @@ export default function Speaker(props: Props) {
<SpeakerSide>
<h1>
<SpeakerName speaker={speaker} />
<SpeakerPronoun speaker={speaker} />
</h1>
<Markdown>
{enOrJa(i18n)(speaker.biography, speaker.biographyJa)}
</Markdown>
<SocialLinks speaker={speaker} />
</SpeakerSide>
</SpeakerBox>
))}
Expand Down

0 comments on commit 1f920fe

Please sign in to comment.