This commit is contained in:
Mikola
2023-12-15 13:25:44 +03:00
parent 78f796b59d
commit 2aa6cb90f9
69 changed files with 1497 additions and 2047 deletions

View File

@ -1,3 +1,4 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';

View File

@ -1,7 +1,8 @@
import Header from "./components/Header/Header";
import Home from "./pages/Home/Home";
import Auth from "./pages/Auth/Auth"
import Footer from "./components/Footer/Footer";
import React from 'react';
import { HeaderUi } from "./widgets/loyaout/ui/HeaderUi";
import { FooterUi } from "./widgets/loyaout/ui/FooterUi";
import { AuctionPage } from "./pages/AuctionPage";
import { AuthPage } from "./pages/AuthPage";
import {
BrowserRouter as Router,
@ -15,17 +16,17 @@ import 'bootstrap/dist/css/bootstrap.min.css';
function App() {
return (
<div className="App">
<Header />
<div className='container'>
<HeaderUi />
<div>
<Router>
<Routes>
<Route exact path="/" element={<Home />} />
<Route exact path="/auth" element={<Auth />} />
<Route path="/" element={<AuctionPage />} />
<Route path="/auth" element={<AuthPage />} />
<Route path="*" element={<Navigate to="/" replace />} />
</Routes>
</Router>
</div>
<Footer />
<FooterUi />
</div>
);
}

View File

@ -1,18 +0,0 @@
import React from "react";
import Breadcrumb from 'react-bootstrap/Breadcrumb';
const BreadCrumbs = ({links}) => {
return (
<Breadcrumb>
{links.map((link, index) => {
return (
<Breadcrumb.Item active key={index}>
{link.name}
</Breadcrumb.Item>
)
})}
</Breadcrumb>
);
};
export default BreadCrumbs;

View File

@ -1,10 +0,0 @@
.breadcrumbs {
display: flex;
padding: 15px 0;
column-gap: 10px;
a {
color: #b6b6b6;
text-decoration: none;
}
}

View File

@ -1,25 +0,0 @@
import React from "react";
import Dropdown from 'react-bootstrap/Dropdown';
const DropDownFilter = ({title}) => {
return (
<Dropdown data-bs-theme="dark">
<Dropdown.Toggle id="dropdown-button-dark-example" variant="primary">
{title}
</Dropdown.Toggle>
<Dropdown.Menu>
<Dropdown.Item href="#/action-1" active>
Action
</Dropdown.Item>
<Dropdown.Item href="#/action-2">Another action</Dropdown.Item>
<Dropdown.Item href="#/action-3">Something else</Dropdown.Item>
<Dropdown.Divider />
<Dropdown.Item href="#/action-4">Separated link</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
);
};
export default DropDownFilter;

View File

@ -1,16 +0,0 @@
import React from "react";
import arrow from "../../assets/images/select.svg"
import "./filterItem.scss";
const FilterItem = ({title}) => {
return (
<div className="filterItem">
<p>{title}</p>
<img src={arrow} alt="arrow" />
</div>
);
};
export default FilterItem;

View File

@ -1,11 +0,0 @@
.filterItem {
display: flex;
column-gap: 8px;
padding: 5px 10px;
border-radius: 5px;
background-color: white;
align-items: center;
cursor: pointer;
width: 150px;
justify-content: space-between;
}

View File

@ -1,70 +0,0 @@
import React from "react";
import Button from 'react-bootstrap/Button';
import "./footer.scss";
const Footer = () => {
return (
<footer className="footer">
<div className="container footer__wrapper">
<div className="footer__info">
<div className="footer__infoTop">
<p>
Возникли вопросы по работе с сервисом, отправьте
заявку на консультацию
</p>
<span>прикрепить файл</span>
<Button variant="primary">
Получить консультацию
</Button>
</div>
<div className="footer__infoBottom">
<p>OOO "Издательский дом "Проф-Пресс", 2023</p>
<p>Политика конфиденциальности</p>
<p>Разработка сайта</p>
</div>
</div>
<div className="footer__items">
<div className="footer__item">
<div className="footer__itemTop">
<h3>Правила площадки</h3>
<a href="/">Правила участия</a>
</div>
<div className="footer__itemBottom">
<span>Г. Ростов-на-Дону, ул.<br/>Доватора, 111/11</span>
<span>пн-пт 8:00-18:00</span>
</div>
</div>
<div className="footer__item">
<div className="footer__itemTop">
<h3>Полезное</h3>
<a href="/">Размещение предложения</a>
<a href="/">Видео</a>
<a href="/">Статьи</a>
</div>
<div className="footer__itemBottom">
<span>+7 (861) 111-11-11</span>
<span>+7 (861) 111-11-11</span>
</div>
</div>
<div className="footer__item">
<div className="footer__itemTop">
<h3>Специалистам</h3>
<a href="/">Технические каталоги</a>
<a href="/">Готовые решения</a>
<a href="/">Нормы/ГОСТы</a>
<a href="/">Сотрудничество</a>
</div>
<div className="footer__itemBottom">
<span>vash-email@mail.ru</span>
<span>vash-email@mail.ru</span>
</div>
</div>
</div>
</div>
</footer>
);
};
export default Footer;

View File

@ -1,78 +0,0 @@
import React, { useState } from "react";
import NavigationItem from "../NavigationItem/NavigationItem";
import SocialItem from "../SocialItem/SocialItem";
import instagram from "../../assets/images/socials/instagram.png";
import whatsapp from "../../assets/images/socials/whatsapp.png";
import faceBook from "../../assets/images/socials/facebook.png";
import profile from "../../assets/images/profile-user.png";
import burger from "../../assets/images/burger-bar.png";
import close from "../../assets/images/closeBurger.png"
import "./header.scss";
const Header = () => {
const navigationItems = ["Аукционы", "Поставщики", "Одобрение заявок"]
const socials = [
{
name: "faceBook",
img: faceBook,
href: "#"
},
{
name: "instagram",
img: instagram,
href: "#"
},
{
name: "whatsapp",
img: whatsapp,
href: "#"
},
]
const [burgerOpen, setBurgerOpen] = useState(false)
return (
<header className="header">
<div className="container">
<h1 className="header__logo">Logo</h1>
<nav className="header__nav">
{navigationItems.map((item) => {
return <NavigationItem title={item} key={item} />
})}
</nav>
<div className="header__info">
<span className="header__infoPhone">+7 (861) 111-11-11</span>
<div className="header__infoSocials">
{socials.map((social) => {
return <SocialItem href={social.href} img={social.img} key={social.name} />
})}
</div>
<div className="header__infoProfile">
<img src={profile} alt="profile" />
</div>
</div>
<div className="header__burger" onClick={() => setBurgerOpen(!burgerOpen)}>
{burgerOpen ? <img className='burgerClose' src={close} alt='close'/> : <img className='burgerOpen' src={burger} alt='burger' /> }
</div>
{burgerOpen &&
<div className='header__dropDown'>
<nav className="header__dropDownNavMenu">
{navigationItems.map((item) => {
return <NavigationItem title={item} key={item} />
})}
</nav>
<div className="header__infoSocials">
{socials.map((social) => {
return <SocialItem href={social.href} img={social.img} key={social.name} />
})}
</div>
<span className="header__infoPhone">+7 (861) 111-11-11</span>
</div>
}
</div>
</header>
);
};
export default Header;

View File

@ -1,123 +0,0 @@
import React, {useState, useEffect} from "react";
import Button from 'react-bootstrap/Button';
import Modal from 'react-bootstrap/Modal';
import Form from 'react-bootstrap/Form';
export const Modals = ({
show,
onHide,
currentAuction,
setAuctionItems,
type
}) => {
const [newAuctionName, setNewAuctionName] = useState('')
const [addAuctionName, setAddNewAuctionName] = useState('')
useEffect(() => {
currentAuction ? setNewAuctionName(currentAuction.name) : setNewAuctionName('')
}, [currentAuction])
const editAuction = () => {
setAuctionItems((prevValue) => {
return prevValue.map((item) => {
if (item.number === currentAuction.number) {
return {...item, name: newAuctionName}
}
return item
})
})
onHide()
}
const addNewAuction = () => {
if (!addAuctionName) return
setAuctionItems((prevValue) => [...prevValue, {
number: prevValue.length + 1,
name: addAuctionName,
receptionDate: '17.04.23-18.04.23',
startDate: '18.04.23',
status: 'Сбор заявок'
}])
setAddNewAuctionName('')
onHide()
}
return (
<Modal
show={show}
onHide={onHide}
size="lg"
aria-labelledby="contained-modal-title-vcenter"
centered
>
{type === 'add' &&
<>
<Modal.Header closeButton>
<Modal.Title id="contained-modal-title-vcenter">
Добавить новый аукцион
</Modal.Title>
</Modal.Header>
<Modal.Body>
<Form>
<Form.Group className="mb-3" controlId="exampleForm.ControlInput1">
<Form.Label>Название аукциона*</Form.Label>
<Form.Control
type="text"
placeholder="Название аукциона*"
value={addAuctionName}
onChange={(e) => setAddNewAuctionName(e.target.value)}
autoFocus
/>
</Form.Group>
<Form.Group
className="mb-3"
controlId="exampleForm.ControlTextarea1"
>
<Form.Label>Комментарий к аукциону</Form.Label>
<Form.Control as="textarea" rows={3} />
</Form.Group>
</Form>
</Modal.Body>
<Modal.Footer>
<Button onClick={addNewAuction}>Добавить новый аукцион</Button>
</Modal.Footer>
</>
}
{type === 'edit' &&
<>
<Modal.Header closeButton>
<Modal.Title id="contained-modal-title-vcenter">
Редактировать аукцион {currentAuction.number}
</Modal.Title>
</Modal.Header>
<Modal.Body>
<Form>
<Form.Group className="mb-3" controlId="exampleForm.ControlInput2">
<Form.Label>Название аукциона*</Form.Label>
<Form.Control
type="text"
placeholder="Название аукциона*"
value={newAuctionName}
onChange={(e) => setNewAuctionName(e.target.value)}
autoFocus
/>
</Form.Group>
<Form.Group
className="mb-3"
controlId="exampleForm.ControlTextarea1"
>
<Form.Label>Комментарий к аукциону</Form.Label>
<Form.Control as="textarea" rows={3} />
</Form.Group>
</Form>
</Modal.Body>
<Modal.Footer>
<Button onClick={editAuction}>Сохранить изменения</Button>
</Modal.Footer>
</>
}
</Modal>
);
};
export default Modals;

View File

@ -1,16 +0,0 @@
import React from "react";
import arrow from "../../assets/images/select.svg"
import "./navigationItem.scss";
const NavigationItem = ({title}) => {
return (
<div className="navigationItem">
<h5>{title}</h5>
<img src={arrow} alt="arrow" />
</div>
);
};
export default NavigationItem;

View File

@ -1,13 +0,0 @@
import React from "react";
import "./socialItem.scss";
const SocialItem = ({img, href}) => {
return (
<a className="socialItem" href={href}>
<img src={img} alt='socialIcon' />
</a>
);
};
export default SocialItem;

98
src/constants/data.ts Normal file
View File

@ -0,0 +1,98 @@
import faceBook from "../shared/images/socials/facebook.png";
import instagram from "../shared/images/socials/instagram.png";
import whatsapp from "../shared/images/socials/whatsapp.png";
import { socialType } from "../types";
export const filterItems = [{
title: "Товарная группа",
options: [{
name: "option",
link: "#",
id: 1
},
{
name: "option",
link: "#",
id: 2
},
{
name: "option",
link: "#",
id: 3
}]
},
{
title: "Статус аукциона",
options: [{
name: "option",
link: "#",
id: 4
},
{
name: "option",
link: "#",
id: 5
},
{
name: "option",
link: "#",
id: 6
}]
},
{
title: "Новая заявка",
options: [{
name: "option",
link: "#",
id: 7
},
{
name: "option",
link: "#",
id: 8
},
{
name: "option",
link: "#",
id: 9
}]
},
{
title: "Выбрать период",
options: [{
name: "option",
link: "#",
id: 10
},
{
name: "option",
link: "#",
id: 11
},
{
name: "option",
link: "#",
id: 12
}]
}];
export const socials:socialType[] = [
{
name: "faceBook",
img: faceBook,
href: "#"
},
{
name: "instagram",
img: instagram,
href: "#"
},
{
name: "whatsapp",
img: whatsapp,
href: "#"
},
];
export const navigationItems = ["Аукционы", "Поставщики", "Одобрение заявок"]

View File

@ -0,0 +1,32 @@
import React from "react";
import Dropdown from 'react-bootstrap/Dropdown';
type option = {
name: string,
link: string,
id: number
}
interface DefaultDropDownProps {
title: string,
options: option[]
}
export const DefaultDropDown:React.FC<DefaultDropDownProps> = ({title, options}) => {
return (
<Dropdown data-bs-theme="dark">
<Dropdown.Toggle id="dropdown-button-dark-example" variant="primary">
{title}
</Dropdown.Toggle>
<Dropdown.Menu>
{options.map((option => {
return <Dropdown.Item key={option.id} href={option.link}>
{option.name}
</Dropdown.Item>
}))}
</Dropdown.Menu>
</Dropdown>
);
};

View File

@ -0,0 +1 @@
export { DefaultDropDown } from "./DefaultDropDown"

View File

@ -0,0 +1,24 @@
import React, {ReactElement} from "react";
import Pagination from 'react-bootstrap/Pagination';
interface DefaultPaginationProps {
pageCount: number,
currentPage: number
}
export const DefaultPagination:React.FC<DefaultPaginationProps> = ({pageCount, currentPage}) => {
let items: ReactElement[] = [];
for (let number = 1; number <= pageCount; number++) {
items.push(
<Pagination.Item key={number} active={number === currentPage}>
{number}
</Pagination.Item>,
);
}
return (
<Pagination>
{items}
</Pagination>
);
};

View File

@ -0,0 +1 @@
export { DefaultPagination } from "./DefaultPagination"

View File

@ -39,14 +39,5 @@ table {
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
.container {
display: flex;
align-items: center;
max-width: 1310px;
padding: 0 15px;
margin: 0 auto;
height: 100%;
monospace;
}

View File

@ -4,10 +4,12 @@ import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
const root = ReactDOM.createRoot(document.getElementById('root'));
const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
<React.StrictMode>
<App />
<App />
</React.StrictMode>
);

1
src/logo.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,159 @@
import React, {useState} from "react";
import { BreadCrumbsUi } from "../../shared/UI/BreadCrumbsUi";
import {ButtonUi, ButtonUiType} from "../../shared/UI/ButtonUi";
import { DefaultDropDown } from "../../entities/DefaultDropDown";
import { DefaultPagination } from "../../entities/DefaultPagination";
import { AddAuctionModal } from "../../widgets/AddAuctionModal";
import { EditAuctionModal } from "../../widgets/EditAuctionModal";
import Form from 'react-bootstrap/Form';
import { AuctionItem } from "../../types";
import { filterItems } from "../../constants/data";
import loupe from "../../shared/images/loupe.png"
import filterImg from "../../shared/images/filter.png"
import close from "../../shared/images/close.png"
import edit from "../../shared/images/edit.png"
import styles from "./auctionPage.module.scss"
export const AuctionPage = () => {
const [auctionItems, setAuctionItems] = useState<AuctionItem[]>([
{
number: 1,
name: 'Аукцион на закупку в интересах компании ООО "Фабрика"',
receptionDate: '17.04.23-18.04.23',
startDate: '18.04.23',
status: 'Черновик'
},
{
number: 2,
name: 'Аукцион на закупку в интересах компании ООО "Пресс"',
receptionDate: '17.04.23-18.04.23',
startDate: '18.04.23',
status: 'Сбор заявок'
},
{
number: 3,
name: 'Аукцион на закупку в интересах компании ООО "Компания"',
receptionDate: '17.04.23-18.04.23',
startDate: '18.04.23',
status: 'Идут торги'
},
{
number: 4,
name: 'Аукцион на закупку в интересах компании ООО "Кот"',
receptionDate: '17.04.23-18.04.23',
startDate: '18.04.23',
status: 'В архиве'
},
])
const [openAddModal, setOpenAddModal] = useState(false)
const [openEditModal, setOpenEditModal] = useState(false)
const [currentEditAuction, setCurrentEditAuction] = useState({
number: 0,
name: '',
receptionDate: '',
startDate: '',
status: ''
})
const addNewAuction = (newAction: string) => {
setAuctionItems((prevValue) => [...prevValue, {
number: prevValue.length + 1,
name: newAction,
receptionDate: '17.04.23-18.04.23',
startDate: '18.04.23',
status: 'Сбор заявок'
}])
}
const editAuctionItem = (newAuctionName: string, currentEditAuctionId: number) => {
setAuctionItems((prevValue) => {
return prevValue.map((item) => {
if (item.number === currentEditAuctionId) {
return {...item, name: newAuctionName}
}
return item
})
})
}
return (
<div className={styles.home}>
<BreadCrumbsUi links={[
{ name: "Главная", link: "/" }
]} />
<h2 className={styles.home__title}>Аукционы</h2>
<div className={styles.home__info}>
<div className={styles.info__top}>
<ButtonUi event={() => setOpenAddModal(true)} title={'+ Добавить аукцион'} type={ButtonUiType.PRIMARY} />
<div className={styles.info__search}>
<Form.Control
type="text"
placeholder="Найти аукцион"
/>
<img src={loupe} alt='loupe' />
</div>
</div>
<div className={styles.info__filters}>
<img className={styles.info__filtersImg} src={filterImg} alt="filter" />
<div className={styles.info__filters__items}>
{filterItems.map((item) => {
return <DefaultDropDown key={item.title} title={item.title} options={item.options} />
})}
</div>
<ButtonUi
title={'Сбросить фильтры'}
type={ButtonUiType.PRIMARY}
img={<img src={close} alt="cross" />} />
<ButtonUi title={'Применить'} type={ButtonUiType.INFO} />
</div>
<div className={styles.info__tableWrapper}>
<table>
<thead>
<tr className={styles.tableItem}>
<td></td>
<td>Название аукциона</td>
<td>Прием заявок</td>
<td>Проведение</td>
<td>Статус</td>
</tr>
</thead>
<tbody>
{auctionItems.map((item) => {
return <tr className={styles.tableItem} key={item.number}>
<td>{item.number}</td>
<td className={styles.tableItem__name}>{item.name}</td>
<td>{item.receptionDate}</td>
<td>{item.startDate}</td>
<td>{item.status}</td>
<td className={styles.tableItem__edit}>
<img src={edit} alt="edit" onClick={() => {
setCurrentEditAuction(item)
setOpenEditModal(true)
}}/>
</td>
</tr>
})}
</tbody>
</table>
<DefaultPagination pageCount={10} currentPage={2} />
</div>
</div>
<AddAuctionModal
showModal={openAddModal}
onHide={() => setOpenAddModal(false)}
addNewItem={addNewAuction} />
<EditAuctionModal
showModal={openEditModal}
onHide={() => setOpenEditModal(false)}
currentAuction={currentEditAuction}
editAuctionItem={editAuctionItem} />
</div>
);
};

View File

@ -1,6 +1,8 @@
.home {
width: 100%;
padding: 15px 0 100px;
max-width: 1320px;
margin: 0 auto;
padding: 15px 15px 100px;
&__title {
font-size: 40px;
}
@ -30,6 +32,7 @@
display: flex;
justify-content: space-between;
min-width: 1213px;
max-height: 40px;
}
&__search {
@ -45,6 +48,7 @@
border: none;
width: 100%;
outline: none;
box-shadow: none;
}
img {
@ -110,10 +114,6 @@
font-weight: 700;
}
.center {
text-align: center;
}
&__edit {
display: flex;
cursor: pointer;
@ -124,6 +124,10 @@
height: 15px;
}
}
td {
text-align: center;
}
}
table {
width: 100%;
@ -157,3 +161,12 @@
}
}
}
.container {
display: flex;
align-items: center;
max-width: 1320px;
padding: 0 15px;
margin: 0 auto;
height: 100%;
}

