Skip to content

Commit

Permalink
Add project photo caption
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdinandsalis committed Oct 26, 2024
1 parent 22f1210 commit 68f546a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/routes/_index/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ function TestimonialCard({ idx, ...entry }: TestimonialCardProps) {
<p className="font-bold text-primary md:text-body-md">
{entry.name}
{' '}
<span className="align-super font-bold text-secondary">
<span className="font-greek align-super font-bold text-secondary">
{alphabetMap[entry.year?.letter ?? '']}
</span>{' '}
</p>
Expand Down
2 changes: 1 addition & 1 deletion app/routes/aktuelles/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function YearCard({ letter, startedAt, mentor, photos, plan }: Year) {
className="flex flex-wrap rounded-md bg-card shadow-md"
>
<div className="relative flex flex-1 flex-col p-6">
<div className="text-1xl absolute right-14 top-10 scale-[7] font-black lowercase text-primary opacity-10">
<div className="text-1xl font-greek absolute right-14 top-10 scale-[7] font-black lowercase text-primary opacity-10">
{alphabetMap[letter]}
</div>

Expand Down
44 changes: 30 additions & 14 deletions app/routes/curriculum/route.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useLoaderData } from '@remix-run/react'
import { InfoIcon } from 'lucide-react'

Check warning on line 2 in app/routes/curriculum/route.tsx

View workflow job for this annotation

GitHub Actions / ⬣ EsLint

'InfoIcon' is defined but never used. Allowed unused vars must match /^ignored/u
import React from 'react'
import {
Carousel,
Expand Down Expand Up @@ -50,11 +51,20 @@ function YearSection({
year: {
title: string
description: string
projects: any[]
projects: { _id: string; name: string; photos: any[] }[]
externalExams: string[]
}
yearNumber: number
}) {
const photos = React.useMemo(() => {
return year.projects.flatMap(p => {
if (p.photos && p.photos.length > 0) {
return p.photos.map(photo => ({ ...photo, projectName: p.name }))
}
return []
})
}, [year.projects])

return (
<article className="space-y-8 pt-4">
<hgroup>
Expand All @@ -72,9 +82,7 @@ function YearSection({
<ProjectsList projects={year.projects} />
<ExternalExamsList exams={year.externalExams} />
</div>
<div>
<YearCarousel photos={year.projects.flatMap(p => p.photos)} />
</div>
<div>{year.projects.length > 0 && <YearCarousel photos={photos} />}</div>
</article>
)
}
Expand All @@ -90,7 +98,7 @@ function ProjectsList({
Projekte
</h2>
<ul className="list-inside list-disc" aria-label="Projekte">
{projects?.map(project => <li key={project._id}>{project.name}</li>)}
{projects?.map(project => <li key={project.name}>{project.name}</li>)}
</ul>
</div>
)
Expand Down Expand Up @@ -127,17 +135,25 @@ function YearCarousel({ photos }: { photos: any[] }) {
{photos?.map(photo =>
photo?.asset ? (
<CarouselItem
key={photo._key}
key={photo._id}
className="pl-2 sm:basis-1/2 md:basis-1/3"
>
<img
src={urlFor(photo)
.height(512)
.width(512)
.format('webp')
.url()}
className="rounded object-cover shadow"
/>
<div className="group relative overflow-hidden rounded">
<img
src={urlFor(photo)
.height(512)
.width(512)
.format('webp')
.url()}
className="rounded object-cover shadow"
/>
<div className="absolute bottom-0 left-0 right-0 flex appearance-none items-center justify-start gap-1 bg-black/10 p-1.5 px-3 font-condensed">
<span className="text-xs text-card drop-shadow">
{photo.projectName}
{photo.caption ? `, ${photo.caption}` : ''}
</span>
</div>
</div>
</CarouselItem>
) : null,
)}
Expand Down
2 changes: 1 addition & 1 deletion app/sanity/schema/year.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const ALPHABET: GreekLetter[] = [
{ name: 'xi', symbol: 'ξ' },
{ name: 'omikron', symbol: 'ο' },
{ name: 'pi', symbol: 'π' },
{ name: 'hho', symbol: 'ρ' },
{ name: 'rho', symbol: 'ρ' },
{ name: 'sigma', symbol: 'σ' },
{ name: 'tau', symbol: 'τ' },
{ name: 'ypsilon', symbol: 'υ' },
Expand Down
7 changes: 7 additions & 0 deletions app/utils/extended-theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ export const extendedTheme = {
fontFamily: {
sans: ['Museo Sans', 'Museo Sans Fallback'],
condensed: ['Museo Sans Condensed', 'Museo Sans Condensed Fallback'],
greek: [
'Segoe UI',
'Helvetica Neue',
'Arial Unicode MS',
'Lucida Grande',
'sans-serif',
],
},
fontSize: {
// 1rem = 16px
Expand Down

0 comments on commit 68f546a

Please sign in to comment.