Рефактор: пересобрал Navbar. В images добавил папку проектов, скорректировал mock

This commit is contained in:
ifraimka1 committed 2024-02-19 12:46:59 +03:00
1 parent 8d43bec068
commit fb6c40f280
10 files changed
+88 -30

No files matched your search

+31 -21
View File
@@ -1,33 +1,43 @@
import { Link } from 'react-router-dom';
import { scb as logo } from '../../images'; import { scb as logo } from '../../images';
import NavbarLink from './NavbarLink';
import './Navbar.styles.scss'; import './Navbar.styles.scss';
function Navbar() { const mock = [
{
text: "ГЛАВНАЯ",
to: "/",
},
{
text: "О НАС",
to: "/aboutus",
},
{
text: "ЛАБОРАТОРИИ",
to: "/labs",
},
{
text: "ПРОЕКТЫ",
to: "/projects",
},
{
text: "КОНТАКТЫ",
to: "/contact",
},
{
text: "ИКТИБ",
to: "https://ictis.sfedu.ru",
newTab: true,
},
];
function Navbar({ links = mock }) {
return ( return (
<div className="navbar"> <div className="navbar">
<div className="logo-container"> <div className="logo-container">
<img src={logo} className="logo" alt="SCB logo"/> <img src={logo} className="logo" alt="SCB logo"/>
</div> </div>
<div className="bar"> <div className="bar">
<Link to={`/`}> { links.map(link => <NavbarLink link={ link } />) }
ГЛАВНАЯ
</Link>
<Link to={`/aboutus`}>
О НАС
</Link>
<Link to={`/labs`}>
ЛАБОРАТОРИИ
</Link>
<Link to={`/projects`}>
ПРОЕКТЫ
</Link>
<Link to={`/contact`}>
КОНТАКТЫ
</Link>
<a href="https://ictis.sfedu.ru" target="_blank">
ИКТИБ
</a>
</div> </div>
</div> </div>
); );
+23 -1
View File
@@ -26,8 +26,11 @@ $primary-text-color: white;
.bar { .bar {
display: flex; display: flex;
align-items: center;
.nav-link {
position: relative;
a {
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
line-height: 20px; line-height: 20px;
@@ -36,6 +39,25 @@ $primary-text-color: white;
margin-left: 40px; margin-left: 40px;
color: $primary-text-color; color: $primary-text-color;
text-decoration: none; text-decoration: none;
text-wrap: nowrap;
}
.nav-link::after {
position: absolute;
content: '';
left: 50%;
transform: translateX(-50%);
bottom: 0;
display: block;
width: 0;
height: 1px;
background: white;
transition: 0.3s;
}
.nav-link:hover:after,
.nav-link.active:after {
width: 100%;
} }
} }
} }
+18
View File
@@ -0,0 +1,18 @@
import { NavLink } from "react-router-dom";
function NavbarLink({ link }) {
return (
<NavLink
className={({ isActive, isPending }) =>
`nav-link ${isActive ? 'active' : isPending ? 'disabled' : ''
}`
}
to={ link.to }
target={ link.newTab && '_blank' }
>
{ link.text }
</NavLink >
);
}
export default NavbarLink;
-1
View File
@@ -1,4 +1,3 @@
export { default as car } from './car.jpeg'; export { default as car } from './car.jpeg';
export { default as newsMock } from './newsMock.png'; export { default as newsMock } from './newsMock.png';
export { default as projectMock } from './projectMock.png';
export { default as scb } from './scb.svg'; export { default as scb } from './scb.svg';
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 KiB

+4
View File
@@ -0,0 +1,4 @@
export { default as drone } from './droneMock.jpeg';
export { default as project } from './projectMock.png';
export { default as ttt } from './3t.jpeg';
export { default as comBattle } from './comBattle.jpeg';
File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

@@ -1,23 +1,28 @@
import BlockHeading from '../BlockHeading'; import BlockHeading from '../BlockHeading';
import ProjectCard from './ProjectCard'; import ProjectCard from './ProjectCard';
import './Projects.styles.scss'; import './Projects.styles.scss';
import { projectMock } from '../../../../images'; import {
project,
drone,
ttt,
comBattle
} from '../../../../images/projects';
const mock = [ const mock = [
{ {
image: projectMock, image: drone,
link: "/projects", link: "/projects",
}, },
{ {
image: projectMock, image: ttt,
link: "/projects", link: "/projects",
}, },
{ {
image: projectMock, image: comBattle,
link: "/projects", link: "/projects",
}, },
{ {
image: projectMock, image: project,
link: "/projects", link: "/projects",
}, },
]; ];
@@ -25,9 +30,9 @@ const mock = [
function Projects({ projects = mock }) { function Projects({ projects = mock }) {
return ( return (
<div className="block projects"> <div className="block projects">
<BlockHeading heading="Наши проекты" linkText="Все проекты" link="/projects"/> <BlockHeading heading="Наши проекты" linkText="Все проекты" link="/projects" />
<div className="row"> <div className="row">
{ mock.map(item => <ProjectCard project={ item } />) } {mock.map(item => <ProjectCard project={item} />)}
</div> </div>
</div> </div>
); );