View File

@ -0,0 +1 @@
export { AuctionPage } from "./AuctionPage"

View File

@ -1,25 +0,0 @@
import React from "react";
import Button from 'react-bootstrap/Button';
import "./auth.scss"
const Auth = () => {
return (
<div className="auth">
<h1 className="auth__title">Аукционная площадка для проведения закупок ГК Проф-Пресс</h1>
<div className="auth__form">
<input
placeholder="login"
type="text"
/>
<input
placeholder="password"
type="password"
/>
<Button variant="primary">Войти</Button>
</div>
</div>
)
}
export default Auth

View File

@ -0,0 +1,28 @@
import React from "react";
import { ButtonUi, ButtonUiType } from "../../shared/UI/ButtonUi";
import Form from 'react-bootstrap/Form';
import styles from "./authPage.module.scss"
export const AuthPage = () => {
return (
<div className={styles.auth}>
<h1 className={styles.auth__title}>Аукционная площадка для проведения закупок ГК Проф-Пресс</h1>
<div className={styles.auth__form}>
<Form.Control
type="text"
id="inputLogin"
placeholder="login"
/>
<Form.Control
type="password"
id="inputPassword"
placeholder="password"
/>
<ButtonUi title={'Войти'} type={ButtonUiType.PRIMARY} />
</div>
</div>
)
}

