Skip to content

Commit

Permalink
Merge branch 'main' into download-files
Browse files Browse the repository at this point in the history
  • Loading branch information
hetd54 committed Jun 17, 2024
2 parents 48a8d4b + 5875878 commit 953d37d
Show file tree
Hide file tree
Showing 28 changed files with 841 additions and 31 deletions.
13 changes: 13 additions & 0 deletions 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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-form": "^0.0.3",
"@radix-ui/react-hover-card": "^1.0.7",
"@radix-ui/react-icons": "^1.3.0",
"@staticcms/core": "^4.1.2",
"@staticcms/proxy-server": "^4.0.4",
Expand Down
9 changes: 8 additions & 1 deletion public/admin/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,36 @@ collections:
folder: src/content/people
create: true
fields:
- name: type
label: Staff Type
widget: select
options: [ 'Leadership', 'Advisors', 'Supporting Staff' ]
- name: name
label: Name
widget: string
- name: title
label: Title
widget: string
- name: avatar
required: false
i18n: duplicate
label: Photo
widget: image
- name: org
label: Company/University
widget: string
- name: address
required: false
i18n: duplicate
label: Mailing Address
widget: text
- name: phone
required: false
i18n: duplicate
label: Phone Number
widget: string
pattern: [ '^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$', 'Phone number must follow standard guidelines' ]
- name: email
required: false
i18n: duplicate
label: Email
widget: string
Expand Down
50 changes: 50 additions & 0 deletions src/components/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React from "react"

interface CardProps {
position: number
image?: string
title: string
name: string
address?: string
phone?: string
email?: string
}

const Card: React.FC<CardProps> = ({ position, image, title, name, address, phone, email }) => {
// strip 'public/' from the avatar string since astro's public folder is available without this in the link
const link = image?.replace("/public", "")
return (
<div
className={`flex flex-row items-center ${
position % 2 ? "md:flex-row-reverse md:text-right" : ""
}`}
>
{image && (
<div>
<img
className="object-cover rounded-full w-64 h-64 min-w-64 min-h-64 hidden md:block"
src={link}
alt={name}
/>
</div>
)}
<div className="px-8">
<div>
<p className="text-xl font-semibold">{name}</p>
<p className="italic">{title}</p>
</div>
<div>
{address && <p className="text-base">{address}</p>}
{phone && <p className="text-base">{phone}</p>}
{email && (
<a className="text-base hover:text-neutral-300" href={`mailto:${email}`}>
{email}
</a>
)}
</div>
</div>
</div>
)
}

export default Card
38 changes: 38 additions & 0 deletions src/components/CardContainer.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
import Card from "./Card"
const { color, title, people } = Astro.props
interface PersonProps {
data: {
title: string
name: string
avatar?: string
email?: string
address?: string
phone?: string
}
}
---

