fix country flag sizing
Some checks failed
Deploy Website / docker (ubuntu-latest) (push) Has been cancelled

This commit is contained in:
Lee 2024-10-20 13:59:48 +01:00
parent fcb84f820b
commit a0dd1b4601
2 changed files with 11 additions and 4 deletions

@ -8,13 +8,13 @@ type Props = {
export default function CountryFlag({ code, size = 24 }: Props) {
return (
<Tooltip display={<p>{normalizedRegionName(code)}</p>} asChild={false}>
<Tooltip display={<p>{normalizedRegionName(code)}</p>} className={`w-[${size * 2}px] min-w-[${size * 2}px]`}>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
alt="Player Country"
src={`/assets/flags/${code.toLowerCase()}.png`}
width={size * 2}
className={`w-[${size * 2}px] object-contain`}
className={`w-[${size * 2}px] min-w-[${size * 2}px] object-contain`}
/>
</Tooltip>
);

@ -16,16 +16,23 @@ type Props = {
*/
asChild?: boolean;
/**
* The additional class names
*/
className?: string;
/**
* Where the tooltip will be displayed
*/
side?: "top" | "bottom" | "left" | "right";
};
export default function Tooltip({ children, display, asChild = true, side = "top" }: Props) {
export default function Tooltip({ children, display, asChild = true, side = "top", className }: Props) {
return (
<ShadCnTooltip>
<TooltipTrigger asChild={asChild}>{children}</TooltipTrigger>
<TooltipTrigger className={className} asChild={asChild}>
{children}
</TooltipTrigger>
<TooltipContent side={side}>{display}</TooltipContent>
</ShadCnTooltip>
);