diff --git a/package-lock.json b/package-lock.json index 37be403..61d0e10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "react-infinite-scroll-component": "^6.1.0", "react-router-dom": "^6.4.2", "react-scripts": "5.0.1", + "react-top-loading-bar": "^2.3.1", "web-vitals": "^2.1.4" } }, @@ -14123,6 +14124,17 @@ } } }, + "node_modules/react-top-loading-bar": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/react-top-loading-bar/-/react-top-loading-bar-2.3.1.tgz", + "integrity": "sha512-rQk2Nm+TOBrM1C4E3e6KwT65iXyRSgBHjCkr2FNja1S51WaPulRA5nKj/xazuQ3x89wDDdGsrqkqy0RBIfd0xg==", + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "react": "^16 || ^17 || ^18" + } + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -26768,6 +26780,12 @@ "workbox-webpack-plugin": "^6.4.1" } }, + "react-top-loading-bar": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/react-top-loading-bar/-/react-top-loading-bar-2.3.1.tgz", + "integrity": "sha512-rQk2Nm+TOBrM1C4E3e6KwT65iXyRSgBHjCkr2FNja1S51WaPulRA5nKj/xazuQ3x89wDDdGsrqkqy0RBIfd0xg==", + "requires": {} + }, "read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", diff --git a/package.json b/package.json index 28b3872..c238daf 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "react-infinite-scroll-component": "^6.1.0", "react-router-dom": "^6.4.2", "react-scripts": "5.0.1", + "react-top-loading-bar": "^2.3.1", "web-vitals": "^2.1.4" }, "scripts": { diff --git a/src/App.js b/src/App.js index 552e4ea..67d60af 100644 --- a/src/App.js +++ b/src/App.js @@ -3,6 +3,8 @@ import './App.css'; import React, { Component } from 'react' import NavBar from './components/NavBar'; import News from './components/News'; +import LoadingBar from 'react-top-loading-bar' + import { BrowserRouter as Router, @@ -12,21 +14,33 @@ import { export default class App extends Component { - pageSize = 8 + pageSize = 8 ; + + state = {progress: 0} + + setProgress = (progress) => { + this.setState({progress: progress}) + } + render() { return (