Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise 11 - Add Speakers Page #14

Open
wants to merge 5 commits into
base: 10-add-talk-descriptions
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions site/src/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function Header({ siteTitle }) {
{ href: "/", name: "Home" },
{ href: "/tickets", name: "Tickets" },
{ href: "/#schedule", name: "Schedule" },
{ href: "/speakers", name: "Speakers" },
];

return (
Expand Down
3 changes: 1 addition & 2 deletions site/src/components/speakerCards.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ export default function speakerCard({ speakers }) {
return (
<div className="flex items-center flex-wrap ">
{speakers.map(({ node }) => (
// TODO: pass slug from node into the Link component
<Link to="" className="w-1/3 p-2" key={node.name}>
<Link to={`/${node.fields.slug}`} className="w-1/3 p-2">
<div>
<img
className="rounded-full inline"
Expand Down
49 changes: 49 additions & 0 deletions site/src/pages/speakers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { useStaticQuery } from "gatsby";
import React from "react";

import Layout from "../components/layout";
import SpeakerCard from "../components/speakerCards";
import SEO from "../components/seo";
import sketchnoting from "../images/taking-notes.svg";

const Hero = ({ speakers }) => (
<div className="text-center">
<h2 className="text-5xl font-extrabold text-blue-500 leading-9 tracking-tight font-inter p-4">
Speakers
</h2>
<SpeakerCard speakers={speakers} />;
</div>
);

function SpeakerPage() {
const data = useStaticQuery(graphql`
query FetchSpeakerData {
allSpeakersYaml {
edges {
node {
id
avatar
name
title
time
fields {
slug
}
}
}
}
}
`);

return (
<Layout>
<SEO
title="Home"
keywords={[`gatsby`, `tailwind`, `react`, `tailwindcss`]}
/>
<Hero speakers={data.allSpeakersYaml.edges} />
</Layout>
);
}

export default SpeakerPage;