feat(board header): add banners, add support to gif banners

This commit is contained in:
plebeius
2025-10-30 22:21:17 +01:00
parent 1d4b3e2d4d
commit 07831cb8b0
4 changed files with 15 additions and 6 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 KiB

+15 -6
View File
@@ -13,15 +13,24 @@ import { shouldShowSnow } from '../../lib/snow';
import Tooltip from '../tooltip';
import _ from 'lodash';
const totalBanners = 1;
const totalBanners = 4;
const ImageBanner = () => {
const [imagePath] = useState(() => {
const randomBannerIndex = Math.floor(Math.random() * totalBanners) + 1;
return `assets/banners/banner-${randomBannerIndex}.jpg`;
});
const [index] = useState(() => Math.floor(Math.random() * totalBanners) + 1);
const jpg = `assets/banners/banner-${index}.jpg`;
const gif = `assets/banners/banner-${index}.gif`;
return <img src={imagePath} alt='' />;
return (
<img
src={jpg}
alt=''
onError={(e) => {
const img = e.currentTarget;
img.onerror = null;
img.src = gif;
}}
/>
);
};
const BoardHeader = () => {