This commit is contained in:
GokaPek 2023-12-07 16:04:09 +04:00
parent 03bda473ce
commit c4aa7e1f92
5 changed files with 40 additions and 23 deletions

View File

@ -1,5 +1,9 @@
.my-footer { .my-footer {
background-color: #9c9c9c; height: 100px;
height: 32px; background-color: #c03000;
color: #fff; }
.logos {
height: 100px;
width: auto;
} }

View File

@ -1,11 +1,11 @@
import './Footer.css'; import './Footer.css';
const Footer = () => { const Footer = () => {
const year = new Date().getFullYear();
return ( return (
<footer className="my-footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center"> <footer className="my-footer mt-auto d-flex flex-shrink-0 justify-content-center align-items-center w-100">
Автор, {year} <div className="container">
<img className="logos ml-0" src="src/assets/logo.png" alt="Логотип" />
</div>
</footer> </footer>
); );
}; };

View File

@ -35,7 +35,7 @@
font-size: 25px; font-size: 25px;
align-items: center; align-items: center;
} }
.nav-link { .me-auto-link {
text-decoration: none; text-decoration: none;
color: white; color: white;
} }

View File

@ -1,14 +1,19 @@
import { import {
Navbar, Container, Nav, Form, FormControl, Button, Navbar, Container, Nav, Form, FormControl, Button,
} from 'react-bootstrap'; } from 'react-bootstrap';
import './Navigation.css'; import { Link, useLocation } from 'react-router-dom';
import { Link } from 'react-router-dom';
// eslint-disable-next-line import/no-extraneous-dependencies // eslint-disable-next-line import/no-extraneous-dependencies
import { FaSearch } from 'react-icons/fa'; import { FaSearch } from 'react-icons/fa';
import './Navigation.css';
const Header = () => { import PropTypes from 'prop-types';
return (
<Navbar expand='lg' bg='dark' variant='dark' className='my-navbar'> const Navigation = ({ routes }) => {
const location = useLocation();
const pages = routes.filter((route) => Object.prototype.hasOwnProperty.call(route, 'title'));
return (
<Navbar expand='lg' bg='dark' variant='dark' className='my-navbar'>
<Container fluid> <Container fluid>
<Navbar.Brand as={Link} to='/'> <Navbar.Brand as={Link} to='/'>
<img className='logo pb-2' src='src/assets/big-logo.png' alt='Логотип' /> <img className='logo pb-2' src='src/assets/big-logo.png' alt='Логотип' />
@ -27,9 +32,14 @@ const Header = () => {
<FaSearch /> <FaSearch />
</Button> </Button>
</Form> </Form>
<Nav.Link as={Link} to='/favour.html'>Favourite</Nav.Link> <Nav className='me-auto-link' activeKey={location.pathname}>
<Nav.Link as={Link} to='/audio.html'>Audio</Nav.Link> {
<Nav.Link as={Link} to='/comics.html'>Comics</Nav.Link> pages.map((page) =>
<Nav.Link as={Link} key={page.path} eventKey={page.path} to={page.path ?? '/'}>
{page.title}
</Nav.Link>)
}
</Nav>
<Nav.Link as={Link} to='/login.html'> <Nav.Link as={Link} to='/login.html'>
<img id='profile' className='user-photo mt-1 ml-4 mr-3' /> <img id='profile' className='user-photo mt-1 ml-4 mr-3' />
</Nav.Link> </Nav.Link>
@ -37,7 +47,11 @@ const Header = () => {
</Navbar.Collapse> </Navbar.Collapse>
</Container> </Container>
</Navbar> </Navbar>
); );
}; };
export default Header; Navigation.propTypes = {
routes: PropTypes.array,
};
export default Navigation;

View File

@ -16,22 +16,21 @@ const routes = [
index: true, index: true,
path: '/', path: '/',
element: <Page1 />, element: <Page1 />,
title: 'Главная страница',
}, },
{ {
path: '/page2', path: '/page2',
element: <Page2 />, element: <Page2 />,
title: 'Вторая страница', title: 'Favourite',
}, },
{ {
path: '/page3', path: '/page3',
element: <Page3 />, element: <Page3 />,
title: 'Третья страница', title: 'Audio',
}, },
{ {
path: '/page4', path: '/page4',
element: <Page4 />, element: <Page4 />,
title: 'Четвертая страница', title: 'Comics',
}, },
{ {
path: '/page-edit', path: '/page-edit',