Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #43 from brown-ccv/staff-cards
Browse files Browse the repository at this point in the history
Staff page and cards
  • Loading branch information
hetd54 authored May 31, 2024
2 parents d4e8c3b + a1ee544 commit 47073c5
Show file tree
Hide file tree
Showing 18 changed files with 200 additions and 4 deletions.
9 changes: 8 additions & 1 deletion public/admin/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,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
Binary file added public/images/david-lindstrom-1-.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/douglasmassey.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/jorgedurand.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/patricia-arias.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/vero.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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>
2 changes: 1 addition & 1 deletion src/consts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const SITE_TITLE = "MMP"
export const SITE_DESCRIPTION = "Mesoamerican Migration Project"

export const LINKS = ["news", "publications", "map", "data", "documentation", "about"]
export const LINKS = ["people", "news", "publications", "map", "data", "documentation", "about"]
15 changes: 14 additions & 1 deletion src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,17 @@ const files = defineCollection({
file: z.string(),
}),
})
export const collections = { news: news, data: files }

const people = defineCollection({
type: "content",
schema: z.object({
type: z.string(),
name: z.string(),
title: z.string(),
avatar: z.string().optional(),
email: z.string().optional(),
phone: z.string().optional(),
address: z.string().optional(),
}),
})
export const collections = { news: news, data: files, people: people }
14 changes: 14 additions & 0 deletions src/content/people/advisor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
type: Leadership
name: David Lindstrom
title: Advisor
avatar: /public/images/david-lindstrom-1-.jpg
org: Brown University
address: |-
206 Maxcy Hall
Providence, Rhode Island 02912-1916
phone: (401) 863-3765
email: [email protected]
startDate: "2024"
endDate: "2024"
---
12 changes: 12 additions & 0 deletions src/content/people/co-director-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
type: Leadership
name: Douglas S. Massey
title: Co-Director
avatar: /public/images/douglasmassey.jpeg
org: Princeton University
address: Princeton, NJ 08544
phone: 609-258-4949
email: [email protected]
startDate: "2024"
endDate: "2024"
---
15 changes: 15 additions & 0 deletions src/content/people/co-director.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
type: Leadership
name: Jorge Durand Arp-Nisen
title: Co-Director
avatar: /public/images/jorgedurand.jpg
org: Universidad de Guadalajara
address: |-
Av. Maestros y Alcalde, Puerta Num. 1
Guadalajara, CP 44269
Jalisco, México
phone: 333-819-3327
email: [email protected]
startDate: "2024"
endDate: "2024"
---
15 changes: 15 additions & 0 deletions src/content/people/data-entry-specialist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
type: Supporting Staff
name: Verónica Lozano
title: Data Entry Specialist
avatar: /public/images/vero.jpg
org: Universidad de Guadalajara
address: |-
Av. Maestros y Alcalde, Puerta Num. 1
Guadalajara, CP 44269
Jalisco, México
phone: 011-52-333-819-3327
email: ""
startDate: "2024"
endDate: "2024"
---
14 changes: 14 additions & 0 deletions src/content/people/professor-and-researcher-sni-nivel-iii.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
type: Advisors
name: M. Patricia Arias
title: Professor and Researcher (SNI nivel III)
avatar: /public/images/patricia-arias.jpg
org: Universidad de Guadalajara
address: |-
Argentina 374. C.P. 44160,
Guadalajara, Jalisco, Mexico
phone: 113-826-1499
email: [email protected]
startDate: "2024"
endDate: "2024"
---
2 changes: 1 addition & 1 deletion src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const { title, description } = Astro.props
<body class="grid grid-cols-1 px-8 md:px-16">
<Header />
<main>
<article>
<article class="max-w-[1000px]">
<div>
<div class="flex flex-col gap-3 pb-6">
<h1 class="title">{title}</h1>
Expand Down
17 changes: 17 additions & 0 deletions src/pages/people.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
import Layout from "../layouts/Layout.astro"
import CardContainer from "../components/CardContainer.astro"
import { getCollection } from "astro:content"
const people = await getCollection("people")
const leadership = people.filter((person) => person.data.type === "Leadership")
const advisors = people.filter((person) => person.data.type === "Advisors")
const support = people.filter((person) => person.data.type === "Supporting Staff")
---

<Layout title="Staff" description="Our Leadership, Advisors, and Staff">
<div class="flex flex-col space-y-28">
<CardContainer title="Leadership" color="text-secondary-blue-500" people={leadership} />
<CardContainer title="Advisors" color="text-primary-500" people={advisors} />
<CardContainer title="Supporting Staff" color="text-secondary-brown-500" people={support} />
</div>
</Layout>
1 change: 1 addition & 0 deletions src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
main {
@apply flex;
@apply flex-col;
@apply items-center;
@apply gap-6;
}

Expand Down

0 comments on commit 47073c5

Please sign in to comment.