UI: fix reactive RndThumbnail
This commit is contained in:
@@ -100,13 +100,12 @@ interface RndThumbnailProps {
|
|||||||
height?: number;
|
height?: number;
|
||||||
}
|
}
|
||||||
export const RndThumbnail = (props: RndThumbnailProps) => {
|
export const RndThumbnail = (props: RndThumbnailProps) => {
|
||||||
const { name } = props;
|
const seed = () =>
|
||||||
const seed = Array.from(name).reduce(
|
Array.from(props.name).reduce((acc, char) => acc + char.charCodeAt(0), 0); // Seed from name
|
||||||
(acc, char) => acc + char.charCodeAt(0),
|
const imageSrc = () =>
|
||||||
0,
|
generatePatternedImage(seed(), props.width, props.height);
|
||||||
); // Seed from name
|
|
||||||
const imageSrc = generatePatternedImage(seed, props.width, props.height);
|
return <img src={imageSrc()} alt={props.name} />;
|
||||||
return <img src={imageSrc} alt={name} />;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const RndThumbnailShow = () => {
|
export const RndThumbnailShow = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user