sendou.ink/app/components/Badge.tsx
Kalle c8ea75ebb6
SQL solution migration to Kysely + getting rid of routes folder (#1530)
* Kysely initial

* Badges initial

* Badge routes migrated

* Badges migrated

* Calendar work

* Fix one type problem

* Calendar work

* findResultsByUserId work

* Calendar reworking finished

* PlusSuggestions work

* Migrated suggestions

* Builds progress

* Migrated builds

* Admin migrated

* Migrate articles

* User search

* Faster getUser

* Selectable/insertable as global

* Refresh prod db script + patronTier index

* identifierToUserId

* updateProfile

* findByIdentifier

* More indexes

* User upsert

* upsertLite

* findAllPlusMembers

* updateResultHighlights

* updateMany

* User finished migration

* Fix types

* Fix PlusVotingResult typing

* PlusVotingRepository WIP

* Migrated resultsByMonthYear

* Migrated plusVotes (done with db. related migrations)

* Plus code to features folder

* Fix TODOs

* Export

* Fix range

* Migrate some user pages

* Move rest user routes

* Move /play

* Map list generator

* Front page

* Move map list generation logic

* Move plus voting logic

* Info

* API

* Adjust TODOs

* theme

* Auth

* Remove TODO
2023-11-04 13:15:36 +02:00

41 lines
787 B
TypeScript

import { badgeUrl } from "~/utils/urls";
import { Image } from "./Image";
export function Badge({
badge,
onClick,
isAnimated,
size,
}: {
badge: { displayName: string; hue?: number | null; code: string };
onClick?: () => void;
isAnimated: boolean;
size: number;
}) {
const commonProps = {
title: badge.displayName,
onClick,
width: size,
height: size,
style: badge.hue ? { filter: `hue-rotate(${badge.hue}deg)` } : undefined,
};
if (isAnimated) {
return (
<img
src={badgeUrl({ code: badge.code, extension: "gif" })}
alt={badge.displayName}
{...commonProps}
/>
);
}
return (
<Image
path={badgeUrl({ code: badge.code })}
alt={badge.displayName}
{...commonProps}
/>
);
}