removed ssr

This commit is contained in:
Elinorre 2020-01-25 13:48:14 +03:00
parent d9985ba00d
commit e4e1871454
3 changed files with 25 additions and 19 deletions

View File

@ -1,19 +1,21 @@
import React from "react" import React from "react"
import {Link} from "gatsby" import {Link} from "gatsby"
import logo from "../../images/dataforge/df_logo.png" import { globalHistory as history } from '@reach/router'
import logo from "../../images/dataforge/df_logo.png"
import "../../styles/dataforge/header.css" import "../../styles/dataforge/header.css"
import "../../styles/bootstrap.min.css" import "../../styles/bootstrap.min.css"
import {Navbar, Nav} from "react-bootstrap" import {Navbar, Nav} from "react-bootstrap"
const Header = () => { const Header = () => {
let curActive = [' ', ' ', ' ', ' ', ' ', ' ']; let curActive = [' ', ' ', ' ', ' ', ' ', ' '];
if (document.location.pathname === '/dataforge/news'){curActive[0] = 'active';} const { location } = history;
if (document.location.pathname === '/dataforge/docs'){curActive[1] = 'active';} if (location.pathname === '/dataforge/news'){curActive[0] = 'active';}
if (document.location.pathname === '/dataforge/modules'){curActive[2] = 'active';} if (location.pathname === '/dataforge/docs'){curActive[1] = 'active';}
if (document.location.pathname === '/dataforge/releases'){curActive[3] = 'active';} if (location.pathname === '/dataforge/modules'){curActive[2] = 'active';}
if (document.location.pathname === '/dataforge/apps'){curActive[4] = 'active';} if (location.pathname === '/dataforge/releases'){curActive[3] = 'active';}
if (document.location.pathname === '/dataforge/misc'){curActive[5] = 'active';} if (location.pathname === '/dataforge/apps'){curActive[4] = 'active';}
if (location.pathname === '/dataforge/misc'){curActive[5] = 'active';}
return( return(
<header id="df"> <header id="df">

View File

@ -1,17 +1,19 @@
import React from "react" import React from "react"
import { Link } from "gatsby" import { Link } from "gatsby"
import { globalHistory as history } from '@reach/router'
import { push as Menu } from "react-burger-menu" import { push as Menu } from "react-burger-menu"
const SideBar = ( props ) => { const SideBar = ( props ) => {
let curActive = [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']; let curActive = [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '];
if (document.location.pathname === '/dataforge/docs/'){curActive[0] = 'active';} var { location } = history;
if (document.location.pathname === '/dataforge/docs/meta'){curActive[1] = 'active';} if (location.pathname === '/dataforge/docs/'){curActive[0] = 'active';}
if (document.location.pathname === '/dataforge/docs/framework'){curActive[2] = 'active';} if (location.pathname === '/dataforge/docs/meta'){curActive[1] = 'active';}
if (document.location.pathname === '/dataforge/docs/data_flow'){curActive[3] = 'active';} if (location.pathname === '/dataforge/docs/framework'){curActive[2] = 'active';}
if (document.location.pathname === '/dataforge/docs/envelopes'){curActive[4] = 'active';} if (location.pathname === '/dataforge/docs/data_flow'){curActive[3] = 'active';}
if (document.location.pathname === '/dataforge/docs/storage'){curActive[5] = 'active';} if (location.pathname === '/dataforge/docs/envelopes'){curActive[4] = 'active';}
if (document.location.pathname === '/dataforge/docs/control'){curActive[6] = 'active';} if (location.pathname === '/dataforge/docs/storage'){curActive[5] = 'active';}
if (document.location.pathname === '/dataforge/docs/extensions'){curActive[7] = 'active';} if (location.pathname === '/dataforge/docs/control'){curActive[6] = 'active';}
if (location.pathname === '/dataforge/docs/extensions'){curActive[7] = 'active';}
return( return(
<Menu {...props}> <Menu {...props}>
<Link className="menu-item" id={`${curActive[0]}`} to="./dataforge/docs/">1 - How to read this documentation</Link> <Link className="menu-item" id={`${curActive[0]}`} to="./dataforge/docs/">1 - How to read this documentation</Link>

View File

@ -5,12 +5,14 @@ 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'
const Header = () => { const Header = ( ) => {
let curActive = [' ', ' ', ' ']; let curActive = [' ', ' ', ' '];
if (document.location.pathname === '/about'){curActive[0] = 'active';} const { location } = history;
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 (location.pathname=== '/about'){curActive[0] = 'active';}
if (document.location.pathname === '/partners'){curActive[2] = 'active';} if (location.pathname=== '/projects/physics' || location.pathname === '/projects/education' || location.pathname === '/projects/math' || location.pathname === '/projects/software'){curActive[1] = 'active';}
if (location.pathname=== '/partners'){curActive[2] = 'active';}
return( return(
<header> <header>