Samuel Shuert | a42ca96 | 2024-04-27 16:13:23 -0400 | [diff] [blame] | 1 | --- |
| 2 | |
| 3 | import active from '../images/active.svg'; |
| 4 | import wip from '../images/wip.svg'; |
| 5 | import inactive from '../images/inactive.svg'; |
| 6 | |
| 7 | export enum Status { |
| 8 | Active, |
| 9 | Inactive, |
| 10 | WIP |
| 11 | } |
| 12 | |
| 13 | interface Props { |
| 14 | name: string, |
| 15 | url: string, |
| 16 | children: string; |
| 17 | status: Status; |
| 18 | } |
| 19 | |
| 20 | const { name, url, status } = Astro.props; |
| 21 | |
| 22 | let color: string; |
| 23 | let icon: string; |
| 24 | |
| 25 | switch (status) { |
| 26 | case Status.Active: { |
| 27 | color = "bg-green"; |
| 28 | icon = active.src; |
| 29 | break; |
| 30 | } |
| 31 | case Status.WIP: { |
| 32 | color = "bg-yellow"; |
| 33 | icon = wip.src; |
| 34 | break; |
| 35 | } |
| 36 | default: |
| 37 | case Status.Inactive: { |
| 38 | color = "bg-red"; |
| 39 | icon = inactive.src; |
| 40 | break; |
| 41 | } |
| 42 | } |
| 43 | --- |
| 44 | |
| 45 | <a href={url} class="w-72 h-36 flex flex-col rounded-lg p-2 m-2 bg-surface0 shadow-md shadow-crust transition-transform hover:bg-surface1 hover:drop-shadow-md hover:-translate-y-1"> |
| 46 | <div class="flex justify-between mr-1 mb-1 items-end"> |
| 47 | <p class="text-text text-lg">{name}</p> |
| 48 | <img src={icon} alt="cross" class="h-8"/> |
| 49 | </div> |
| 50 | <div class={`h-[2px] w-full mb-1 ${color}`}/> |
| 51 | <p class="text-text text-sm text-ellipsis overflow-hidden"><slot /></p> |
| 52 | </a> |