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) { export default function CountryFlag({ code, size = 24 }: Props) {
return ( 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 */} {/* eslint-disable-next-line @next/next/no-img-element */}
<img <img
alt="Player Country" alt="Player Country"
src={`/assets/flags/${code.toLowerCase()}.png`} src={`/assets/flags/${code.toLowerCase()}.png`}
width={size * 2} width={size * 2}
className={`w-[${size * 2}px] object-contain`} className={`w-[${size * 2}px] min-w-[${size * 2}px] object-contain`}
/> />
</Tooltip> </Tooltip>
); );

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