Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Front - Footer, misc styling fixes #583

Merged
merged 6 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, { useEffect } from 'react';
import PropTypes from 'proptypes';
import { connect } from 'react-redux';
import { HashRouter as Router } from 'react-router-dom';
import { HashRouter as Router, Switch, Route } from 'react-router-dom';

import { getMetadataRequest } from '@reducers/metadata';

import Routes from './Routes';
import Header from './components/main/header/Header';
import Footer from './components/main/footer/Footer';
import StaticFooter from './components/main/footer/StaticFooter';
import { SnapshotRenderer } from './components/export/SnapshotService';

const basename = process.env.NODE_ENV === 'development' ? '/' : process.env.BASE_URL || '/';
Expand All @@ -23,7 +24,10 @@ const App = ({
<Router basename={basename}>
<Header />
<Routes />
<Footer />
<Switch>
<Route path="/(about|contact)" component={StaticFooter} />
<Route path="/" component={Footer} />
</Switch>
<SnapshotRenderer />
</Router>
);
Expand Down
59 changes: 29 additions & 30 deletions src/components/main/footer/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@
import React from 'react';
import { connect } from 'react-redux';
import { Switch, Route } from 'react-router-dom';
import propTypes from 'proptypes';
import moment from 'moment';
import clx from 'classnames';
import HoverOverInfo from '@components/common/HoverOverInfo';
import StaticFooter from './StaticFooter';

const Footer = ({
lastUpdated,
version,
backendSha,
menuIsOpen,
}) => {
const frontendSha = process.env.GITHUB_SHA || 'DEVELOPMENT';
return (
<footer className="navbar has-navbar-fixed-bottom">
<Switch>
<Route path="/(about|contact)" component={StaticFooter} />
<Route path="/">
{ lastUpdated && (
<span className="last-updated">
Data Updated Through:
&nbsp;
{moment(1000 * lastUpdated).format('MMMM Do YYYY, h:mm:ss a')}
</span>
)}
{ version && backendSha && (
<span className="version">
<HoverOverInfo
position="top"
text={[
frontendSha.substr(0, 7),
backendSha.substr(0, 7),
]}
>
Version
&nbsp;
{ version }
</HoverOverInfo>
</span>
)}
</Route>
</Switch>
<footer
className={clx('navbar has-navbar-fixed-bottom', { 'menu-is-open': menuIsOpen })}
>
{ lastUpdated && (
<span className="last-updated">
Data Updated Through:
&nbsp;
{moment(1000 * lastUpdated).format('MMMM Do YYYY, h:mm:ss a')}
</span>
)}
{ version && backendSha && (
<span className="version">
<HoverOverInfo
position="top"
text={[
frontendSha.substr(0, 7),
backendSha.substr(0, 7),
]}
>
Version
&nbsp;
{ version }
</HoverOverInfo>
</span>
)}
</footer>
);
};
Expand All @@ -49,12 +46,14 @@ const mapStateToProps = state => ({
lastUpdated: state.metadata.lastPulled,
version: state.metadata.version,
backendSha: state.metadata.gitSha,
menuIsOpen: state.ui.menu.isOpen,
});

Footer.propTypes = {
lastUpdated: propTypes.number,
version: propTypes.string,
backendSha: propTypes.string,
menuIsOpen: propTypes.bool.isRequired,
};

Footer.defaultProps = {
Expand Down
4 changes: 2 additions & 2 deletions src/components/main/footer/StaticFooter.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

const StaticFooter = () => (
<>
<footer className="navbar has-navbar-fixed-bottom">
<div className="static-footer level-left">
&copy;2020 311 Data
&nbsp;|&nbsp;
Expand All @@ -17,7 +17,7 @@ const StaticFooter = () => (
{/* **** NEED TO REPLACE HREF WITH VALID LINK WHEN AVAILABLE **** */}
<a href="/">Privacy Policy</a>
</div>
</>
</footer>
);

export default StaticFooter;
6 changes: 6 additions & 0 deletions src/styles/main/_footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ footer.navbar {
background: $brand-main-color;
color: $brand-bg-color;
text-align: center;
transition: all 0.5s ease 0s;

&.menu-is-open {
width: calc(100vw - #{$menu-width});
margin-left: $menu-width;
}

.last-updated {
display: inline-block;
Expand Down
1 change: 0 additions & 1 deletion src/styles/main/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
font-family: $brand-heading-family;
font-weight: bold;
height: $header-height;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
z-index: $z-navbar;
background-color: $brand-heading-color;

Expand Down
3 changes: 2 additions & 1 deletion src/styles/menu/_menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
position: absolute;
left: 0;
top: 0;
bottom: 0;
bottom: -$footer-height;
width: $menu-width;
z-index: $z-menu;
background: $brand-bg-color;
Expand Down Expand Up @@ -39,6 +39,7 @@
width: 26px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
border-radius: 0;
border: none;
}

.menu-content {
Expand Down