diff --git a/frontend/components/BlueLink.tsx b/frontend/components/BlueLink.tsx new file mode 100644 index 0000000..706ebe4 --- /dev/null +++ b/frontend/components/BlueLink.tsx @@ -0,0 +1,14 @@ +import Link from "next/link"; + +export type Props = { + to: string; + children?: React.ReactNode; +}; + +export default function BlueLink({ to, children }: Props) { + return ( + + {children} + + ); +} diff --git a/frontend/components/Card.tsx b/frontend/components/Card.tsx new file mode 100644 index 0000000..92189ff --- /dev/null +++ b/frontend/components/Card.tsx @@ -0,0 +1,28 @@ +import React, { ReactNode } from "react"; + +export type Props = { + children?: ReactNode | undefined; + title: string; + draggable?: boolean; + footer?: ReactNode | undefined; +}; + +export default function Card({ title, draggable, children, footer }: Props) { + return ( +
+

+ {title} +

+
{children}
+ {footer && ( +
+ {footer} +
+ )} +
+ ); +} diff --git a/frontend/components/FieldCard.tsx b/frontend/components/FieldCard.tsx new file mode 100644 index 0000000..29711ea --- /dev/null +++ b/frontend/components/FieldCard.tsx @@ -0,0 +1,64 @@ +import { + HeartFill, + HandThumbsUp, + HandThumbsDown, + People, + EmojiLaughing, +} from "react-bootstrap-icons"; +import BlueLink from "./BlueLink"; + +import Card from "./Card"; +import type { Field } from "../lib/types"; + +function linkPronoun(input: string) { + if (input.includes(" ") || input.split("/").length !== 5) + return {input}; + + const [sub, obj, possDet, possPro, reflexive] = input.split("/"); + + return ( + + + {sub}/{obj}/{possDet} + + + ); +} + +export default function FieldCard({ + field, + draggable, +}: { + field: Field; + draggable?: boolean; +}) { + return ( + + {field.favourite?.map((entry) => ( +

+ {linkPronoun(entry)} +

+ ))} + {field.okay?.length !== 0 && ( +

+ {field.okay!.join(", ")} +

+ )} + {field.jokingly?.length !== 0 && ( +

+ {field.jokingly!.join(", ")} +

+ )} + {field.friends_only?.length !== 0 && ( +

+ {field.friends_only!.join(", ")} +

+ )} + {field.avoid?.length !== 0 && ( +

+ {field.avoid!.join(", ")} +

+ )} +
+ ); +} diff --git a/frontend/components/Navigation.tsx b/frontend/components/Navigation.tsx index 5463b8a..9f29cfc 100644 --- a/frontend/components/Navigation.tsx +++ b/frontend/components/Navigation.tsx @@ -72,8 +72,10 @@ export default function Navigation() {
- - + + + +