View File

@ -18,18 +18,5 @@
row-gap: 15px;
width: 100%;
max-width: 400px;
input {
padding: 5px;
outline: none;
border-radius: 5px;
border: 1px solid gray;
}
button {
max-width: 200px;
width: 100%;
margin: 20px auto 0;
}
}
}

View File

@ -0,0 +1 @@
export { AuthPage } from "./AuthPage"

View File

@ -1,148 +0,0 @@
import React, {useState} from "react";
import BreadCrumbs from "../../components/BreadCrumbs/BreadCrumbs";
import DropDownFilter from "../../components/DropDownFilter/DropDownFilter";
import Modals from "../../components/Modals/Modals";
import Pagination from 'react-bootstrap/Pagination';
import Button from 'react-bootstrap/Button';
import loupe from "../../assets/images/loupe.png"
import filterImg from "../../assets/images/filter.png"
import cross from "../../assets/images/close.png"
import edit from "../../assets/images/edit.png"
import "./home.scss"
const Home = () => {
const filterItems = ["Товарная группа", "Статус аукциона", "Новая заявка", "Выбрать период"]
const [auctionItems, setAuctionItems] = useState([
{
number: 1,
name: 'Аукцион на закупку в интересах компании ООО "Фабрика"',
receptionDate: '17.04.23-18.04.23',
startDate: '18.04.23',
status: 'Черновик'
},
{
number: 2,
name: 'Аукцион на закупку в интересах компании ООО "Пресс"',
receptionDate: '17.04.23-18.04.23',
startDate: '18.04.23',
status: 'Сбор заявок'
},
{
number: 3,
name: 'Аукцион на закупку в интересах компании ООО "Компания"',
receptionDate: '17.04.23-18.04.23',
startDate: '18.04.23',
status: 'Идут торги'
},
{
number: 4,
name: 'Аукцион на закупку в интересах компании ООО "Кот"',
receptionDate: '17.04.23-18.04.23',
startDate: '18.04.23',
status: 'В архиве'
},
])
const [openAddModal, setOpenAddModal] = useState(false)
const [openEditModal, setOpenEditModal] = useState(false)
const [currentEditAuction, setCurrentEditAuction] = useState(null)
return (
<div className="home">
<BreadCrumbs links={[
{ name: "Главная", link: "/" }
]} />
<h2 className="home__title">Аукционы</h2>
<div className="home__info">
<div className="info__top">
<Button variant="primary" onClick={() => setOpenAddModal(true)}>
+ Добавить аукцион
</Button>
<div className="info__search">
<input placeholder="Найти аукцион" type="text" />
<img src={loupe} alt='loupe' />
</div>
</div>
<div className="info__filters">
<img className="info__filtersImg" src={filterImg} alt="filter" />
<div className="info__filters__items">
{filterItems.map((item, index) => {
return <DropDownFilter key={index} title={item} />
})}
</div>
<Button variant="primary">
<img src={cross} alt="cross" />
Сбросить фильтры
</Button>
<Button variant="info">Применить</Button>
</div>
<div className="info__tableWrapper">
<table>
<thead>
<tr className="tableItem">
<td></td>
<td>Название аукциона</td>
<td className="center">Прием заявок</td>
<td className="center">Проведение</td>
<td className="center">Статус</td>
</tr>
</thead>
<tbody>
{auctionItems.map((item) => {
return <tr className="tableItem" key={item.number}>
<td>{item.number}</td>
<td className="tableItem__name">{item.name}</td>
<td className="center">{item.receptionDate}</td>
<td className="center">{item.startDate}</td>
<td className="center">{item.status}</td>
<td className="tableItem__edit">
<img src={edit} alt="edit" onClick={() => {
setCurrentEditAuction(item)
setOpenEditModal(true)
}}/>
</td>
</tr>
})}
</tbody>
</table>
<Pagination>
<Pagination.First />
<Pagination.Item>{1}</Pagination.Item>
<Pagination.Ellipsis />
<Pagination.Item>{10}</Pagination.Item>
<Pagination.Item>{11}</Pagination.Item>
<Pagination.Item active>{12}</Pagination.Item>
<Pagination.Item>{13}</Pagination.Item>
<Pagination.Ellipsis />
<Pagination.Item>{20}</Pagination.Item>
<Pagination.Last />
</Pagination>
</div>
</div>
{openAddModal &&
<Modals
type='add'
show={openAddModal}
onHide={() => setOpenAddModal(false)}
setAuctionItems={setAuctionItems}
/>
}
{currentEditAuction &&
<Modals
type='edit'
show={openEditModal}
onHide={() => setOpenEditModal(false)}
currentAuction={currentEditAuction}
setAuctionItems={setAuctionItems}
/>
}
</div>
);
};
export default Home;

