diff --git a/src/components/courses/course-card.tsx b/src/components/courses/course-card.tsx new file mode 100644 index 0000000..a51956d --- /dev/null +++ b/src/components/courses/course-card.tsx @@ -0,0 +1,57 @@ +import { Show } from "solid-js"; +import { Link } from "@tanstack/solid-router"; +import type { Course } from "@/api/client"; +import { Badge } from "@/components/ui/badge"; +import { IconBook, IconChevronRight, IconUsers } from "@/components/ui/icons"; +import { personLabel } from "@/lib/person"; + +export function CourseCard(props: { + course: Course; + term: string; + enrolled?: boolean; + labels: { + capacity: string; + enrolled: string; + kind: string; + }; +}) { + const teachers = () => [props.course.creator, ...(props.course.teachers ?? [])] + .filter((person, index, all) => all.findIndex((row) => row.id === person.id) === index); + + return ( + +
+ + + +
+
+

{props.course.title}

+ {props.labels.kind} + {props.labels.enrolled} +
+

{props.course.description || "—"}

+
+ {props.term} + + + {teachers().map(personLabel).join(", ")} + +
+
+
+ +
+
+

{props.labels.capacity}

+

{props.course.capacity ?? "—"}

+
+ +
+ + ); +} diff --git a/src/components/ui/data-toolbar.tsx b/src/components/ui/data-toolbar.tsx index 461d980..48ce5dc 100644 --- a/src/components/ui/data-toolbar.tsx +++ b/src/components/ui/data-toolbar.tsx @@ -10,14 +10,15 @@ export function DataToolbar(props: { onSearchInput?: (value: string) => void; filters?: JSX.Element; actions?: JSX.Element; + inline?: boolean; class?: string; }) { const hasSearch = () => props.searchValue !== undefined || props.searchPlaceholder !== undefined || props.onSearchInput !== undefined; return ( -
-
+
+
-
+
{props.filters}
-
{props.actions}
+ +
{props.actions}
+
); } diff --git a/src/components/ui/select.tsx b/src/components/ui/select.tsx index bdfb1f4..12bc55a 100644 --- a/src/components/ui/select.tsx +++ b/src/components/ui/select.tsx @@ -80,12 +80,14 @@ export function DropdownSelect(props: Dropdo ); } -export type SelectProps = ComponentProps<"select">; +export type SelectProps = ComponentProps<"select"> & { + wrapperClass?: string; +}; export function Select(props: SelectProps) { - const [local, rest] = splitProps(props, ["class"]); + const [local, rest] = splitProps(props, ["class", "wrapperClass"]); return ( -
+
setTitle(e.currentTarget.value)} /> -
-
- -