navbar and title changes
This commit is contained in:
parent
f79f6bcea1
commit
0dede17feb
@ -1,20 +1,25 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { Link } from "gatsby"
|
|
||||||
|
|
||||||
import logo from "../images/index/logo_white.png"
|
import logo from "../images/index/logo_white.png"
|
||||||
import "bootstrap/dist/css/bootstrap.css"
|
import "bootstrap/dist/css/bootstrap.css"
|
||||||
import "../styles/header.css"
|
import "../styles/header.css"
|
||||||
import {Navbar, Nav} from "react-bootstrap"
|
import {Navbar, Nav} from "react-bootstrap"
|
||||||
import { globalHistory as history } from '@reach/router'
|
import { Link } from '@reach/router'
|
||||||
|
|
||||||
const Header = ( ) => {
|
const NavLink = props => (
|
||||||
let curActive = [' ', ' ', ' '];
|
<Link
|
||||||
const { location } = history;
|
{...props}
|
||||||
if (location.pathname=== '/about'){curActive[0] = 'active';}
|
getProps={({ isCurrent }) => {
|
||||||
if (location.pathname=== '/projects/physics' || location.pathname === '/projects/education' || location.pathname === '/projects/math' || location.pathname === '/projects/software'){curActive[1] = 'active';}
|
return {
|
||||||
if (location.pathname=== '/partners'){curActive[2] = 'active';}
|
style: {
|
||||||
|
color: isCurrent ? "white" : "rgb(230, 221, 221)"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
return(
|
const Header = ( ) => (
|
||||||
<header>
|
<header>
|
||||||
<Navbar bg="dark" expand="lg" fixed="top">
|
<Navbar bg="dark" expand="lg" fixed="top">
|
||||||
<div className="container">
|
<div className="container">
|
||||||
@ -22,15 +27,14 @@ const Header = ( ) => {
|
|||||||
<Navbar.Collapse id="basic-navbar-nav">
|
<Navbar.Collapse id="basic-navbar-nav">
|
||||||
<Nav className="mr-auto">
|
<Nav className="mr-auto">
|
||||||
<Navbar.Brand><Link to="/"><img src={logo} height="50px" alt="npm logo" id="logo"/></Link></Navbar.Brand>
|
<Navbar.Brand><Link to="/"><img src={logo} height="50px" alt="npm logo" id="logo"/></Link></Navbar.Brand>
|
||||||
<Nav.Link><Link id={`${curActive[0]}`} to="./about">Группа</Link></Nav.Link>
|
<Nav.Link><NavLink to="/about">Группа</NavLink></Nav.Link>
|
||||||
<Nav.Link><Link id={`${curActive[1]}`} to="./projects/physics">Проекты</Link></Nav.Link>
|
<Nav.Link><NavLink to="/projects/physics">Проекты</NavLink></Nav.Link>
|
||||||
<Nav.Link><Link id={`${curActive[2]}`} to="./partners">Партнеры</Link></Nav.Link>
|
<Nav.Link><NavLink to="/partners">Партнеры</NavLink></Nav.Link>
|
||||||
</Nav>
|
</Nav>
|
||||||
</Navbar.Collapse>
|
</Navbar.Collapse>
|
||||||
</div>
|
</div>
|
||||||
</Navbar>
|
</Navbar>
|
||||||
</header>
|
</header>
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
export default Header
|
export default Header
|
||||||
|
@ -1,25 +1,31 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import PropTypes from "prop-types"
|
import PropTypes from "prop-types"
|
||||||
|
|
||||||
|
import favicon from "../images/icon.png"
|
||||||
|
import Helmet from "react-helmet"
|
||||||
|
|
||||||
import Header from "./header"
|
import Header from "./header"
|
||||||
import Footer from "./footer"
|
import Footer from "./footer"
|
||||||
|
import SEO from "./seo"
|
||||||
|
|
||||||
import "../styles/layout.css"
|
import "../styles/layout.css"
|
||||||
import "../styles/bootstrap.min.css"
|
import "../styles/bootstrap.min.css"
|
||||||
import "../styles/main.css"
|
import "../styles/main.css"
|
||||||
import "katex/dist/katex.min.css"
|
import "katex/dist/katex.min.css"
|
||||||
|
|
||||||
const Layout = ({ children }) => {
|
const Layout = ({ children }) => (
|
||||||
return (
|
|
||||||
<>
|
<>
|
||||||
|
<Helmet>
|
||||||
|
<link rel="icon" href={favicon}/>
|
||||||
|
</Helmet>
|
||||||
|
<SEO title=" "/>
|
||||||
<Header siteTitle="NPM group" />
|
<Header siteTitle="NPM group" />
|
||||||
<div class = "container">
|
<div class = "container">
|
||||||
<main>{children}</main>
|
<main>{children}</main>
|
||||||
</div>
|
</div>
|
||||||
<Footer/>
|
<Footer/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
Layout.propTypes = {
|
Layout.propTypes = {
|
||||||
children: PropTypes.node.isRequired,
|
children: PropTypes.node.isRequired,
|
||||||
|
60
src/components/seo.js
Normal file
60
src/components/seo.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import React from "react"
|
||||||
|
import PropTypes from "prop-types"
|
||||||
|
import Helmet from "react-helmet"
|
||||||
|
import { useStaticQuery, graphql } from "gatsby"
|
||||||
|
|
||||||
|
const SEO = ({ description, lang, meta, title }) => {
|
||||||
|
const { site } = useStaticQuery(
|
||||||
|
graphql`
|
||||||
|
query {
|
||||||
|
site {
|
||||||
|
siteMetadata {
|
||||||
|
title
|
||||||
|
description
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
)
|
||||||
|
|
||||||
|
const metaDescription = description || site.siteMetadata.description
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Helmet
|
||||||
|
htmlAttributes={{
|
||||||
|
lang,
|
||||||
|
}}
|
||||||
|
title={title}
|
||||||
|
titleTemplate={site.siteMetadata.title}
|
||||||
|
meta={[
|
||||||
|
{
|
||||||
|
name: `description`,
|
||||||
|
content: metaDescription,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
property: `og:title`,
|
||||||
|
content: title,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
property: `og:description`,
|
||||||
|
content: metaDescription,
|
||||||
|
},
|
||||||
|
].concat(meta)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
SEO.defaultProps = {
|
||||||
|
lang: `ru`,
|
||||||
|
meta: [],
|
||||||
|
description: ``,
|
||||||
|
}
|
||||||
|
|
||||||
|
SEO.propTypes = {
|
||||||
|
description: PropTypes.string,
|
||||||
|
lang: PropTypes.string,
|
||||||
|
meta: PropTypes.arrayOf(PropTypes.object),
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SEO
|
@ -3,12 +3,11 @@
|
|||||||
a.nav-link { margin-top: 25px; max-height: 62px;}
|
a.nav-link { margin-top: 25px; max-height: 62px;}
|
||||||
a.nav-link:hover { background-color: rgb(20, 142, 161); }
|
a.nav-link:hover { background-color: rgb(20, 142, 161); }
|
||||||
a.nav-link a:hover { color: white; text-decoration: none; }
|
a.nav-link a:hover { color: white; text-decoration: none; }
|
||||||
a.nav-link a#active {
|
a[aria-current="page"] {
|
||||||
color: white;
|
color: white;
|
||||||
background-color: rgb(20, 142, 161);
|
background-color: rgb(20, 142, 161);
|
||||||
padding-top: 12px;
|
padding-top: 12px;
|
||||||
padding-bottom: 20px;
|
}
|
||||||
}
|
|
||||||
a.nav-link a {
|
a.nav-link a {
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
color: rgb(212, 212, 212);
|
color: rgb(212, 212, 212);
|
||||||
@ -19,7 +18,7 @@ a.nav-link a {
|
|||||||
/* -------------- logo ----------------------- */
|
/* -------------- logo ----------------------- */
|
||||||
img#logo { opacity: 0.7; margin-top: 20px;}
|
img#logo { opacity: 0.7; margin-top: 20px;}
|
||||||
img#logo:hover { opacity: 1;}
|
img#logo:hover { opacity: 1;}
|
||||||
a[aria-current="page"] img#logo { opacity: 1; margin-top: 20px; }
|
a[aria-current="page"] img#logo { opacity: 1; margin-top: 20px; background-color: rgb(52,58,64); }
|
||||||
/* ------------------------------------------- */
|
/* ------------------------------------------- */
|
||||||
|
|
||||||
/* ----- collapse show ---------------------- */
|
/* ----- collapse show ---------------------- */
|
||||||
@ -29,8 +28,7 @@ a[aria-current="page"] img#logo { opacity: 1; margin-top: 20px; }
|
|||||||
color: white;
|
color: white;
|
||||||
background-color: rgb(20, 142, 161);
|
background-color: rgb(20, 142, 161);
|
||||||
padding-top: 11px;
|
padding-top: 11px;
|
||||||
padding-bottom: 12px;
|
padding-bottom: 12px; }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
button.navbar-toggler.collapsed { margin-top: 0px; margin-left: 15px; }
|
button.navbar-toggler.collapsed { margin-top: 0px; margin-left: 15px; }
|
||||||
@ -57,3 +55,9 @@ div#navbarSupportedContent.navbar-collapse.collapse.show img#logo{ margin: auto;
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0; }
|
padding: 0; }
|
||||||
|
|
||||||
|
|
||||||
|
@media (max-width: 769px) {
|
||||||
|
a[aria-current="page"] img#logo { margin-top: 0; margin-left: 0; padding-left: 15px }
|
||||||
|
a[aria-current="page"] { padding-top: 0 }
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user