1
src/react-app-env.d.ts vendored Normal file
View File

@ -0,0 +1 @@
/// <reference types="react-scripts" />

View File

@ -1,4 +1,6 @@
const reportWebVitals = onPerfEntry => {
import { ReportHandler } from 'web-vitals';
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);

View File

@ -0,0 +1,25 @@
import React from "react";
import Breadcrumb from 'react-bootstrap/Breadcrumb';
type link = {
name: string,
link: string,
}
interface BreadCrumbsUiProps {
links: link[]
}
export const BreadCrumbsUi:React.FC<BreadCrumbsUiProps> = ({links}) => {
return (
<Breadcrumb>
{links.map((link) => {
return (
<Breadcrumb.Item active key={link.name}>
{link.name}
</Breadcrumb.Item>
)
})}
</Breadcrumb>
);
};

View File

@ -0,0 +1 @@
export { BreadCrumbsUi } from "./BreadCrumbsUi"

View File

@ -0,0 +1,19 @@
import React, {ReactElement} from "react";
import Button from 'react-bootstrap/Button';
interface ButtonUiProps {
title: string,
type: string,
img?: ReactElement,
event?: () => void
}
export const ButtonUi:React.FC<ButtonUiProps> = ({title, img, type, event}) => {
return (
<Button onClick={event} variant={type}>
{img}
{title}
</Button>
)
}

