diff --git a/package-lock.json b/package-lock.json index e41edc6..fcbe4fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "test-vite", + "name": "frontend-html-test", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "test-vite", + "name": "frontend-html-test", "version": "0.0.0", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.5.1", @@ -24,7 +24,7 @@ "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.5", "sass": "^1.71.0", - "vite": "^5.1.0" + "vite": "^5.1.4" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -4156,9 +4156,9 @@ } }, "node_modules/vite": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.3.tgz", - "integrity": "sha512-UfmUD36DKkqhi/F75RrxvPpry+9+tTkrXfMNZD+SboZqBCMsxKtO52XeGzzuh7ioz+Eo/SYDBbdb0Z7vgcDJew==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.4.tgz", + "integrity": "sha512-n+MPqzq+d9nMVTKyewqw6kSt+R3CkvF9QAKY8obiQn8g1fwTscKxyfaYnC632HtBXAQGc1Yjomphwn1dtwGAHg==", "dev": true, "dependencies": { "esbuild": "^0.19.3", diff --git a/package.json b/package.json index 222c1fd..b2e90ab 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,6 @@ "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.5", "sass": "^1.71.0", - "vite": "^5.1.0" + "vite": "^5.1.4" } } diff --git a/src/components/Sidebar/Sidebar.jsx b/src/components/Sidebar/Sidebar.jsx index 0e8dd6b..cf98ea1 100644 --- a/src/components/Sidebar/Sidebar.jsx +++ b/src/components/Sidebar/Sidebar.jsx @@ -2,78 +2,84 @@ import './sidebar.scss'; import React from 'react'; import classnames from 'classnames'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import logo from '../../assets/logo.png' +import logo from '../../assets/logo.png'; +import { useEffect } from 'react' const routes = [ - { title: 'Home', icon: 'fas-solid fa-house', path: '/' }, - { title: 'Sales', icon: 'chart-line', path: '/sales' }, - { title: 'Costs', icon: 'chart-column', path: '/costs' }, - { title: 'Payments', icon: 'wallet', path: '/payments' }, - { title: 'Finances', icon: 'chart-pie', path: '/finances' }, - { title: 'Messages', icon: 'envelope', path: '/messages' }, + { title: 'Home', icon: 'fas-solid fa-house', path: '/' }, + { title: 'Sales', icon: 'chart-line', path: '/sales' }, + { title: 'Costs', icon: 'chart-column', path: '/costs' }, + { title: 'Payments', icon: 'wallet', path: '/payments' }, + { title: 'Finances', icon: 'chart-pie', path: '/finances' }, + { title: 'Messages', icon: 'envelope', path: '/messages' }, ]; const bottomRoutes = [ - { title: 'Settings', icon: 'sliders', path: '/settings' }, - { title: 'Support', icon: 'phone-volume', path: '/support' }, + { title: 'Settings', icon: 'sliders', path: '/settings' }, + { title: 'Support', icon: 'phone-volume', path: '/support' }, ]; export default class Sidebar extends React.Component { - constructor(props) { - super(props); - this.state = { - isOpened: true, - }; + componentDidUpdate(prevProps, prevState) { + if (prevState.isOpened !== this.state.isOpened) { + console.log('Состояние isOpened изменилось:', this.state.isOpened); } + } - toggleSidebar = () => { - this.setState((state) => ({ isOpened: !state.isOpened }) ); - }; + constructor(props) { + super(props); - goToRoute = (path) => { - console.log(`going to "${path}"`); + this.state = { + isOpened: true, }; + } + + toggleSidebar = () => { + this.setState((state) => ({ isOpened: !state.isOpened })); + }; - render() { - const { isOpened } = this.state; - const containerClassnames = classnames('sidebar', { opened: isOpened }); + goToRoute = (path) => { + console.log(`going to "${path}"`); + }; - return ( -