Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Frontend/app/components/AnnouncementsList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Announcement } from "~/types/Announcement";
import AnnouncementTile from "./Tiles/AnnouncementTile";

type AnnouncementsListProps = {
announcements: Announcement[];
};

export default function AnnouncementsList({
announcements,
}: AnnouncementsListProps) {
return (
<div className="flex flex-col gap-5">
{announcements.map((announcement) => (
<AnnouncementTile key={announcement.id} announcement={announcement} />
))}
</div>
);
}
40 changes: 40 additions & 0 deletions Frontend/app/components/Tiles/AnnouncementTile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Calendar, Megaphone } from "lucide-react";
import type { Announcement } from "~/types/Announcement";
import { formatDate } from "~/util/date.util";
import { cn } from "~/util/tailwind.util";
import Tile from "./Tile";

type AnnouncementTileProps = {
announcement: Announcement;
className?: string;
};

export default function AnnouncementTile({
announcement,
className,
}: AnnouncementTileProps) {
return (
<Tile className={cn("rounded-2xl border border-gray-200", className)}>
{/* Title and date */}
<div className="flex w-full justify-between">
<p className="mb-2">{announcement.title}</p>
<p className="flex gap-1 text-sm text-nowrap text-gray-600">
<Calendar className="h-5" />
{formatDate(announcement.date, "defaultDate")}
</p>
</div>

{/* Announcement content */}
<p className="text-gray-600">{announcement.announcement}</p>

{/* Divider */}
<div className="my-2 h-[0.5px] w-full bg-gray-200" />

{/* Announcer */}
<p className="flex items-center gap-2 text-gray-600">
<Megaphone className="h-5" />
{announcement.announcer}
</p>
</Tile>
);
}
15 changes: 15 additions & 0 deletions Frontend/app/components/Tiles/Tile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { ReactNode } from "react";
import { cn } from "~/util/tailwind.util";

type TileProps = {
className?: string;
children?: ReactNode;
};

export default function Tile({ className, children }: TileProps) {
return (
<div className={cn("box-border rounded-2xl p-5", className)}>
{children}
</div>
);
}
7 changes: 7 additions & 0 deletions Frontend/app/types/Announcement.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export type Announcement = {
id: number;
announcer: string;
title: string;
date: Date;
announcement: string;
};
Comment on lines +1 to +7
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deze shit komt uiteindelijk uit de backend toch? Dan kan je beter eerst even de backend afbouwen zodat we het via heyapi kunnen genereren

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, maar ik ben met de backend aan het wachten op een PR die open staat :)

6 changes: 6 additions & 0 deletions Frontend/app/util/tailwind.util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import clsx, { type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: ClassValue[]): string {
return twMerge(clsx(inputs));
}
Loading