mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
added banners preloader
This commit is contained in:
+10
-1
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Route, Routes } from 'react-router-dom';
|
||||
import { Helmet } from 'react-helmet-async';
|
||||
import Home from './components/Home';
|
||||
@@ -7,6 +7,7 @@ import Thread from './components/Thread';
|
||||
import Catalog from './components/Catalog';
|
||||
import { createGlobalStyle } from 'styled-components';
|
||||
import 'react-tooltip/dist/react-tooltip.css';
|
||||
import preloadImages from './utils/preloadImages';
|
||||
|
||||
export const BoardContext = React.createContext();
|
||||
|
||||
@@ -40,6 +41,14 @@ export default function App() {
|
||||
const [selectedThread, setSelectedThread] = useState('');
|
||||
const [selectedStyle, setSelectedStyle] = useState('Yotsuba');
|
||||
|
||||
|
||||
const imageUrls = Array.from({ length: 14 }, (_, index) => `/assets/banners/banner-${index + 1}.jpg`);
|
||||
|
||||
useEffect(() => {
|
||||
preloadImages([...imageUrls]);
|
||||
}, []);
|
||||
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Helmet>
|
||||
|
||||
Reference in New Issue
Block a user