View File

@ -0,0 +1,7 @@
export const ButtonUiType = {
PRIMARY: 'primary',
INFO: 'info',
SECONDARY: 'secondary',
SUCCESS: 'success',
WARNING: 'warning'
}

View File

@ -0,0 +1,4 @@
import { ButtonUi } from "./ButtonUi";
import { ButtonUiType } from "./buttonUiType";
export { ButtonUiType, ButtonUi }

View File

@ -0,0 +1,17 @@
import React from "react";
import styles from "./socialItemUi.module.scss";
interface SocialItemUiProps {
img: string,
href: string
}
export const SocialItemUi:React.FC<SocialItemUiProps> = ({img, href}) => {
return (
<a className={styles.socialItem} href={href}>
<img src={img} alt='socialIcon' />
</a>
);
};

View File

@ -0,0 +1 @@
export { SocialItemUi } from "./SocialItemUi"

View File

@ -0,0 +1,18 @@
import React from "react";
import arrow from "../../images/select.svg"
import styles from "./tabItemNavigation.module.scss";
interface TabItemNavigationUiProps {
title: string,
}
export const TabItemNavigationUi:React.FC<TabItemNavigationUiProps> = ({title}) => {
return (
<div className={styles.navigationItem}>
<h5>{title}</h5>
<img src={arrow} alt="arrow" />
</div>
);
};

