-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add title to February 2025 talk and support multiple authors (#363
) <!-- 👋 Hi, thanks for sending a PR to boston-ts-website! 💖. Please fill out all fields below and make sure each item is true and [x] checked. Otherwise we may not be able to review your PR. --> ## PR Checklist - [ ] Addresses an existing open issue: fixes #000 - [ ] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/boston-ts-website/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/boston-ts-website/blob/main/.github/CONTRIBUTING.md) were taken ## Overview <!-- Description of what is changed and how the code change does that. -->
- Loading branch information
Showing
5 changed files
with
77 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { AuthorData } from "~/schemas"; | ||
|
||
import { AnchorWithArrow } from "./AnchorWithArrow"; | ||
|
||
interface AuthorProps { | ||
author: AuthorData; | ||
} | ||
|
||
export function Author({ author }: AuthorProps) { | ||
return author.url ? ( | ||
<AnchorWithArrow href={author.url}>{author.name}</AnchorWithArrow> | ||
) : ( | ||
author.name | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Fragment, ReactNode } from "react"; | ||
|
||
interface OxfordCommaListProps { | ||
items: readonly ReactNode[]; | ||
} | ||
|
||
export function OxfordCommaList({ items }: OxfordCommaListProps) { | ||
if (items.length === 0) { | ||
return null; | ||
} | ||
|
||
if (items.length === 1) { | ||
return <>{items[0]}</>; | ||
} | ||
|
||
if (items.length === 2) { | ||
return ( | ||
<> | ||
{items[0]} and {items[1]} | ||
</> | ||
); | ||
} | ||
|
||
return ( | ||
<> | ||
{items.slice(0, -1).map((item, index) => ( | ||
<Fragment key={index}> | ||
{item} | ||
{index < items.length - 2 ? ", " : ", and "} | ||
</Fragment> | ||
))} | ||
{items[items.length - 1]} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
import { z } from "zod"; | ||
|
||
const authorSchema = z.object({ | ||
name: z.string(), | ||
url: z.string().nullish(), | ||
}); | ||
|
||
export const eventSchema = z.object({ | ||
date: z.coerce.date(), | ||
link: z.string(), | ||
location: z.string(), | ||
time: z.string(), | ||
topics: z.array( | ||
z.object({ | ||
author: z | ||
.object({ | ||
name: z.string(), | ||
url: z.string().nullish(), | ||
}) | ||
.nullish(), | ||
author: authorSchema.or(z.array(authorSchema)).nullish(), | ||
title: z.string(), | ||
}), | ||
), | ||
}); | ||
|
||
export type AuthorData = z.infer<typeof authorSchema>; | ||
export type EventData = z.infer<typeof eventSchema>; |