<div class="flex flex-row items-start space-x-12">
<h2 class={`${color} [writing-mode:vertical-lr] rotate-180`}>{title}</h2>
<div class="flex flex-col space-y-20 flex-1">
{
people.map((person: PersonProps, i: number) => {
return (
<>
<Card
position={i}
title={person.data.title}
name={person.data.name}
image={person.data.avatar}
email={person.data.email}
phone={person.data.phone}
address={person.data.address}
/>
</>
)
})
}
</div>
</div>
30 changes: 16 additions & 14 deletions src/components/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import HeaderLink from "./HeaderLink.astro"
import { SITE_TITLE, LINKS } from "../consts"
const { isHidden = true } = Astro.props
const pathname = Astro.url.pathname
const path = pathname.match(/^\/$/) ? pathname : pathname.slice(0, -1)
---
<script>
class NavbarHamburger extends HTMLElement {
Expand All @@ -11,7 +13,7 @@ const { isHidden = true } = Astro.props

let isHidden = true
const button = this.querySelector("button")
const menuElement: HTMLElement = document.getElementById("#menu-body")!
const menuElement: HTMLElement = document.getElementById("menu-body")!
button?.addEventListener("click", () => {
isHidden = !isHidden
if (isHidden) {
Expand All @@ -28,14 +30,13 @@ const { isHidden = true } = Astro.props
</script>

<header>
<h2><a class="hover:text-gray-600 decoration-0" href="/">{SITE_TITLE}</a></h2>
<h2><a class={pathname !== "/" ? `hover:text-gray-600 decoration-0` : "hidden"} href="/">{SITE_TITLE}</a></h2>
<nav>

<div class="hidden lg:flex">
{
LINKS.map((data) =>
<HeaderLink href=`/${data}`
class="text-lg py-2.5 px-4 text-black no-underline hover:text-gray-600"
class="text-base pt-2.5 px-4 text-neutral-500 hover:text-gray-600 active:text-neutral-900 "
>{data.toUpperCase()}</HeaderLink>)
}
</div>
Expand All @@ -51,15 +52,16 @@ const { isHidden = true } = Astro.props
</button>

</navbar-hamburger>
<div id="menu-body" data-hidden={isHidden} class="hidden">
<ul class="flex flex-col items-end font-medium mt-4 absolute top-16 right-6 md:right-14">
{
LINKS.map((data) =>
<HeaderLink href=`/${data}`
class="text-base pt-2.5 px-4 text-neutral-500 hover:text-gray-600 active:text-neutral-900"
>{data.toUpperCase()}</HeaderLink>)
}
</ul>
</div>
</nav>
<div id="menu-body" data-hidden={isHidden} class="hidden">
<ul class="flex flex-col items-end font-medium mt-4">
{
LINKS.map((data) =>
<HeaderLink href=`/${data}`
class="text-lg py-2.5 px-4 text-black decoration-0 hover:text-gray-600"
>{data.toUpperCase()}</HeaderLink>)
}
</ul>
</div>

</header>
4 changes: 3 additions & 1 deletion src/components/HeaderLink.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ const isActive = href === pathname || href === "/" + subpath?.[0]
href={href}
class:list={[
className,
{ "text-lg py-2.5 px-4 text-black font-semibold border-b-4 hover:text-gray-600": isActive },
{
"text-neutral-900 font-semibold hover:text-gray-600 underline underline-offset-8": isActive,
},
]}
{...props}
>
Expand Down
49 changes: 49 additions & 0 deletions src/components/HoverCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from "react"
import * as HoverCard from "@radix-ui/react-hover-card"

interface HoverCardItemProps {
image?: string
alt?: string
title: string
content: string | React.ReactNode
footer?: string | React.ReactNode
trigger: React.ReactNode
}

const HoverCardItem: React.FC<HoverCardItemProps> = ({
trigger,
alt,
title,
content,
footer,
image,
}) => {
return (
<HoverCard.Root openDelay={2}>
<HoverCard.Trigger asChild>
<a className="cursor-pointer" rel="noreferrer noopener">
{trigger}
</a>
</HoverCard.Trigger>
<HoverCard.Portal>
<HoverCard.Content sideOffset={5}>
<div className="bg-white p-5 rounded shadow flex flex-col gap-3.5">
{image && alt && <img className="w-14 h-14 rounded-full" src={image} alt={alt} />}
<div className="flex flex-col gap-3.5">
<p className="font-semibold">{title}</p>
<div>{content}</div>
{footer && (
<div className="flex gap-3.5">
<p>{footer}</p>
</div>
)}
</div>
</div>
<HoverCard.Arrow className="fill-white" />
</HoverCard.Content>
</HoverCard.Portal>
</HoverCard.Root>
)
}

export default HoverCardItem
23 changes: 23 additions & 0 deletions src/components/svg/Circle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from "react"

interface CircleProps {
styling: string
}

const CircleIcon: React.FC<CircleProps> = ({ styling }) => {
return (
<>
<svg
xmlns="http://www.w3.org/2000/svg"
width="48"
height="48"
viewBox="0 0 24 24"
className={styling}
>
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"></path>
</svg>
</>
)
}

export default CircleIcon
Loading

0 comments on commit 953d37d

Please sign in to comment.