View File

@ -0,0 +1 @@
export { TabItemNavigationUi } from "./TabItemNavigationUi"

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 426 B

After

Width:  |  Height:  |  Size: 426 B

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 149 B

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

15
src/types.ts Normal file
View File

@ -0,0 +1,15 @@
export interface AuctionItem {
number: number,
name: string,
receptionDate: string,
startDate: string,
status: string
}
type socialName = 'faceBook' | 'instagram' | 'whatsapp'
export type socialType = {
name: socialName,
img: string,
href: string
}

View File

@ -0,0 +1,61 @@
import React, {useState} from "react";
import { ButtonUi, ButtonUiType } from "../../shared/UI/ButtonUi";
import Modal from 'react-bootstrap/Modal';
import Form from 'react-bootstrap/Form';
interface AddAuctionModalProps {
showModal: boolean,
onHide: () => void,
addNewItem: (name: string) => void
}
export const AddAuctionModal:React.FC<AddAuctionModalProps> = ({showModal, onHide, addNewItem}) => {
const [addAuctionName, setAddNewAuctionName] = useState('')
const addNewAuction = () => {
if (!addAuctionName) return
addNewItem(addAuctionName)
setAddNewAuctionName('')
onHide()
}
return (
<Modal
show={showModal}
onHide={onHide}
size="lg"
aria-labelledby="contained-modal-title-vcenter"
centered
>
<Modal.Header closeButton>
<Modal.Title id="contained-modal-title-vcenter">
Добавить новый аукцион
</Modal.Title>
</Modal.Header>
<Modal.Body>
<Form>
<Form.Group className="mb-3" controlId="exampleForm.ControlInput1">
<Form.Label>Название аукциона*</Form.Label>
<Form.Control
type="text"
placeholder="Название аукциона*"
value={addAuctionName}
onChange={(e) => setAddNewAuctionName(e.target.value)}
autoFocus
/>
</Form.Group>
<Form.Group
className="mb-3"
controlId="exampleForm.ControlTextarea1"
>
<Form.Label>Комментарий к аукциону</Form.Label>
<Form.Control as="textarea" rows={3} />
</Form.Group>
</Form>
</Modal.Body>
<Modal.Footer>
<ButtonUi title={'Добавить новый аукцион'} type={ButtonUiType.PRIMARY} event={addNewAuction}/>
</Modal.Footer>
</Modal>
)
}

