Skip to content

Commit

Permalink
625 add team to about (#742)
Browse files Browse the repository at this point in the history
* Added Committee & life members to about page

* codegen

* codegen

* removed commented code
  • Loading branch information
AzizPatel786 authored Aug 5, 2024
1 parent f5cb95f commit f1f2ee6
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 3 deletions.
4 changes: 3 additions & 1 deletion client/sanity.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ export default defineConfig({

// Regular document types
S.documentTypeListItem("about-item").title("About Item"),
S.documentTypeListItem("contact-detail").title("Contact Detail")
S.documentTypeListItem("contact-detail").title("Contact Detail"),
S.documentTypeListItem("life-member").title("Life Member"),
S.documentTypeListItem("committee-member").title("Committee Member")
])
}),
// Vision is a tool that lets you query your content with GROQ in the studio
Expand Down
11 changes: 10 additions & 1 deletion client/sanity/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ import { ContactDetailSchema } from "@/models/sanity/ContactDetail/Schema"
import { HomePageSchema } from "@/models/sanity/HomePage/Schema"
import { LodgeInfoSchema } from "@/models/sanity/LodgeInfo/Schema"
import { type SchemaTypeDefinition } from "sanity"
import { CommitteeMemberSchema } from "@/models/sanity/CommitteeMembers/Schema"
import { LifeMemberSchema } from "@/models/sanity/LifeMembers/Schema"

export const schema: { types: SchemaTypeDefinition[] } = {
types: [AboutItemSchema, HomePageSchema, ContactDetailSchema, LodgeInfoSchema]
types: [
AboutItemSchema,
HomePageSchema,
ContactDetailSchema,
LodgeInfoSchema,
CommitteeMemberSchema,
LifeMemberSchema
]
}
44 changes: 44 additions & 0 deletions client/src/app/about/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ import {
AboutItem
} from "@/models/sanity/AboutItem/Utils"
import { sanityQuery } from "../../../sanity/lib/utils"
import {
COMMITTEE_MEMBERS_GROQ_QUERY,
CommitteeMembers
} from "@/models/sanity/CommitteeMembers/Utils"
import {
LIFE_MEMBERS_GROQ_QUERY,
LifeMembers
} from "@/models/sanity/LifeMembers/Utils"
import ExecImage from "@/components/generic/ExecImage/ExecImage"

export const metadata: Metadata = {
title: "About UASC",
Expand All @@ -15,6 +24,10 @@ export const metadata: Metadata = {

const About = async () => {
const aboutItems = await sanityQuery<AboutItem[]>(ABOUT_ITEMS_GROQ_QUERY)
const committeeMembers = await sanityQuery<CommitteeMembers[]>(
COMMITTEE_MEMBERS_GROQ_QUERY
)
const lifeMembers = await sanityQuery<LifeMembers[]>(LIFE_MEMBERS_GROQ_QUERY)

return (
<>
Expand Down Expand Up @@ -43,6 +56,37 @@ const About = async () => {
</div>
)
})}
<h2 className="text-dark-blue-100 my-8 text-center italic">
Committee Members
</h2>
<div className="mx-auto flex w-[80%] flex-wrap justify-center gap-4">
{committeeMembers.map((member) => (
<div
key={member._id}
className="flex-shrink-1 group relative mb-4 flex w-1/3 items-center justify-center overflow-hidden px-2 sm:w-1/4 md:w-1/5 lg:w-1/6"
>
<ExecImage
src={member.imageUrl || ""}
alt={member.name || ""}
title={member.title || ""}
name={member.name || ""}
/>
</div>
))}
</div>
<h2 className="text-dark-blue-100 my-8 text-center italic">
Life Members
</h2>
<div className="mx-auto flex w-[80%] flex-wrap justify-center gap-4">
{lifeMembers.map((member) => (
<div
key={member._id}
className="group relative mb-4 flex w-[150px] flex-shrink-0 items-center justify-center overflow-hidden px-2 sm:w-1/2 md:w-1/3 lg:w-1/5"
>
<p className="text-black">{member.name}</p>
</div>
))}
</div>
</div>
<Footer />
</div>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/generic/ExecImage/ExecImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface ExecImageProps {

const ExecImage: React.FC<ExecImageProps> = ({ src, alt, title, name }) => {
return (
<div className="group relative flex h-[163px] w-[163px] flex-shrink-0 overflow-hidden rounded-[4px]">
<div className="aspect-w-{1} aspect-h-{1} group relative flex w-[100%] flex-shrink-0 overflow-hidden rounded-[4px]">
<Image
src={src}
alt={alt}
Expand Down
32 changes: 32 additions & 0 deletions client/src/models/sanity/CommitteeMembers/Schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { SchemaTypeDefinition, defineField } from "sanity"

export const CommitteeMemberSchema: SchemaTypeDefinition = {
name: "committee-member",
title: "Committee Member",
type: "document",
fields: [
defineField({
name: "name",
title: "Name",
type: "string",
validation: (Rule) => Rule.required()
}),
defineField({
name: "title",
title: "Title",
type: "string",
validation: (Rule) => Rule.required()
}),
defineField({
name: "alt",
title: "Alt",
type: "string",
validation: (Rule) => Rule.required()
}),
defineField({
name: "image",
title: "Image",
type: "image"
})
]
}
10 changes: 10 additions & 0 deletions client/src/models/sanity/CommitteeMembers/Utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const COMMITTEE_MEMBERS_GROQ_QUERY =
`*[_type == "committee-member"]{"imageUrl": image.asset->url, ...} | order(_createdAt asc)` as const

export type CommitteeMembers = {
_id: string
name?: string
title?: string
alt?: string
imageUrl?: string
}
15 changes: 15 additions & 0 deletions client/src/models/sanity/LifeMembers/Schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineField, SchemaTypeDefinition } from "sanity"

export const LifeMemberSchema: SchemaTypeDefinition = {
name: "life-member",
title: "Life Member",
type: "document",
fields: [
defineField({
name: "name",
title: "Name",
type: "string",
validation: (Rule) => Rule.required()
})
]
}
7 changes: 7 additions & 0 deletions client/src/models/sanity/LifeMembers/Utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const LIFE_MEMBERS_GROQ_QUERY =
`*[_type == "life-member"] | order(_createdAt asc)` as const

export type LifeMembers = {
_id: string
name?: string
}

0 comments on commit f1f2ee6

Please sign in to comment.