sendou.ink/components/common/WeaponImage.tsx
2020-11-08 12:54:36 +02:00

35 lines
675 B
TypeScript

import { useLingui } from "@lingui/react";
import Image from "next/image";
import React from "react";
interface WeaponImageProps {
name: string;
size: 32 | 64 | 128;
noTitle?: boolean;
isInline?: boolean;
}
const WeaponImage: React.FC<WeaponImageProps> = ({
name,
size,
noTitle,
isInline,
}) => {
const { i18n } = useLingui();
return (
<>
<Image
src={`/weapons/${name.replace(".", "")}.png`}
alt={i18n._(name)}
title={noTitle ? undefined : i18n._(name)}
width={size}
height={size}
style={{ display: isInline ? "inline-block" : undefined }}
/>
</>
);
};
export default WeaponImage;