all lab4
This commit is contained in:
parent
7f4b4105e8
commit
0647d060bb
25
lab4/all/.eslintrc.cjs
Normal file
25
lab4/all/.eslintrc.cjs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
env: { browser: true, es2020: true },
|
||||||
|
extends: [
|
||||||
|
'airbnb-base',
|
||||||
|
'plugin:react/recommended',
|
||||||
|
'plugin:react/jsx-runtime',
|
||||||
|
'plugin:react-hooks/recommended',
|
||||||
|
],
|
||||||
|
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
||||||
|
parserOptions: { ecmaVersion: 12, sourceType: 'module' },
|
||||||
|
settings: { react: { version: '18.2' } },
|
||||||
|
plugins: ['react-refresh'],
|
||||||
|
rules: {
|
||||||
|
'react-refresh/only-export-components': [
|
||||||
|
'warn',
|
||||||
|
{ allowConstantExport: true },
|
||||||
|
],
|
||||||
|
'linebreak-style': 'off', /**/
|
||||||
|
'indent': 'off',
|
||||||
|
'no-console': 'off',
|
||||||
|
'arrow-body-style': 'off',
|
||||||
|
'implicit-arrow-linebreak': 'off',
|
||||||
|
},
|
||||||
|
}
|
24
lab4/all/.gitignore
vendored
Normal file
24
lab4/all/.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
8
lab4/all/README.md
Normal file
8
lab4/all/README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# React + Vite
|
||||||
|
|
||||||
|
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||||
|
|
||||||
|
Currently, two official plugins are available:
|
||||||
|
|
||||||
|
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
||||||
|
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
BIN
lab4/all/images/Book.png
Normal file
BIN
lab4/all/images/Book.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 396 KiB |
BIN
lab4/all/images/Tolstoy.png
Normal file
BIN
lab4/all/images/Tolstoy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 183 KiB |
BIN
lab4/all/images/WarAndPeace.png
Normal file
BIN
lab4/all/images/WarAndPeace.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 MiB |
BIN
lab4/all/images/woman.png
Normal file
BIN
lab4/all/images/woman.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 833 KiB |
15
lab4/all/index.html
Normal file
15
lab4/all/index.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Library</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="root" class="h-100 d-flex flex-column"></div>
|
||||||
|
<script type="module" src="/src/main.jsx"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
4344
lab4/all/package-lock.json
generated
Normal file
4344
lab4/all/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
32
lab4/all/package.json
Normal file
32
lab4/all/package.json
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"name": "lec4",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0",
|
||||||
|
"react-router-dom": "^6.18.0",
|
||||||
|
"bootstrap": "^5.3.2",
|
||||||
|
"react-bootstrap": "^2.9.1",
|
||||||
|
"react-bootstrap-icons": "^1.10.3",
|
||||||
|
"prop-types": "^15.8.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/react": "^18.2.15",
|
||||||
|
"@types/react-dom": "^18.2.7",
|
||||||
|
"@vitejs/plugin-react": "^4.0.3",
|
||||||
|
"eslint": "^8.45.0",
|
||||||
|
"eslint-config-airbnb-base": "^15.0.0",
|
||||||
|
"eslint-plugin-react": "^7.32.2",
|
||||||
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
|
"eslint-plugin-react-refresh": "^0.4.3",
|
||||||
|
"vite": "^4.4.5"
|
||||||
|
}
|
||||||
|
}
|
3
lab4/all/public/icon.svg
Normal file
3
lab4/all/public/icon.svg
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-book" viewBox="0 0 16 16">
|
||||||
|
<path d="M1 2.828c.885-.37 2.154-.769 3.388-.893 1.33-.134 2.458.063 3.112.752v9.746c-.935-.53-2.12-.603-3.213-.493-1.18.12-2.37.461-3.287.811zm7.5-.141c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 0 0 0 2.5v11a.5.5 0 0 0 .707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 0 0 .78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0 0 16 13.5v-11a.5.5 0 0 0-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 770 B |
107
lab4/all/src/App.css
Normal file
107
lab4/all/src/App.css
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
.Window{
|
||||||
|
background-color: #A07A54;
|
||||||
|
margin: auto ;
|
||||||
|
min-width: 30vw;
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 610px) {
|
||||||
|
.Window{
|
||||||
|
margin-bottom: 3rem;
|
||||||
|
margin-left: 2rem;
|
||||||
|
margin-right: 2rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.a-main:link, .a-main:active, .a-main:hover{
|
||||||
|
text-decoration: none;
|
||||||
|
color: #212529;
|
||||||
|
}
|
||||||
|
a{
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
body{
|
||||||
|
background-color: #FFEBCD;
|
||||||
|
}
|
||||||
|
.section-name{
|
||||||
|
background-color: #A07A54;
|
||||||
|
border-top-left-radius: 30px;
|
||||||
|
border-top-right-radius: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 575px) {
|
||||||
|
.section-name{
|
||||||
|
width: 70vw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 340px) {
|
||||||
|
.section-name{
|
||||||
|
width: 50vw;
|
||||||
|
font-size: medium;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 190px) {
|
||||||
|
.section-name{
|
||||||
|
width: 40vw;
|
||||||
|
font-size: small;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.form-control, .form-control:focus, .form-select, .form-select:focus{
|
||||||
|
background-color: #fcf0dc;
|
||||||
|
border-color: #212529;
|
||||||
|
border-width: 3px;
|
||||||
|
box-shadow: none;
|
||||||
|
font-size: large;
|
||||||
|
padding: auto;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
.form-label{
|
||||||
|
font-family: Arial;
|
||||||
|
color: dark;
|
||||||
|
}
|
||||||
|
button{
|
||||||
|
background-color: #613E2B;
|
||||||
|
color: #FFEBCD;
|
||||||
|
}
|
||||||
|
.registerPanel{
|
||||||
|
max-width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.bookPanel{
|
||||||
|
background-color: #D2B48C;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.book-name{
|
||||||
|
background-color: #A07A54;
|
||||||
|
border-bottom-left-radius: 30px;
|
||||||
|
border-bottom-right-radius: 30px;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
margin-top: -48px;
|
||||||
|
}
|
||||||
|
.book-text{
|
||||||
|
background-color: #A07A54;
|
||||||
|
border-bottom-left-radius: 30px;
|
||||||
|
border-bottom-right-radius: 30px;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 250px) {
|
||||||
|
.book-name{
|
||||||
|
font-size: small;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.mini{
|
||||||
|
max-height: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.table-striped th, tr, td{
|
||||||
|
background-color: #A07A54 !important;
|
||||||
|
border-color: #A07A54;
|
||||||
|
font-size: large;
|
||||||
|
}
|
24
lab4/all/src/App.jsx
Normal file
24
lab4/all/src/App.jsx
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { Container } from 'react-bootstrap';
|
||||||
|
import { Outlet } from 'react-router-dom';
|
||||||
|
import './App.css';
|
||||||
|
import Footer from './components/footer/Footer.jsx';
|
||||||
|
import Navigation from './components/navigation/Navigation.jsx';
|
||||||
|
|
||||||
|
const App = ({ routes }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Navigation routes={routes}></Navigation>
|
||||||
|
<Container className='' as="main" fluid>
|
||||||
|
<Outlet />
|
||||||
|
</Container>
|
||||||
|
<Footer />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
App.propTypes = {
|
||||||
|
routes: PropTypes.array,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default App;
|
3
lab4/all/src/components/authorBooksPanel/BooksPanel.css
Normal file
3
lab4/all/src/components/authorBooksPanel/BooksPanel.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.bookPanel{
|
||||||
|
background-color: #D2B48C;
|
||||||
|
}
|
17
lab4/all/src/components/authorBooksPanel/BooksPanel.jsx
Normal file
17
lab4/all/src/components/authorBooksPanel/BooksPanel.jsx
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import './BooksPanel.css';
|
||||||
|
import Book from '../bookCard/Book.jsx';
|
||||||
|
|
||||||
|
const BooksPanel = () => {
|
||||||
|
return (
|
||||||
|
<div className="bookPanel row mx-4 pt-4 border border-5 border-dark rounded-5 mb-5">
|
||||||
|
<Book />
|
||||||
|
<Book />
|
||||||
|
<Book />
|
||||||
|
<Book />
|
||||||
|
<Book />
|
||||||
|
<Book />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default BooksPanel;
|
4
lab4/all/src/components/bookCard/Book.css
Normal file
4
lab4/all/src/components/bookCard/Book.css
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.a-main:link, .a-main:active, .a-main:hover{
|
||||||
|
text-decoration: none;
|
||||||
|
color: #212529;
|
||||||
|
}
|
16
lab4/all/src/components/bookCard/Book.jsx
Normal file
16
lab4/all/src/components/bookCard/Book.jsx
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import './Book.css';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
const Book = () => {
|
||||||
|
return (
|
||||||
|
<Link className="a-main col-lg-2 col-md-4 col-sm-6 text-center" to="/BookPage">
|
||||||
|
<div className="text-center border border-4 border-dark">
|
||||||
|
<img src="images/WarAndPeace.png" className="img-fluid" alt="Responsive image"></img>
|
||||||
|
</div>
|
||||||
|
<h3>Book Name</h3>
|
||||||
|
<h3>Author</h3>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Book;
|
3
lab4/all/src/components/footer/Footer.css
Normal file
3
lab4/all/src/components/footer/Footer.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.my-footer{
|
||||||
|
background-color: #A07A54;
|
||||||
|
}
|
13
lab4/all/src/components/footer/Footer.jsx
Normal file
13
lab4/all/src/components/footer/Footer.jsx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import './Footer.css';
|
||||||
|
|
||||||
|
const Footer = () => {
|
||||||
|
const year = new Date().getFullYear();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<footer className="my-footer border border-dark border-5 mt-auto d-flex flex-shrink-0 justify-content-center align-items-center fs-5">
|
||||||
|
<b>Барсуков Павел, {year}</b>
|
||||||
|
</footer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Footer;
|
12
lab4/all/src/components/mainBooksPanel/BooksPanel.css
Normal file
12
lab4/all/src/components/mainBooksPanel/BooksPanel.css
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
.Window{
|
||||||
|
background-color: #A07A54;
|
||||||
|
margin: auto ;
|
||||||
|
min-width: 30vw;
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 610px) {
|
||||||
|
.Window{
|
||||||
|
margin-bottom: 3rem;
|
||||||
|
margin-left: 2rem;
|
||||||
|
margin-right: 2rem;
|
||||||
|
}
|
||||||
|
}
|
17
lab4/all/src/components/mainBooksPanel/BooksPanel.jsx
Normal file
17
lab4/all/src/components/mainBooksPanel/BooksPanel.jsx
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import './BooksPanel.css';
|
||||||
|
import Book from '../bookCard/Book.jsx';
|
||||||
|
|
||||||
|
const BooksPanel = () => {
|
||||||
|
return (
|
||||||
|
<div className="window row mx-4 pt-4 border border-5 border-dark rounded-5">
|
||||||
|
<Book />
|
||||||
|
<Book />
|
||||||
|
<Book />
|
||||||
|
<Book />
|
||||||
|
<Book />
|
||||||
|
<Book />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default BooksPanel;
|
15
lab4/all/src/components/navigation/Navigation.css
Normal file
15
lab4/all/src/components/navigation/Navigation.css
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
.my-header{
|
||||||
|
background-color: #A07A54;
|
||||||
|
}
|
||||||
|
.navbar-text{
|
||||||
|
color: #212529;
|
||||||
|
font-size: 27px;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginPanel{
|
||||||
|
margin-right: 2 !important;
|
||||||
|
}
|
||||||
|
.NavRight{
|
||||||
|
justify-content: end;
|
||||||
|
}
|
52
lab4/all/src/components/navigation/Navigation.jsx
Normal file
52
lab4/all/src/components/navigation/Navigation.jsx
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { Container, Nav, Navbar } from 'react-bootstrap';
|
||||||
|
import './Navigation.css';
|
||||||
|
import { Link, useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
|
const Navigation = ({ routes }) => {
|
||||||
|
const location = useLocation();
|
||||||
|
const pages = routes.filter((route) => Object.prototype.hasOwnProperty.call(route, 'title'));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<header className='border border-5 border-dark my-header mb-5'>
|
||||||
|
<Navbar className='navbar p-2' expand='md'>
|
||||||
|
<Container fluid>
|
||||||
|
|
||||||
|
<Navbar.Toggle aria-controls='main-navbar' className='m-3'/>
|
||||||
|
<b>
|
||||||
|
<Navbar.Collapse id='main-navbar'>
|
||||||
|
<Nav className='me-5 link' activeKey={location.pathname}>
|
||||||
|
{
|
||||||
|
pages.slice(0, pages.length - 1).map((page) =>
|
||||||
|
<Nav.Link className=' navbar-text' as={Link} key={page.path} eventKey={page.path} to={page.path ?? '/'}>
|
||||||
|
{page.title}
|
||||||
|
</Nav.Link>)
|
||||||
|
}
|
||||||
|
</Nav>
|
||||||
|
|
||||||
|
</Navbar.Collapse>
|
||||||
|
</b>
|
||||||
|
<b>
|
||||||
|
<Navbar.Collapse id='main-navbar-right' className='NavRight'>
|
||||||
|
|
||||||
|
<Nav className='me-5 link loginPanel' activeKey={location.pathname}>
|
||||||
|
<div className='d-flex'>
|
||||||
|
<Nav.Link className=' navbar-text' as={Link} key={pages[pages.length - 1].path} to={pages[pages.length - 1].path ?? '/'}>
|
||||||
|
{pages[pages.length - 1].title}
|
||||||
|
</Nav.Link>
|
||||||
|
</div>
|
||||||
|
</Nav>
|
||||||
|
|
||||||
|
</Navbar.Collapse>
|
||||||
|
</b>
|
||||||
|
</Container>
|
||||||
|
</Navbar >
|
||||||
|
</header>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
Navigation.propTypes = {
|
||||||
|
routes: PropTypes.array,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Navigation;
|
18
lab4/all/src/components/usersBook/UserBook.css
Normal file
18
lab4/all/src/components/usersBook/UserBook.css
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
.Window{
|
||||||
|
background-color: #A07A54;
|
||||||
|
margin: auto ;
|
||||||
|
min-width: 30vw;
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 610px) {
|
||||||
|
.Window{
|
||||||
|
margin-bottom: 3rem;
|
||||||
|
margin-left: 2rem;
|
||||||
|
margin-right: 2rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.mini{
|
||||||
|
max-height: 400px;
|
||||||
|
}
|
||||||
|
.bookPanel{
|
||||||
|
background-color: #D2B48C;
|
||||||
|
}
|
34
lab4/all/src/components/usersBook/UserBook.jsx
Normal file
34
lab4/all/src/components/usersBook/UserBook.jsx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import './UserBook.css';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
const UserBook = () => {
|
||||||
|
return (
|
||||||
|
<div className="bookPanel row mx-4 pt-4 border border-5 border-dark rounded-5 p-2 mb-5">
|
||||||
|
|
||||||
|
<div className="col-lg-3 col-md-4 col-sm-6 text-center mb-4">
|
||||||
|
<Link className="link-dark" to="/BookPage">
|
||||||
|
<div className="text-center">
|
||||||
|
<img src="images/WarAndPeace.png" className="mini border border-4 border-dark" alt="Responsive image"></img>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col-lg-9 col-md-8 col-sm-6">
|
||||||
|
<div className="Window rounded-4 border border-4 border-dark p-2 mx-3">
|
||||||
|
<h1 className="display-2">
|
||||||
|
<Link className="link-dark" to="/BookPage">Title</Link> - <Link className="link-dark" to="/AuthorPage">Author</Link>
|
||||||
|
</h1>
|
||||||
|
<h3>Book description Book description Book description Book description
|
||||||
|
Book description Book description Book description Book description
|
||||||
|
Book description Book description Book description Book description
|
||||||
|
Book description Book description Book description Book description
|
||||||
|
Book description Book description Book description Book description
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default UserBook;
|
0
lab4/all/src/index.css
Normal file
0
lab4/all/src/index.css
Normal file
64
lab4/all/src/main.jsx
Normal file
64
lab4/all/src/main.jsx
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||||
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom/client';
|
||||||
|
import { RouterProvider, createBrowserRouter } from 'react-router-dom';
|
||||||
|
import App from './App.jsx';
|
||||||
|
import './index.css';
|
||||||
|
import MainPage from './pages/MainPage.jsx';
|
||||||
|
import ErrorPage from './pages/ErrorPage.jsx';
|
||||||
|
import LoginPage from './pages/LoginPage.jsx';
|
||||||
|
import BookPage from './pages/BookPage.jsx';
|
||||||
|
import AuthorPage from './pages/AuthorPage.jsx';
|
||||||
|
import TextPage from './pages/TextPage.jsx';
|
||||||
|
import ProfilePage from './pages/ProfilePage.jsx';
|
||||||
|
import AdminPage from './pages/AdminPage.jsx';
|
||||||
|
|
||||||
|
const routes = [
|
||||||
|
{
|
||||||
|
index: true,
|
||||||
|
path: '/MainPage',
|
||||||
|
element: <MainPage />,
|
||||||
|
title: 'Main',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/ProfilePage',
|
||||||
|
element: <ProfilePage />,
|
||||||
|
title: 'Profile',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/LoginPage',
|
||||||
|
element: <LoginPage />,
|
||||||
|
title: 'Log in/ Sign up',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/BookPage',
|
||||||
|
element: <BookPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/AuthorPage',
|
||||||
|
element: <AuthorPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/TextPage',
|
||||||
|
element: <TextPage />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/AdminPage',
|
||||||
|
element: <AdminPage />,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const router = createBrowserRouter([
|
||||||
|
{
|
||||||
|
path: '/',
|
||||||
|
element: <App routes={routes} />,
|
||||||
|
children: routes,
|
||||||
|
errorElement: <ErrorPage />,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||||
|
<React.StrictMode>
|
||||||
|
<RouterProvider router={router} />
|
||||||
|
</React.StrictMode>,
|
||||||
|
);
|
27
lab4/all/src/pages/AdminPage.jsx
Normal file
27
lab4/all/src/pages/AdminPage.jsx
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
const AdminPage = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<main className="container-fluid p-2">
|
||||||
|
<button id="items-add" className="button border border-4 border-dark rounded-4 mb-1 py-2 px-3">Add book</button>
|
||||||
|
<div className="py-3 px-4">
|
||||||
|
<table id="items-table" className="table table-striped border border-4 border-dark">
|
||||||
|
<thead>
|
||||||
|
<th scope="col">№</th>
|
||||||
|
<th scope="col" className="w-25">Genre</th>
|
||||||
|
<th scope="col" className="w-25">Author</th>
|
||||||
|
<th scope="col" className="w-25">Name</th>
|
||||||
|
<th scope="col" className="w-25">Time</th>
|
||||||
|
<th scope="col"></th>
|
||||||
|
<th scope="col"></th>
|
||||||
|
</thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AdminPage;
|
41
lab4/all/src/pages/AuthorPage.jsx
Normal file
41
lab4/all/src/pages/AuthorPage.jsx
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import BooksPanel from '../components/authorBooksPanel/BooksPanel.jsx';
|
||||||
|
|
||||||
|
const AuthorPage = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<main>
|
||||||
|
<div className="bookPanel row mx-4 pt-4 border border-5 border-dark rounded-5 p-2 mb-5">
|
||||||
|
|
||||||
|
<div className="col-lg-3 col-md-4 col-sm-6 text-center mb-4">
|
||||||
|
<div className="text-center">
|
||||||
|
<img src="images/Tolstoy.png" className="img-fluid border border-4 border-dark" alt="Responsive image"></img>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col-lg-9 col-md-8 col-sm-6 ">
|
||||||
|
<div className="Window rounded-4 border border-4 border-dark mt-3 mb-5 mx-3 p-2 text-center">
|
||||||
|
<h2>Author name</h2>
|
||||||
|
</div>
|
||||||
|
<div className="Window rounded-4 border border-4 border-dark p-2 mx-3">
|
||||||
|
<h3>
|
||||||
|
Biography text Biography text Biography text Biography text
|
||||||
|
Biography text Biography text Biography text Biography text
|
||||||
|
Biography text Biography text Biography text Biography text
|
||||||
|
Biography text Biography text Biography text Biography text
|
||||||
|
Biography text Biography text Biography text Biography text
|
||||||
|
Biography text Biography text Biography text Biography text
|
||||||
|
Biography text Biography text Biography text Biography text
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<BooksPanel />
|
||||||
|
</main>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AuthorPage;
|
49
lab4/all/src/pages/BookPage.jsx
Normal file
49
lab4/all/src/pages/BookPage.jsx
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
const BookPage = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<main className='mb-4'>
|
||||||
|
<div className="bookPanel row mx-4 pt-4 border border-5 border-dark rounded-5 p-2 mb-5">
|
||||||
|
|
||||||
|
<div className="col-lg-3 col-md-4 col-sm-6 text-center mb-4">
|
||||||
|
<div className="text-center">
|
||||||
|
<img src="images/WarAndPeace.png" className="img-fluid border border-4 border-dark" alt="Responsive image"></img>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col mt-3" >
|
||||||
|
<Link to="/TextPage">
|
||||||
|
<button className="border border-dark border-5 rounded-4 col-12">
|
||||||
|
<h3 className="mx-3">
|
||||||
|
Read
|
||||||
|
</h3>
|
||||||
|
</button>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col-lg-9 col-md-8 col-sm-6">
|
||||||
|
<div className="Window rounded-4 border border-4 border-dark mb-5 p-2 text-center mt-3 mx-3">
|
||||||
|
<h2>
|
||||||
|
Title - <Link className="link-dark" to="/AuthorPage">Author</Link>
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
<div className="Window rounded-4 border border-4 border-dark p-2 mx-3">
|
||||||
|
<h3>
|
||||||
|
Book description Book description Book description Book description
|
||||||
|
Book description Book description Book description Book description
|
||||||
|
Book description Book description Book description Book description
|
||||||
|
Book description Book description Book description Book description
|
||||||
|
Book description Book description Book description Book description
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default BookPage;
|
19
lab4/all/src/pages/ErrorPage.jsx
Normal file
19
lab4/all/src/pages/ErrorPage.jsx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { Alert, Container } from 'react-bootstrap';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
const ErrorPage = () => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container fluid className="p-2 row justify-content-center">
|
||||||
|
<Container className='col-md-6'>
|
||||||
|
<Alert variant="danger">
|
||||||
|
Страница не найдена
|
||||||
|
</Alert>
|
||||||
|
<button className="button border border-4 border-dark rounded-4 mb-1 py-2 px-3" onClick={() => navigate(-1)}>Назад</button>
|
||||||
|
</Container>
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ErrorPage;
|
87
lab4/all/src/pages/LoginPage.jsx
Normal file
87
lab4/all/src/pages/LoginPage.jsx
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
// import { Link } from 'react-router-dom';
|
||||||
|
import { Form } from 'react-bootstrap';
|
||||||
|
|
||||||
|
const LoginPage = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<main className="Window registerPanel p-4 border border-5 border-dark rounded-5 mt-5">
|
||||||
|
<div className="row mx-2">
|
||||||
|
|
||||||
|
<div className="col-sm">
|
||||||
|
|
||||||
|
<h1 className="text-center">
|
||||||
|
Sign up
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div className="mb-3">
|
||||||
|
<label className="form-label">
|
||||||
|
<b>username:</b>
|
||||||
|
</label>
|
||||||
|
<Form.Control className=" form-control border border-4 border-dark rounded-4" type="text" required></Form.Control>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-3">
|
||||||
|
<label className="form-label">
|
||||||
|
<b>email:</b>
|
||||||
|
</label>
|
||||||
|
<Form.Control className=" form-control border border-4 border-dark rounded-4" type="text" required></Form.Control>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-3">
|
||||||
|
<label className="form-label">
|
||||||
|
<b>password:</b>
|
||||||
|
</label>
|
||||||
|
<Form.Control className=" form-control border border-4 border-dark rounded-4" type="text" required></Form.Control>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-3">
|
||||||
|
<label className="form-label">
|
||||||
|
<b>password confirm:</b>
|
||||||
|
</label>
|
||||||
|
<Form.Control className=" form-control border border-4 border-dark rounded-4" type="text" required></Form.Control>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col">
|
||||||
|
<button className="border border-dark border-5 rounded-4 col-12">
|
||||||
|
<h3 className="mx-3">
|
||||||
|
Register
|
||||||
|
</h3>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col-sm">
|
||||||
|
|
||||||
|
<h1 className="text-center">
|
||||||
|
Log in
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div className="mb-3">
|
||||||
|
<label className="form-label">
|
||||||
|
<b>email:</b>
|
||||||
|
</label>
|
||||||
|
<Form.Control className=" form-control border border-4 border-dark rounded-4" type="text" required></Form.Control>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-3">
|
||||||
|
<label className="form-label">
|
||||||
|
<b>password:</b>
|
||||||
|
</label>
|
||||||
|
<Form.Control className=" form-control border border-4 border-dark rounded-4" type="text" required></Form.Control>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col">
|
||||||
|
<button className=" border border-dark border-5 rounded-4 col-12">
|
||||||
|
<h3 className="mx-3">
|
||||||
|
Login
|
||||||
|
</h3>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LoginPage;
|
22
lab4/all/src/pages/MainPage.jsx
Normal file
22
lab4/all/src/pages/MainPage.jsx
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import BooksPanel from '../components/mainBooksPanel/BooksPanel.jsx';
|
||||||
|
|
||||||
|
const MainPage = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<>
|
||||||
|
<main className="mb-5">
|
||||||
|
<h3 className="section-name text-center col-xs-9 col-sm-6 col-mb-1 col-lg-2 justify-content-center mx-auto mb-0 border border-bottom-0 border-3 border-dark">
|
||||||
|
New:
|
||||||
|
</h3>
|
||||||
|
<BooksPanel />
|
||||||
|
<h3 className="section-name text-center col-xs-9 col-sm-6 col-mb-1 col-lg-2 justify-content-center mx-auto mb-0 mt-5 border border-bottom-0 border-3 border-dark">
|
||||||
|
Popular:
|
||||||
|
</h3>
|
||||||
|
<BooksPanel />
|
||||||
|
</main>
|
||||||
|
</>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default MainPage;
|
32
lab4/all/src/pages/ProfilePage.jsx
Normal file
32
lab4/all/src/pages/ProfilePage.jsx
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import UserBook from '../components/usersBook/UserBook.jsx';
|
||||||
|
|
||||||
|
const ProfilePage = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<main>
|
||||||
|
|
||||||
|
<div className="bookPanel row mb-5 mx-4 mb-5 p-4 border border-5 border-dark rounded-5">
|
||||||
|
|
||||||
|
<div className="col-lg-2 col-md-6 col-sm-12 mb-4">
|
||||||
|
<img src="images/woman.png" className="img-fluid border border-5 border-dark"></img>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col-lg-10 col-md-6 col-sm-12">
|
||||||
|
<div className="Window border border-5 border-dark rounded-5 ">
|
||||||
|
<h1 className="display-1 p-2 ms-3">
|
||||||
|
Username
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<UserBook />
|
||||||
|
<UserBook />
|
||||||
|
|
||||||
|
</main>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ProfilePage;
|
64
lab4/all/src/pages/TextPage.jsx
Normal file
64
lab4/all/src/pages/TextPage.jsx
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
const TextPage = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<main>
|
||||||
|
<div className="d-flex justify-content-center">
|
||||||
|
<div className="book-name d-flex justify-content-center col-5 border border-top-0 border-4 border-dark">
|
||||||
|
<h1 className="">
|
||||||
|
<Link className="link-dark" to="/BookPage">Title</Link>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="Window m-5 border border-5 border-dark rounded-4 p-4">
|
||||||
|
<h2 className="book-text">
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
Book text Book text Book text Book text Book text Book text Book text Book text
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TextPage;
|
13
lab4/all/vite.config.js
Normal file
13
lab4/all/vite.config.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
|
import react from '@vitejs/plugin-react';
|
||||||
|
import { defineConfig } from 'vite';
|
||||||
|
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [react()],
|
||||||
|
build: {
|
||||||
|
sourcemap: true,
|
||||||
|
chunkSizeWarningLimit: 1024,
|
||||||
|
emptyOutDir: true,
|
||||||
|
},
|
||||||
|
});
|
BIN
lab4/Лаб4 отчет.docx
Normal file
BIN
lab4/Лаб4 отчет.docx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user