UI: fix reactive RndThumbnail

This commit is contained in:
Johannes Kirschbauer
2024-12-10 15:12:19 +01:00
parent 669452be31
commit 4f66d7b89b

View File

@@ -100,13 +100,12 @@ interface RndThumbnailProps {
height?: number;
}
export const RndThumbnail = (props: RndThumbnailProps) => {
const { name } = props;
const seed = Array.from(name).reduce(
(acc, char) => acc + char.charCodeAt(0),
0,
); // Seed from name
const imageSrc = generatePatternedImage(seed, props.width, props.height);
return <img src={imageSrc} alt={name} />;
const seed = () =>
Array.from(props.name).reduce((acc, char) => acc + char.charCodeAt(0), 0); // Seed from name
const imageSrc = () =>
generatePatternedImage(seed(), props.width, props.height);
return <img src={imageSrc()} alt={props.name} />;
};
export const RndThumbnailShow = () => {