View File

@ -0,0 +1 @@
export { AddAuctionModal } from "./AddAuctionModal"

View File

@ -0,0 +1,72 @@
import React, {useState, useEffect} from "react";
import { ButtonUi, ButtonUiType } from "../../shared/UI/ButtonUi";
import Modal from 'react-bootstrap/Modal';
import Form from 'react-bootstrap/Form';
type auctionItem = {
number: number,
name: string,
receptionDate: string,
startDate: string,
status: string
}
interface AddAuctionModalProps {
showModal: boolean,
onHide: () => void,
currentAuction: auctionItem,
editAuctionItem: (newAuctionName:string, currentEditAuctionId:number) => void
}
export const EditAuctionModal:React.FC<AddAuctionModalProps> = ({showModal, onHide, currentAuction, editAuctionItem}) => {
const [newAuctionName, setNewAuctionName] = useState('')
useEffect(() => {
currentAuction ? setNewAuctionName(currentAuction.name) : setNewAuctionName('')
}, [currentAuction])
const editAuction = () => {
editAuctionItem(newAuctionName, currentAuction.number)
onHide()
}
return (
<Modal
show={showModal}
onHide={onHide}
size="lg"
aria-labelledby="contained-modal-title-vcenter"
centered
>
<Modal.Header closeButton>
<Modal.Title id="contained-modal-title-vcenter">
Редактировать аукцион {currentAuction.number}
</Modal.Title>
</Modal.Header>
<Modal.Body>
<Form>
<Form.Group className="mb-3" controlId="exampleForm.ControlInput2">
<Form.Label>Название аукциона*</Form.Label>
<Form.Control
type="text"
placeholder="Название аукциона*"
value={newAuctionName}
onChange={(e) => setNewAuctionName(e.target.value)}
autoFocus
/>
</Form.Group>
<Form.Group
className="mb-3"
controlId="exampleForm.ControlTextarea1"
>
<Form.Label>Комментарий к аукциону</Form.Label>
<Form.Control as="textarea" rows={3} />
</Form.Group>
</Form>
</Modal.Body>
<Modal.Footer>
<ButtonUi title={'Сохранить изменения'} type={ButtonUiType.PRIMARY} event={editAuction}/>
</Modal.Footer>
</Modal>
)
}

View File

@ -0,0 +1 @@
export { EditAuctionModal } from "./EditAuctionModal"

View File

