feat: keyboard accessibility in navbar
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"short_name": "React App",
|
"name": "Sol Journal",
|
||||||
"name": "Create React App Sample",
|
"short_name": "Sol Journal",
|
||||||
|
"start_url": "/",
|
||||||
|
"display": "standalone",
|
||||||
|
"theme_color": "#2E3136",
|
||||||
|
"background_color": "#FAFBFC",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "favicon.ico",
|
"src": "favicon.ico",
|
||||||
"sizes": "64x64 32x32 24x24 16x16",
|
"sizes": "64x64 32x32 24x24 16x16",
|
||||||
"type": "image/x-icon"
|
"type": "image/x-icon"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"start_url": ".",
|
|
||||||
"display": "standalone",
|
|
||||||
"theme_color": "#000000",
|
|
||||||
"background_color": "#ffffff"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,19 +17,24 @@ const IconBase = styled.div`
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: none;
|
background-color: transparent;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
transition: 0.1s all ease-in-out;
|
transition: 0.1s all ease-in-out;
|
||||||
color: ${props => props.theme.colors.secondary};
|
color: ${props => props.theme.colors.secondary};
|
||||||
|
&:focus {
|
||||||
|
outline: none;
|
||||||
|
box-shadow: 0 0 0 3px ${props => props.theme.colors.bodyBackground},
|
||||||
|
0 0 0 5px ${props => props.theme.colors.hover};
|
||||||
|
}
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: ${props => !props.disabled && props.theme.colors.hover};
|
background-color: ${props => !props.disabled && props.theme.colors.hover};
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const Icon = ({ name, ...rest }) => (
|
const Icon = ({ name, tabindex, ...rest }) => (
|
||||||
<IconBase {...rest}>
|
<IconBase tabIndex={tabindex} {...rest}>
|
||||||
{name === "Book" && <Book />}
|
{name === "Book" && <Book />}
|
||||||
{name === "Calendar" && <Calendar />}
|
{name === "Calendar" && <Calendar />}
|
||||||
{name === "ChevronLeft" && <ChevronLeft />}
|
{name === "ChevronLeft" && <ChevronLeft />}
|
||||||
|
|||||||
@@ -70,13 +70,15 @@ const Navbar = ({ authUser, theme, toggleTheme }) => (
|
|||||||
<Link to={yearUrl()}>
|
<Link to={yearUrl()}>
|
||||||
<Icon name="Calendar" />
|
<Icon name="Calendar" />
|
||||||
</Link>
|
</Link>
|
||||||
<Icon
|
|
||||||
onClick={() => toggleTheme()}
|
|
||||||
name={theme.name === "Dark" ? "Sun" : "Moon"}
|
|
||||||
/>
|
|
||||||
<Link to={"/user"}>
|
<Link to={"/user"}>
|
||||||
<Icon name="User" />
|
<Icon name="User" />
|
||||||
</Link>
|
</Link>
|
||||||
|
<Icon
|
||||||
|
tabindex={0}
|
||||||
|
onClick={() => toggleTheme()}
|
||||||
|
onKeyPress={() => toggleTheme()}
|
||||||
|
name={theme.name === "Dark" ? "Sun" : "Moon"}
|
||||||
|
/>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
) : (
|
) : (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React, { Component } from "react"
|
import React, { Component } from "react"
|
||||||
import styled from "@emotion/styled"
|
import styled from "@emotion/styled"
|
||||||
|
import { css, keyframes } from "@emotion/core"
|
||||||
import { compose } from "recompose"
|
import { compose } from "recompose"
|
||||||
import { withRouter } from "react-router-dom"
|
import { withRouter } from "react-router-dom"
|
||||||
import { withTheme } from "emotion-theming"
|
import { withTheme } from "emotion-theming"
|
||||||
@@ -31,7 +32,7 @@ const JournalEntryArea = styled.textarea`
|
|||||||
resize: none;
|
resize: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
font-size: ${SIZES.small};
|
font-size: ${SIZES.small};
|
||||||
border-radius: 3px;
|
border-radius: 1px;
|
||||||
margin-top: ${SIZES.tiny};
|
margin-top: ${SIZES.tiny};
|
||||||
padding-top: 0px;
|
padding-top: 0px;
|
||||||
padding-bottom: 0px;
|
padding-bottom: 0px;
|
||||||
@@ -43,6 +44,18 @@ const JournalEntryArea = styled.textarea`
|
|||||||
0 0 0 10px ${props => props.theme.colors.hover};
|
0 0 0 10px ${props => props.theme.colors.hover};
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
const fadeKeyFrames = keyframes`
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
const LoadingSpinner = styled(BeatLoader)`
|
||||||
|
opacity: 0;
|
||||||
|
animation: fadein 2s;
|
||||||
|
`
|
||||||
|
|
||||||
const AUTOSAVE_DELAY = 2000
|
const AUTOSAVE_DELAY = 2000
|
||||||
|
|
||||||
@@ -165,7 +178,14 @@ class Day extends Component {
|
|||||||
{loading ? (
|
{loading ? (
|
||||||
// <JournalEntryArea disabled placeholder="Loading..." />
|
// <JournalEntryArea disabled placeholder="Loading..." />
|
||||||
<div style={{ marginTop: 10 }}>
|
<div style={{ marginTop: 10 }}>
|
||||||
<BeatLoader color={theme.colors.tertiary} size={10} margin="4px" />
|
<LoadingSpinner
|
||||||
|
color={theme.colors.tertiary}
|
||||||
|
size={10}
|
||||||
|
margin="4px"
|
||||||
|
css={css`
|
||||||
|
animation: ${fadeKeyFrames} 1s ease-in;
|
||||||
|
`}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<JournalEntryArea
|
<JournalEntryArea
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class LoginFormBase extends Component {
|
|||||||
.doSignInWithEmailAndPassword(email, password)
|
.doSignInWithEmailAndPassword(email, password)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.setState({ email: "", password: "", error: null })
|
this.setState({ email: "", password: "", error: null })
|
||||||
this.props.history.push(format(new Date(), "/YYYY/MM/DD"))
|
this.props.history.push(format(new Date(), "/"))
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.setState({ error })
|
this.setState({ error })
|
||||||
|
|||||||
Reference in New Issue
Block a user