reactStrap + mobile

This commit is contained in:
Elinorre 2020-01-22 18:49:42 +03:00
parent ebb1e7e618
commit 1bed723eac
7 changed files with 108 additions and 118 deletions

View File

@ -1,50 +1,34 @@
import React from "react"
import { Link } from "gatsby"
import PropTypes from "prop-types"
import logo from "../images/index/logo_white.png"
import logo from "../images/index/logo_white.png"
import "bootstrap/dist/css/bootstrap.css"
import "../styles/header.css"
import "bootstrap/dist/js/bootstrap"
import {Navbar, Nav} from "react-bootstrap"
const Header = () => {
let curActive = [' ', ' ', ' '];
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 === '/partners'){curActive[2] = 'active';}
if (document.location.pathname === '/about'){curActive[0] = 'active';}
if (document.location.pathname === '/projects/physics' || document.location.pathname === '/projects/education' || document.location.pathname === '/projects/math' || document.location.pathname === '/projects/software'){curActive[1] = 'active';}
if (document.location.pathname === '/partners'){curActive[2] = 'active';}
return (
return(
<header>
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container">
<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>
</button>
<Navbar bg="dark" expand="lg" fixed="top">
<div className="container">
<Navbar.Toggle aria-controls="basic-navbar-nav" />
<Navbar.Collapse id="basic-navbar-nav">
<Nav className="mr-auto">
<Navbar.Brand><Link to="/"><img src={logo} height="50px" alt="npm logo" id="logo"/></Link></Navbar.Brand>
<Nav.Link href="./about"><Link id={`${curActive[0]}`} to="./about">Группа</Link></Nav.Link>
<Nav.Link href="./about"><Link id={`${curActive[1]}`} to="./projects/physics">Проекты</Link></Nav.Link>
<Nav.Link href="./about"><Link id={`${curActive[2]}`} to="./partners">Партнеры</Link></Nav.Link>
</Nav>
</Navbar.Collapse>
</div>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<Link class="navbar-brand" to="/">
<img src={logo} height="50" class="d-inline-block" alt="mipt-npm" id="logo"/>
</Link>
<ul class="navbar-nav">
<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[2]}`}><Link class="nav-link" to="./partners">Партнеры</Link></li>
</ul>
</div>
</div>
</nav>
</Navbar>
</header>
)
}
Header.propTypes = {
siteTitle: PropTypes.string,
}
Header.defaultProps = {
siteTitle: ``,
}
export default Header

View File

@ -1,13 +1,16 @@
import React from "react"
import { Link, graphql } from "gatsby"
import Layout from "../components/layout"
import head from "../images/index/head.png"
import "../styles/main.css"
import "../styles/bootstrap.min.css"
import {Jumbotron, Button} from "react-bootstrap"
const IndexPage = ({data}) => (
<Layout>
{/* --------------------------------- */}
<div class="jumbotron">
<Jumbotron>
<img src={head} width="90%" class="center-block" alt="head" />
<hr/>
<h3 style = {{color: `rgb(18,64,171)`}}>Лаборатория методов ядерно-физических экспериментов</h3>
@ -27,8 +30,8 @@ const IndexPage = ({data}) => (
<li>Мы применяем самые современные методы в работе на физических экспериментах.</li>
</ul>
<p/>
<p id="button"><Link class="btn btn-lg btn-success" to="./about" role="button">О нашей лаборатории</Link></p>
</div>
<Button variant="success" id="jt"><Link to="./about">О нашей лаборатории</Link></Button>
</Jumbotron>
{/* ------------------------------ */}
<div class="row">
<div class="col-lg-4">
@ -36,7 +39,7 @@ const IndexPage = ({data}) => (
<p> Лаборатория принимает участие в нескольких международных экспериментах в области физики частиц, таких как
эксперимент по безнейтринному двойному бета-распаду GERDA, эксперимент по поиску массы нейтрино Троицк
ню-масс и так далее. </p>
<p><Link class="btn btn-primary" to="./projects/physics" role="button" id="more">Подробнее »</Link></p>
<Button variant="primary" id="more"><Link to="./projects/physics">Подробнее »</Link></Button>
</div>
<div class="col-lg-4">
<h2> Образование </h2>
@ -44,7 +47,7 @@ const IndexPage = ({data}) => (
эксперимента, а также совершенствование существующей методической и информационной базы в МФТИ и
академических институтах.
</p>
<p><Link class="btn btn-primary" to="./projects/education" role="button" id="more">Подробнее »</Link></p>
<Button variant="primary" id="more"><Link to="./projects/education">Подробнее »</Link></Button>
</div>
<div class="col-lg-4">
<h2> Компьютерные методы </h2>
@ -52,7 +55,7 @@ const IndexPage = ({data}) => (
Одним из основных направлений деятельности является разработка вычислительных методов и открытого
программного обеспечения для использования в образовании и научной деятельности.
</p>
<p><Link class="btn btn-primary" to="./projects/software" role="button" id="more">Подробнее »</Link></p>
<Button variant="primary" id="more"><Link to="./projects/software">Подробнее »</Link></Button>
</div>
</div>
<hr style={{marginBottom: `50px`}}/>

View File

@ -7,10 +7,10 @@ const PhysicsPage = (props) => {
return(
<Layout>
<ul class="nav nav-tabs">
<li class="nav-item"><Link class="nav-link " to="./projects/physics">Физика</Link></li>
<li class="nav-item"><Link class="nav-link active" to="./projects/education">Образование</Link></li>
<li class="nav-item"><Link class="nav-link " to="./projects/math">Математика</Link></li>
<li class="nav-item"><Link class="nav-link " to="./projects/software">Программное обеспечение</Link></li>
<li class="nav-item"><Link id="project" class="nav-link " to="./projects/physics">Физика</Link></li>
<li class="nav-item"><Link id="project" class="nav-link active" to="./projects/education">Образование</Link></li>
<li class="nav-item"><Link id="project" class="nav-link " to="./projects/math">Математика</Link></li>
<li class="nav-item"><Link id="project" class="nav-link " to="./projects/software">Программное обеспечение</Link></li>
</ul>
<h1 style = {{marginTop: `20px`}}> Образовательные проекты </h1>

View File

@ -7,10 +7,10 @@ const PhysicsPage = (props) => {
return(
<Layout>
<ul class="nav nav-tabs">
<li class="nav-item"><Link class="nav-link " to="./projects/physics">Физика</Link></li>
<li class="nav-item"><Link class="nav-link " to="./projects/education">Образование</Link></li>
<li class="nav-item"><Link class="nav-link active" to="./projects/math">Математика</Link></li>
<li class="nav-item"><Link class="nav-link " to="./projects/software">Программное обеспечение</Link></li>
<li class="nav-item"><Link id="project" class="nav-link " to="./projects/physics">Физика</Link></li>
<li class="nav-item"><Link id="project" class="nav-link " to="./projects/education">Образование</Link></li>
<li class="nav-item"><Link id="project" class="nav-link active" to="./projects/math">Математика</Link></li>
<li class="nav-item"><Link id="project" class="nav-link " to="./projects/software">Программное обеспечение</Link></li>
</ul>
<h1 style = {{marginTop: `20px`}}> Математические методы </h1>

View File

@ -7,10 +7,10 @@ const PhysicsPage = (props) => {
return(
<Layout>
<ul class="nav nav-tabs">
<li class="nav-item"><Link class="nav-link " to="./projects/physics">Физика</Link></li>
<li class="nav-item"><Link class="nav-link " to="./projects/education">Образование</Link></li>
<li class="nav-item"><Link class="nav-link " to="./projects/math">Математика</Link></li>
<li class="nav-item"><Link class="nav-link active" to="./projects/software">Программное обеспечение</Link></li>
<li class="nav-item"><Link id="project" class="nav-link " to="./projects/physics">Физика</Link></li>
<li class="nav-item"><Link id="project" class="nav-link " to="./projects/education">Образование</Link></li>
<li class="nav-item"><Link id="project" class="nav-link " to="./projects/math">Математика</Link></li>
<li class="nav-item"><Link id="project" class="nav-link active" to="./projects/software">Программное обеспечение</Link></li>
</ul>
<h1 style = {{marginTop: `20px`}}> Научное программное обеспечение </h1>

View File

@ -1,28 +1,50 @@
header {
width: 100%;
left: 0;
top: 0;
position: fixed;
z-index: 1000;
height: 75px;
background-color: rgb(45,45,45);
}
/* ------ navbar ------------------------------ */
.navbar { height: 80px; }
a.nav-link { margin-top: 25px; max-height: 62px;}
a.nav-link:hover { background-color: rgb(20, 142, 161); }
a.nav-link a:hover { color: white; text-decoration: none; }
a.nav-link a#active {
color: white;
background-color: rgb(20, 142, 161);
padding-top: 12px;
padding-bottom: 20px;
}
a.nav-link a {
padding: 12px;
color: rgb(212, 212, 212);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
transition: 0s; }
/* ------------------------------------------- */
/* logo------------------------ */
img#logo { margin-right: 20px; opacity: 0.7; margin-top: 10px;}
/* -------------- logo ----------------------- */
img#logo { opacity: 0.7; margin-top: 20px;}
img#logo:hover { opacity: 1;}
.d-inline-block { margin-bottom: 0; }
a[aria-current="page"]{ opacity: 1; }
/* ----------------------------- */
a[aria-current="page"] img#logo { opacity: 1; margin-top: 20px; }
/* ------------------------------------------- */
/* ----- collapse show ---------------------- */
div#navbarSupportedContent.navbar-collapse.collapse.show {
@media(max-width: 769px) {
img#logo { margin: 0 40px 0 10px; }
a.nav-link {
margin-bottom: 10px;
margin-top: 15px;
margin-right: 60px; }
a.nav-link a#active {
color: white;
background-color: rgb(20, 142, 161);
padding-top: 11px;
padding-bottom: 12px;
}
}
button.navbar-toggler.collapsed { margin-top: 0px; margin-left: 15px; }
button.navbar-toggler { margin-top: 15px; margin-left: 15px; }
div#basic-navbar-nav.navbar-collapse.collapse.show {
width: 100px;
padding-bottom: 230px;
text-align: center;
background-color: rgb(45,45,45); }
button.navbar-toggler { background-color: rgb(20, 142, 161); margin-bottom: 15px; }
background-color: rgb(52,58,64); }
button.navbar-toggler { background-color: rgb(20, 142, 161); }
div#navbarSupportedContent.navbar-collapse.collapse.show img#logo{ margin: auto; }
/* ------------------------------------------- */
@ -34,14 +56,6 @@ div#navbarSupportedContent.navbar-collapse.collapse.show img#logo{ margin: auto;
max-height: 56px;
text-align: left; }
.nav-item {
font-size: 20px;
font-family: Arial, Helvetica, sans-serif;
margin: 5px 0px 5px 15px;
height: 50px;
padding: 0px;
text-decoration: rgb(255, 254, 254); }
.container {
max-width: 1160px;
width: 100%;

View File

@ -1,30 +1,14 @@
main { margin-top: 65px; }
/* ----- navbar ----------------------------- */
.navbar-light .navbar-nav .nav-link { color: rgb(190, 190, 190); }
.navbar-light .navbar-nav .nav-link:hover { color: white; }
.navbar-light .navbar-nav .nav-item:hover { background-color: rgb(20, 142, 161); padding-bottom: 15px; }
.navbar-light .navbar-nav .nav-item.active{ color: rgb(190, 190, 190); }
li.nav-item {margin-bottom: 25px; }
ul.navbar-nav { margin-bottom: -8px; align-items: center;}
ul.navbar-nav .nav-item a.nav-link { padding: 15px; }
a[aria-current="page"] img#logo { opacity: 1; margin-top: 0px; }
a.navbar-brand img#logo { margin: 0 }
ul.navbar-nav li.nav-item.active a.nav-link {
background-color:rgb(20, 142, 161);
padding-bottom: 15px;
color: white; }
ul.navbar-nav li.nav-item a.nav-link:hover {
padding-bottom: 15px;
background-color:rgb(20, 142, 161);
transition: 0s; }
/* ----------------------------------- */
main { margin-top: 75px; }
/* ---- projects navbar ---------------------- */
ul.nav.nav-tabs { margin-top: 75px; }
a.nav-link#project:hover { padding-bottom: 7px; color: rgb(0, 86, 179); }
ul.nav-tabs a.nav-link.active { background-color: rgb(230, 230, 230); }
a.nav-link#project:hover {
padding-bottom: 7px;
color: rgb(0, 0, 0);
text-decoration: none;
background-color: rgb(228, 228, 228); }
ul.nav-tabs a.nav-link.active { color: black; background-color: rgb(190, 190, 190); }
ul.nav-tabs a.nav-link, ul.nav-tabs a.nav-link.active {
border-radius: 0;
padding: 7px 22px 7px 22px;
@ -33,26 +17,27 @@ ul.nav-tabs a.nav-link, ul.nav-tabs a.nav-link.active {
/* ------- news & main content ----------------------------- */
div.container main a { color: rgb(0, 86, 179); }
a:hover { color: rgb(0, 86, 179); text-decoration: underline;}
div.container main a:hover { color: rgb(1, 66, 136); text-decoration: underline;}
.jumbotron {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
padding: 60px 40px 30px 40px;
margin-bottom: 35px;
background-color: rgb(247,247,247);
border: 1px solid rgb(219, 219, 219); }
border: 1.5px solid rgb(219, 219, 219); }
p#button a.btn.btn-lg.btn-success:hover { background-color: rgb(9, 110, 88); }
p#button a.btn.btn-lg.btn-success {
button#jt:hover { background-color: rgb(9, 110, 88); }
button#jt a { color: white; }
button#jt a:hover { text-decoration: none; }
button#jt {
font-size: 25px;
color: white;
background-color: rgb(14, 156, 125);
border: rgb(0,99,99); }
a#more { font-size: 20px; }
a#more.btn.btn-primary:hover { background-color: rgb(34, 76, 104); }
a#more.btn.btn-primary {
button#more a { font-size: 20px; color: white; }
button#more a:hover { text-decoration: none; }
button#more:hover { background-color: rgb(34, 76, 104); }
button#more {
color: white;
background-color: rgb(51, 113, 155);
border: rgb(36,88,122); }
@ -60,8 +45,7 @@ a#more.btn.btn-primary {
h2.title {
background-color: rgb(247, 247, 247);
padding: 15px;
border: 2px solid #E8E4E4;
}
border: 2px solid #E8E4E4; }
span#date {
color: white;
@ -108,5 +92,10 @@ span.katex-html{color: rgb(0, 0, 0); font-weight: 500;}
button#togglerButton.navbar-toggler.collapsed {
margin-top: 10px;
margin-left: 10px; }
a.nav-link#project {
margin-bottom: 10px;
margin-right: 0;
border: 1px solid rgb(202, 202, 202); }
a.nav-link#project.active { color: black; }
}
/* ------------------------------------------------------- */