@ -0,0 +1,66 @@
import React from "react";
import { ButtonUi, ButtonUiType } from "../../../../shared/UI/ButtonUi";
import styles from "./footerUi.module.scss";
export const FooterUi = () => {
return (
<footer className={styles.footer}>
<div className={styles.footer__wrapper}>
<div className={styles.footer__info}>
<div className={styles.footer__infoTop}>
<p>
Возникли вопросы по работе с сервисом, отправьте
заявку на консультацию
</p>
<span>прикрепить файл</span>
<ButtonUi title={'Получить консультацию'} type={ButtonUiType.PRIMARY} />
</div>
<div className={styles.footer__infoBottom}>
<p>OOO "Издательский дом "Проф-Пресс", 2023</p>
<p>Политика конфиденциальности</p>
<p>Разработка сайта</p>
</div>
</div>
<div className={styles.footer__items}>
<div className={styles.footer__item}>
<div className={styles.footer__itemTop}>
<h3>Правила площадки</h3>
<a href="/src/modules/pages">Правила участия</a>
</div>
<div className={styles.footer__itemBottom}>
<span>Г. Ростов-на-Дону, ул.<br/>Доватора, 111/11</span>
<span>пн-пт 8:00-18:00</span>
</div>
</div>
<div className={styles.footer__item}>
<div className={styles.footer__itemTop}>
<h3>Полезное</h3>
<a href="/src/modules/pages">Размещение предложения</a>
<a href="/src/modules/pages">Видео</a>
<a href="/src/modules/pages">Статьи</a>
</div>
<div className={styles.footer__itemBottom}>
<span>+7 (861) 111-11-11</span>
<span>+7 (861) 111-11-11</span>
</div>
</div>
<div className={styles.footer__item}>
<div className={styles.footer__itemTop}>
<h3>Специалистам</h3>
<a href="/src/modules/pages">Технические каталоги</a>
<a href="/src/modules/pages">Готовые решения</a>
<a href="/src/modules/pages">Нормы/ГОСТы</a>
<a href="/src/modules/pages">Сотрудничество</a>
</div>
<div className={styles.footer__itemBottom}>
<span>vash-email@mail.ru</span>
<span>vash-email@mail.ru</span>
</div>
</div>
</div>
</div>
</footer>
);
};

View File

@ -10,6 +10,10 @@
}
&__wrapper {
display: flex;
max-width: 1320px;
padding: 0 15px;
margin: 0 auto;
@media (max-width: 1155px) {
flex-direction: column;
row-gap: 20px;

View File

@ -0,0 +1 @@
export { FooterUi } from "./FooterUi"

View File

@ -0,0 +1,60 @@
import React, { useState } from "react";
import { TabItemNavigationUi } from "../../../../shared/UI/TabItemNavigationUi";
import { SocialItemUi } from "../../../../shared/UI/SocialItemUi";
import { navigationItems, socials } from "../../../../constants/data";
import profile from "../../../../shared/images/profile-user.png";
import burger from "../../../../shared/images/burger-bar.png";
import close from "../../../../shared/images/closeBurger.png"
import styles from "./headerUi.module.scss";
export const HeaderUi = () => {
const [burgerOpen, setBurgerOpen] = useState(false)
return (
<header className={styles.header}>
<div className={styles.container}>
<h1 className={styles.header__logo}>Logo</h1>
<nav className={styles.header__nav}>
{navigationItems.map((item) => {
return <TabItemNavigationUi title={item} key={item} />
})}
</nav>
<div className={styles.header__info}>
<span className={styles.header__infoPhone}>+7 (861) 111-11-11</span>
<div className={styles.header__infoSocials}>
{socials.map((social) => {
return <SocialItemUi href={social.href} img={social.img} key={social.name} />
})}
</div>
<div className={styles.header__infoProfile}>
<img src={profile} alt="profile" />
</div>
</div>
<div className={styles.header__burger} onClick={() => setBurgerOpen(!burgerOpen)}>
{burgerOpen ?
<img className={styles.burgerClose} src={close} alt='close'/> :
<img className={styles.burgerOpen} src={burger} alt='burger' /> }
</div>
{burgerOpen &&
<div className={styles.header__dropDown}>
<nav className={styles.header__dropDownNavMenu}>
{navigationItems.map((item) => {
return <TabItemNavigationUi title={item} key={item} />
})}
</nav>
<div className={styles.header__infoSocials}>
{socials.map((social) => {
return <SocialItemUi href={social.href} img={social.img} key={social.name} />
})}
</div>
<span className={styles.header__infoPhone}>+7 (861) 111-11-11</span>
</div>
}
</div>
</header>
);
};

View File

@ -106,3 +106,12 @@
}
}
}
.container {
display: flex;
align-items: center;
max-width: 1320px;
padding: 0 15px;
margin: 0 auto;
height: 100%;
}

View File

@ -0,0 +1 @@
export { HeaderUi } from "./HeaderUi"