collapse and mobile

This commit is contained in:
Elinorre 2020-01-19 01:52:07 +03:00
parent ca8572c119
commit d67360905e
4 changed files with 29 additions and 9 deletions

View File

@ -1,11 +1,16 @@
import React from "react"
import { Link } from "gatsby" import { Link } from "gatsby"
import PropTypes from "prop-types" import PropTypes from "prop-types"
import React from "react"
import logo from "../images/index/npm-logo-no-text.svg" import logo from "../images/index/npm-logo-no-text.svg"
import "../styles/header.css" import "../styles/header.css"
import "../styles/bootstrap.min.css" import "../styles/bootstrap.min.css"
import $ from "jquery/dist/jquery"
import "bootstrap/dist/js/bootstrap"
const Header = () => { const Header = () => {
let curActive = [' ', ' ', ' ']; let curActive = [' ', ' ', ' '];
if (window.location.pathname === '/about'){curActive[0] = 'active';} if (window.location.pathname === '/about'){curActive[0] = 'active';}
if (window.location.pathname === '/projects/physics' || window.location.pathname === '/projects/education' || window.location.pathname === '/projects/math' || window.location.pathname === '/projects/software'){curActive[1] = 'active';} if (window.location.pathname === '/projects/physics' || window.location.pathname === '/projects/education' || window.location.pathname === '/projects/math' || window.location.pathname === '/projects/software'){curActive[1] = 'active';}
@ -13,18 +18,19 @@ const Header = () => {
return ( return (
<header> <header>
<nav class="navbar fixed-top navbar-expand-lg navbar-light bg-light"> <nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container"> <div class="container">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <div class="navbar-header">
<button class="navbar-toggler" id="togglerButton" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
</div>
<div class="collapse navbar-collapse" id="navbarSupportedContent"> <div class="collapse navbar-collapse" id="navbarSupportedContent">
<Link class="navbar-brand" to="/"> <Link class="navbar-brand" to="/">
<img src={logo} height="40" class="d-inline-block" alt="mipt-npm"/> <img src={logo} height="40" class="d-inline-block" alt="mipt-npm"/>
</Link> </Link>
<ul class="navbar-nav"> <ul class="navbar-nav">
<li class="nav-item active "><Link class="nav-link" to="./"><span class="glyphicon glyphicon-home"></span></Link></li>
<li class={`nav-item ${curActive[0]}`}><Link class="nav-link" to="./about">Группа</Link></li> <li class={`nav-item ${curActive[0]}`}><Link class="nav-link" to="./about">Группа</Link></li>
<li class={`nav-item ${curActive[1]}`}><Link class="nav-link" to="./projects/physics">Проекты</Link></li> <li class={`nav-item ${curActive[1]}`}><Link class="nav-link" to="./projects/physics">Проекты</Link></li>
<li class={`nav-item ${curActive[2]}`}><Link class="nav-link" to="./partners">Партнеры</Link></li> <li class={`nav-item ${curActive[2]}`}><Link class="nav-link" to="./partners">Партнеры</Link></li>

View File

@ -3,6 +3,7 @@ import PropTypes from "prop-types"
import Header from "./header" import Header from "./header"
import Footer from "./footer" import Footer from "./footer"
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"
@ -12,7 +13,7 @@ const Layout = ({ children }) => {
return ( return (
<> <>
<Header siteTitle="NPM group" /> <Header siteTitle="NPM group" />
<div class = "container" style = {{paddingTop: `70px`}}> <div class = "container">
<main>{children}</main> <main>{children}</main>
</div> </div>
<Footer/> <Footer/>

View File

@ -1,11 +1,15 @@
header { background: rgb(248,249,250); } header { background: rgb(248,249,250); width: 100%; left: 0; top: 0; position: fixed; z-index: 1000;}
.d-inline-block { margin-bottom: 0; } .d-inline-block { margin-bottom: 0; }
.navbar-nav.mr-auto { margin-left: 0px; }
.nav-item.active { margin-right: 0px; margin-left: 0px;} .nav-item.active { margin-right: 0px; margin-left: 0px;}
.navbar.fixed-top { padding: 10px 20px 10px 20px; } /* .navbar.fixed-top { padding: 10px 20px 10px 20px; position: fixed; } */
a.navbar-brand { margin-right: 0px; } a.navbar-brand { margin-right: 0px; }
div#navbarSupportedContent.navbar-collapse.collapse.show {
padding-bottom: 200px;
text-align: center;
}
#navbarSupportedContent { #navbarSupportedContent {
width: 100%; width: 100%;
max-width: 1880px; max-width: 1880px;
@ -29,6 +33,10 @@ a.navbar-brand { margin-right: 0px; }
margin: 0; margin: 0;
padding: 0; } padding: 0; }
.navbar-nav.active {
background-color: rgb(248,249,250);
}
.navbar-light .navbar-nav .active>.nav-link, .navbar-light .navbar-nav .nav-link.active, .navbar-light .navbar-nav .nav-link.show, .navbar-light .navbar-nav .show>.nav-link{ .navbar-light .navbar-nav .active>.nav-link, .navbar-light .navbar-nav .nav-link.active, .navbar-light .navbar-nav .nav-link.show, .navbar-light .navbar-nav .show>.nav-link{
color: black; color: black;
} }

View File

@ -11,16 +11,21 @@ body {
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.container { .container {
max-width: 1160px; max-width: 1160px;
width: 100%; width: 100%;
margin: 0 auto; margin: 0 auto;
padding: 0px 15px 0 15px; padding: 0px 15px 0 15px;
padding-top: 0; padding-top: 0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-family: Arial, Helvetica, sans-serif;
font-weight: 400; font-weight: 400;
} }
main { margin-top: 17%; }
@media (min-width: 769px) { main { margin-top: 6%; }}
img.gatsby-resp-image-image{ img.gatsby-resp-image-image{
max-width: 750px; max-width: 750px;
max-height: 550px; max-height: 550px;