feat(frontend): add flags to user page
This commit is contained in:
parent
f539902711
commit
dc18ab60d2
10 changed files with 68 additions and 5 deletions
34
Foxnouns.Frontend/app/components/profile/StatusIcon.tsx
Normal file
34
Foxnouns.Frontend/app/components/profile/StatusIcon.tsx
Normal file
|
@ -0,0 +1,34 @@
|
|||
import { CustomPreference, defaultPreferences, mergePreferences } from "~/lib/api/user";
|
||||
import { OverlayTrigger, Tooltip } from "react-bootstrap";
|
||||
import Icon from "~/components/KeyedIcon";
|
||||
|
||||
export default function StatusIcon({
|
||||
preferences,
|
||||
status,
|
||||
}: {
|
||||
preferences: Record<string, CustomPreference>;
|
||||
status: string;
|
||||
}) {
|
||||
const mergedPrefs = mergePreferences(preferences);
|
||||
const currentPref = status in mergedPrefs ? mergedPrefs[status] : defaultPreferences.missing;
|
||||
|
||||
const id = crypto.randomUUID();
|
||||
return (
|
||||
<>
|
||||
<OverlayTrigger
|
||||
key={id}
|
||||
placement="top"
|
||||
overlay={
|
||||
<Tooltip id={id} aria-hidden={true}>
|
||||
{currentPref.tooltip}
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
<span className="d-inline-block">
|
||||
<Icon iconName={currentPref.icon} aria-hidden={true} style={{ pointerEvents: "none" }} />
|
||||
</span>
|
||||
</OverlayTrigger>
|
||||
<span className="visually-hidden">{currentPref.tooltip}:</span>
|
||||
</>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue