Skip to content

Run Prettier & Icons within Buttons for Accessibility #2

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

Merged
merged 2 commits into from
Dec 12, 2018
Merged
Changes from 1 commit
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
Prev Previous commit
run prettier on all files
  • Loading branch information
rwieruch committed Dec 12, 2018
commit 3893f386849bebe4f5045793c844f79bf7c9e0d8
47 changes: 38 additions & 9 deletions src/components/Account/index.js
Original file line number Diff line number Diff line change
@@ -10,7 +10,14 @@ import { withFirebase } from '../Firebase';
import { PasswordForgetForm } from '../PasswordForget';
import PasswordChangeForm from '../PasswordChange';

import {Grid, Card, Header, Message, Form, Button } from 'semantic-ui-react'
import {
Grid,
Card,
Header,
Message,
Form,
Button,
} from 'semantic-ui-react';

const SIGN_IN_METHODS = [
{
@@ -35,7 +42,7 @@ const AccountPage = () => (
<AuthUserContext.Consumer>
{authUser => (
<div>
<Header as='h2'>Account: {authUser.email}</Header>
<Header as="h2">Account: {authUser.email}</Header>
<Grid columns={2}>
<Grid.Column>
<Card fluid={true}>
@@ -121,9 +128,11 @@ class LoginManagementBase extends Component {
<Card.Content>
<Card.Header>Sign In Methods</Card.Header>
<Card.Description>
{error && <Message negative>
<p>{error.message}</p>
</Message>}
{error && (
<Message negative>
<p>{error.message}</p>
</Message>
)}
<div>
{SIGN_IN_METHODS.map(signInMethod => {
const onlyOneLeft = activeSignInMethods.length === 1;
@@ -175,7 +184,15 @@ const SocialLoginToggle = ({
}) =>
isEnabled ? (
<Button
color={signInMethod.id === 'google.com' ? 'google plus' : signInMethod.id === 'facebook.com' ? 'facebook' : signInMethod.id === 'twitter.com' ? 'twitter' : ''}
color={
signInMethod.id === 'google.com'
? 'google plus'
: signInMethod.id === 'facebook.com'
? 'facebook'
: signInMethod.id === 'twitter.com'
? 'twitter'
: ''
}
type="button"
onClick={() => onUnlink(signInMethod.id)}
disabled={onlyOneLeft}
@@ -184,7 +201,15 @@ const SocialLoginToggle = ({
</Button>
) : (
<Button
color={signInMethod.id === 'google.com' ? 'google plus' : signInMethod.id === 'facebook.com' ? 'facebook' : signInMethod.id === 'twitter.com' ? 'twitter' : ''}
color={
signInMethod.id === 'google.com'
? 'google plus'
: signInMethod.id === 'facebook.com'
? 'facebook'
: signInMethod.id === 'twitter.com'
? 'twitter'
: ''
}
type="button"
onClick={() => onLink(signInMethod.provider)}
>
@@ -225,14 +250,18 @@ class DefaultLoginToggle extends Component {

return isEnabled ? (
<span>
<Button type="button" onClick={() => onUnlink(signInMethod.id)} disabled={onlyOneLeft}>
<Button
type="button"
onClick={() => onUnlink(signInMethod.id)}
disabled={onlyOneLeft}
>
Deactivate {signInMethod.id}
</Button>
<br />
</span>
) : (
<Form onSubmit={this.onSubmit}>
<Form.Group widths='equal'>
<Form.Group widths="equal">
<Form.Field>
<label>New Password</label>
<input
2 changes: 1 addition & 1 deletion src/components/Admin/index.js
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ import { Header } from 'semantic-ui-react';

const AdminPage = () => (
<div>
<Header as='h2'>Admin</Header>
<Header as="h2">Admin</Header>
<p>The Admin Page is accessible by every signed in admin user.</p>

<Switch>
23 changes: 11 additions & 12 deletions src/components/App/index.js
Original file line number Diff line number Diff line change
@@ -13,24 +13,23 @@ import AdminPage from '../Admin';
import * as ROUTES from '../../constants/routes';
import { withAuthentication } from '../Session';

import { Container } from 'semantic-ui-react'
import { Container } from 'semantic-ui-react';

const App = () => (
<Router>
<div>
<Navigation />
<Container>

<Route exact path={ROUTES.LANDING} component={LandingPage} />
<Route path={ROUTES.SIGN_UP} component={SignUpPage} />
<Route path={ROUTES.SIGN_IN} component={SignInPage} />
<Route
path={ROUTES.PASSWORD_FORGET}
component={PasswordForgetPage}
/>
<Route path={ROUTES.HOME} component={HomePage} />
<Route path={ROUTES.ACCOUNT} component={AccountPage} />
<Route path={ROUTES.ADMIN} component={AdminPage} />
<Route exact path={ROUTES.LANDING} component={LandingPage} />
<Route path={ROUTES.SIGN_UP} component={SignUpPage} />
<Route path={ROUTES.SIGN_IN} component={SignInPage} />
<Route
path={ROUTES.PASSWORD_FORGET}
component={PasswordForgetPage}
/>
<Route path={ROUTES.HOME} component={HomePage} />
<Route path={ROUTES.ACCOUNT} component={AccountPage} />
<Route path={ROUTES.ADMIN} component={AdminPage} />
</Container>
</div>
</Router>
2 changes: 1 addition & 1 deletion src/components/Messages/MessageList.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import React from 'react';

import MessageItem from './MessageItem';

import { Feed } from 'semantic-ui-react'
import { Feed } from 'semantic-ui-react';

const MessageList = ({
messages,
40 changes: 8 additions & 32 deletions src/components/Navigation/index.js
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import SignOutButton from '../SignOut';
import * as ROUTES from '../../constants/routes';
import * as ROLES from '../../constants/roles';

import { Container, Menu } from 'semantic-ui-react'
import { Container, Menu } from 'semantic-ui-react';

const Navigation = () => (
<AuthUserContext.Consumer>
@@ -23,27 +23,11 @@ const Navigation = () => (
const NavigationAuth = ({ authUser }) => (
<Menu pointing secondary>
<Container>
<Menu.Item
name='Landing'
as={Link}
to={ROUTES.LANDING}
/>
<Menu.Item
name='home'
as={Link}
to={ROUTES.HOME}
/>
<Menu.Item
name='Account'
as={Link}
to={ROUTES.ACCOUNT}
/>
<Menu.Item name="Landing" as={Link} to={ROUTES.LANDING} />
<Menu.Item name="home" as={Link} to={ROUTES.HOME} />
<Menu.Item name="Account" as={Link} to={ROUTES.ACCOUNT} />
{authUser.roles.includes(ROLES.ADMIN) && (
<Menu.Item
name='Admin'
as={Link}
to={ROUTES.ADMIN}
/>
<Menu.Item name="Admin" as={Link} to={ROUTES.ADMIN} />
)}
<SignOutButton />
</Container>
@@ -53,17 +37,9 @@ const NavigationAuth = ({ authUser }) => (
const NavigationNonAuth = () => (
<Menu pointing secondary>
<Container>
<Menu.Item
name='home'
as={Link}
to={ROUTES.LANDING}
/>
<Menu.Menu position='right'>
<Menu.Item
name='signin'
as={Link}
to={ROUTES.SIGN_IN}
/>
<Menu.Item name="home" as={Link} to={ROUTES.LANDING} />
<Menu.Menu position="right">
<Menu.Item name="signin" as={Link} to={ROUTES.SIGN_IN} />
</Menu.Menu>
</Container>
</Menu>
12 changes: 7 additions & 5 deletions src/components/PasswordChange/index.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import React, { Component } from 'react';

import { withFirebase } from '../Firebase';

import { Form, Message, Button } from 'semantic-ui-react'
import { Form, Message, Button } from 'semantic-ui-react';

const INITIAL_STATE = {
passwordOne: '',
@@ -44,10 +44,12 @@ class PasswordChangeForm extends Component {

return (
<Form onSubmit={this.onSubmit}>
{error && <Message negative>
<p>{error.message}</p>
</Message>}
<Form.Group widths='equal'>
{error && (
<Message negative>
<p>{error.message}</p>
</Message>
)}
<Form.Group widths="equal">
<Form.Field>
<label>Old Password</label>
<input
20 changes: 15 additions & 5 deletions src/components/PasswordForget/index.js
Original file line number Diff line number Diff line change
@@ -4,12 +4,20 @@ import { Link } from 'react-router-dom';
import { withFirebase } from '../Firebase';
import * as ROUTES from '../../constants/routes';

import {Grid, Form, Header, Button, Message} from 'semantic-ui-react'
import {
Grid,
Form,
Header,
Button,
Message,
} from 'semantic-ui-react';

const PasswordForgetPage = () => (
<Grid centered columns={2}>
<Grid.Column>
<Header as='h2' textAlign='center'>Password Forget</Header>
<Header as="h2" textAlign="center">
Password Forget
</Header>
<PasswordForgetForm />
</Grid.Column>
</Grid>
@@ -53,9 +61,11 @@ class PasswordForgetFormBase extends Component {

return (
<div>
{error && <Message negative>
<p>{error.message}</p>
</Message>}
{error && (
<Message negative>
<p>{error.message}</p>
</Message>
)}
<Form onSubmit={this.onSubmit}>
<Form.Field>
<label>Email</label>
68 changes: 44 additions & 24 deletions src/components/SignIn/index.js
Original file line number Diff line number Diff line change
@@ -7,12 +7,22 @@ import { PasswordForgetLink } from '../PasswordForget';
import { withFirebase } from '../Firebase';
import * as ROUTES from '../../constants/routes';

import { Grid, Form, Button, Header, Icon, Message, Divider } from 'semantic-ui-react';
import {
Grid,
Form,
Button,
Header,
Icon,
Message,
Divider,
} from 'semantic-ui-react';

const SignInPage = () => (
<Grid centered columns={2}>
<Grid.Column>
<Header as='h2' textAlign='center'>Sign In</Header>
<Header as="h2" textAlign="center">
Sign In
</Header>
<SignInForm />
<SignInGoogle />
<SignInFacebook />
@@ -72,9 +82,11 @@ class SignInFormBase extends Component {

return (
<div>
{error && <Message negative>
<p>{error.message}</p>
</Message>}
{error && (
<Message negative>
<p>{error.message}</p>
</Message>
)}
<Form onSubmit={this.onSubmit}>
<Form.Field>
<label>Email</label>
@@ -96,7 +108,9 @@ class SignInFormBase extends Component {
placeholder="Password"
/>
</Form.Field>
<Button primary disabled={isInvalid} type='submit'>Submit</Button>
<Button primary disabled={isInvalid} type="submit">
Submit
</Button>
<PasswordForgetLink />
<Divider horizontal>Or sign in with</Divider>
</Form>
@@ -142,14 +156,16 @@ class SignInGoogleBase extends Component {
const { error } = this.state;

return (
<form onSubmit={this.onSubmit} className='inline'>
<Button color='google plus' type="submit">
<Icon name='google' /> Google
<form onSubmit={this.onSubmit} className="inline">
<Button color="google plus" type="submit">
<Icon name="google" /> Google
</Button>

{error && <Message negative>
<p>{error.message}</p>
</Message>}
{error && (
<Message negative>
<p>{error.message}</p>
</Message>
)}
</form>
);
}
@@ -192,14 +208,16 @@ class SignInFacebookBase extends Component {
const { error } = this.state;

return (
<form onSubmit={this.onSubmit} className='inline'>
<Button color='facebook' type="submit">
<Icon name='facebook' /> Facebook
<form onSubmit={this.onSubmit} className="inline">
<Button color="facebook" type="submit">
<Icon name="facebook" /> Facebook
</Button>

{error && <Message negative>
<p>{error.message}</p>
</Message>}
{error && (
<Message negative>
<p>{error.message}</p>
</Message>
)}
</form>
);
}
@@ -242,14 +260,16 @@ class SignInTwitterBase extends Component {
const { error } = this.state;

return (
<form onSubmit={this.onSubmit} className='inline'>
<Button color='twitter' type="submit">
<Icon name='twitter' /> Twitter
<form onSubmit={this.onSubmit} className="inline">
<Button color="twitter" type="submit">
<Icon name="twitter" /> Twitter
</Button>

{error && <Message negative>
<p>{error.message}</p>
</Message>}
{error && (
<Message negative>
<p>{error.message}</p>
</Message>
)}
</form>
);
}
Loading
Oops, something went wrong.