...
 
Commits (3)
......@@ -5,8 +5,8 @@ nav {
}
nav li:first-child {
display: flex;
align-items: center;
display: flex;
}
nav li:first-child a {
......@@ -23,6 +23,11 @@ a.nav-link {
width: 100%;
}
a.nav-link.active {
background-color: #333;
border: 0;
}
.nav-link:focus,
.nav-link:hover {
background-color: #111;
......@@ -59,13 +64,14 @@ nav li {
overflow: hidden;
padding: 1rem 0;
text-transform: uppercase;
transition: .5s ease-in-out;
transition: .2s ease-in-out;
user-select: none;
width: 32px;
}
.nav-open .nav-toggle {
transform: rotate(180deg);
transition: .5s ease-in-out;
transition: .2s ease-in-out;
}
.nav-open li {
......@@ -105,7 +111,6 @@ nav li {
a.nav-link.active {
background-clip: padding-box;
background-color: #333;
border-bottom: 4px solid rgba(191, 63, 191, .25);
margin-bottom: -4px;
}
......
......@@ -7,6 +7,7 @@ import React from 'react';
import cx from 'classnames';
import Link from './Link';
import inBrowser from '../../common/inBrowser';
import nullthrows from '../../common/nullthrows';
if (inBrowser) {
require('./Nav.css');
......@@ -52,6 +53,25 @@ export default class Nav extends React.Component<{}, {isOpen: boolean}> {
this.state = {isOpen: false};
}
componentDidMount() {
nullthrows(document.body).addEventListener('click', this._handleClick);
}
componentWillUnmount() {
nullthrows(document.body).removeEventListener('click', this._handleClick);
}
_handleClick = (event: Event) => {
const element = event.target;
if (
this.state.isOpen &&
element instanceof HTMLElement &&
element.className !== 'nav-toggle'
) {
this.setState({isOpen: false});
}
};
_handleToggle = (event: SyntheticEvent<HTMLDivElement>) => {
event.preventDefault();
this.setState(({isOpen}) => ({isOpen: !isOpen}));
......
......@@ -68,11 +68,11 @@ export async function loadContent(options: LoaderOptions): Promise<*> {
await forEachCommit(commits, ({createdAt, file, updatedAt}) => {
timestamps.cache[file] = timestamps.cache[file] || {};
timestamps.cache[file].createdAt = Math.min(
createdAt,
Number(createdAt),
timestamps.cache[file].createdAt || Infinity,
);
timestamps.cache[file].updatedAt = Math.max(
updatedAt,
Number(updatedAt),
timestamps.cache[file].updatedAt || -Infinity,
);
});
......