aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ProjectCard.astro
blob: 03449a7b1a5fb015eba9b08cc1b71ea5373f9027 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
import Link from '@/components/Link.astro'
import { Badge } from '@/components/ui/badge'
import { formatDate } from '@/lib/utils'
import { Icon } from 'astro-icon/components'
import { Image } from 'astro:assets'
import type { CollectionEntry } from 'astro:content'

interface Props {
  project: CollectionEntry<'projects'>
}

const { project } = Astro.props
---

<div
  class="hover:bg-muted/50 rounded-xl border p-4 transition-colors duration-300 ease-in-out"
>
  <Link
    href={project.data.link}
    class="flex flex-col gap-4 sm:flex-row"
    external
  >
    {
      project.data.image && (
        <div class="w-full sm:max-w-3xs sm:shrink-0">
          <Image
            src={project.data.image}
            alt={project.data.name}
            width={1200}
            height={630}
            class="object-cover"
          />
        </div>
      )
    }
    <div class="grow">
      <h3 class="mb-1 text-lg font-medium">
        {project.data.name}
      </h3>
      <p class="text-muted-foreground mb-2 text-sm">
        {project.data.description}
      </p>
      {
        project.data.startDate && (
          <p class="text-muted-foreground/70 mb-2 flex items-center gap-x-1.5 text-xs">
            <span class="flex items-center gap-x-1.5">
              <Icon name="lucide:calendar" class="size-3" />
              <span>
                {formatDate(project.data.startDate)}
                {project.data.endDate
                  ? ` → ${formatDate(project.data.endDate)}`
                  : ' → Present'}
              </span>
            </span>
          </p>
        )
      }
      {
        project.data.tags && (
          <div class="flex flex-wrap gap-2">
            {project.data.tags.map((tag: string) => (
              <Badge variant="muted">{tag}</Badge>
            ))}
          </div>
        )
      }
    </div>
  </Link>
</div>