diff --git a/web/src/components/Avatar.tsx b/web/src/components/Avatar.tsx new file mode 100644 index 0000000..9526206 --- /dev/null +++ b/web/src/components/Avatar.tsx @@ -0,0 +1,27 @@ +interface AvatarProps { + url?: string; + name: string; + size?: number; +} + +export default function Avatar({ url, name, size = 24 }: AvatarProps) { + const style = { width: size, height: size }; + if (url) { + return ( + + ); + } + return ( +
+ {name.charAt(0) || "?"} +
+ ); +} diff --git a/web/src/components/PinnedList.tsx b/web/src/components/PinnedList.tsx index 9bd0bdf..0f531c2 100644 --- a/web/src/components/PinnedList.tsx +++ b/web/src/components/PinnedList.tsx @@ -23,6 +23,8 @@ export default function PinnedList({ pins }: PinnedListProps) { to={`/bbs/${entry.handle}`} name={entry.name} description={entry.handle} + avatar={entry.avatar} + showAvatar /> ))} {shown < pins.length && ( diff --git a/web/src/components/nav/ListLink.tsx b/web/src/components/nav/ListLink.tsx index 7e5f53a..e000538 100644 --- a/web/src/components/nav/ListLink.tsx +++ b/web/src/components/nav/ListLink.tsx @@ -1,23 +1,35 @@ import { Link } from "react-router-dom"; +import Avatar from "../Avatar"; interface ListLinkProps { to: string; name: string; description?: string; + avatar?: string; + showAvatar?: boolean; } -export default function ListLink({ to, name, description }: ListLinkProps) { +export default function ListLink({ + to, + name, + description, + avatar, + showAvatar, +}: ListLinkProps) { return ( - {name} - {description && ( - - {description} - - )} + {showAvatar && } +
+ {name} + {description && ( + + {description} + + )} +
); }