mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat(board header): add banners, add support to gif banners
This commit is contained in:
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 |
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user