Move button to its own component
fix css linting errors
This commit is contained in:
27
src/components/Button/Button.css
Normal file
27
src/components/Button/Button.css
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
@import '../variables.css';
|
||||||
|
|
||||||
|
.root {
|
||||||
|
display: block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
padding: 10px 16px;
|
||||||
|
width: 100%;
|
||||||
|
opacity: 0.75;
|
||||||
|
outline: 0;
|
||||||
|
border: 4px solid #fff;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: var(--colour-nearblack);
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 18px;
|
||||||
|
line-height: 1.3333333;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: opacity ease-in-out 0.25s, box-shadow ease-in-out 0.25s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.root:hover,
|
||||||
|
.root:focus {
|
||||||
|
opacity: 0.9;
|
||||||
|
box-shadow: 0 0 4px #fff;
|
||||||
|
}
|
||||||
23
src/components/Button/Button.js
Normal file
23
src/components/Button/Button.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import React, { PropTypes } from 'react';
|
||||||
|
import withStyles from 'isomorphic-style-loader/lib/withStyles';
|
||||||
|
import s from './Button.css';
|
||||||
|
|
||||||
|
class Button extends React.Component {
|
||||||
|
static propTypes = {
|
||||||
|
children: PropTypes.node,
|
||||||
|
onClick: PropTypes.func,
|
||||||
|
};
|
||||||
|
|
||||||
|
handleClick = (event) => {
|
||||||
|
if (this.props.onClick) {
|
||||||
|
this.props.onClick(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { children, ...props } = this.props;
|
||||||
|
return <button className={s.root} {...props} onClick={this.handleClick}>{children}</button>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default withStyles(s)(Button);
|
||||||
6
src/components/Button/package.json
Normal file
6
src/components/Button/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "Button",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"main": "./Button.js"
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
@import '../../../node_modules/normalize.css/normalize.css';
|
@import '../../../node_modules/normalize.css/normalize.css';
|
||||||
|
|
||||||
@import '../variables.css';
|
@import '../variables.css';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -76,32 +76,6 @@
|
|||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
|
||||||
display: block;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin: 0;
|
|
||||||
padding: 10px 16px;
|
|
||||||
width: 100%;
|
|
||||||
opacity: 0.75;
|
|
||||||
outline: 0;
|
|
||||||
border: 4px solid #fff;
|
|
||||||
border-radius: 14px;
|
|
||||||
background: var(--colour-nearblack);
|
|
||||||
color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
text-decoration: none;
|
|
||||||
font-size: 18px;
|
|
||||||
line-height: 1.3333333;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: opacity ease-in-out 0.25s, box-shadow ease-in-out 0.25s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button:hover,
|
|
||||||
.button:focus {
|
|
||||||
opacity: 0.9;
|
|
||||||
box-shadow: 0 0 4px #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes shake {
|
@keyframes shake {
|
||||||
8%,
|
8%,
|
||||||
41% {
|
41% {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React, { PropTypes } from 'react';
|
|||||||
import withStyles from 'isomorphic-style-loader/lib/withStyles';
|
import withStyles from 'isomorphic-style-loader/lib/withStyles';
|
||||||
import s from './RsvpButton.css';
|
import s from './RsvpButton.css';
|
||||||
import fetch from '../../core/fetch';
|
import fetch from '../../core/fetch';
|
||||||
|
import Button from '../Button';
|
||||||
|
|
||||||
class RsvpButton extends React.Component {
|
class RsvpButton extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
@@ -79,9 +80,9 @@ class RsvpButton extends React.Component {
|
|||||||
!this.state.showRsvpForm ? s.rsvpVisible : null,
|
!this.state.showRsvpForm ? s.rsvpVisible : null,
|
||||||
].join(' ')}
|
].join(' ')}
|
||||||
>
|
>
|
||||||
<button className={s.button} onClick={this.showRsvpForm}>
|
<Button onClick={this.showRsvpForm}>
|
||||||
RSVP
|
RSVP
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className={[
|
className={[
|
||||||
|
|||||||
@@ -37,41 +37,10 @@
|
|||||||
color: #616161;
|
color: #616161;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
line-height: 1.3333333;
|
line-height: 1.3333333;
|
||||||
transition: border-color ease-in-out 0.15s,
|
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s, background-color ease-in-out 0.15s;
|
||||||
box-shadow ease-in-out 0.15s,
|
|
||||||
background-color ease-in-out 0.15s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.input:focus {
|
.input:focus {
|
||||||
border-color: var(--colour-tertiary);
|
border-color: var(--colour-tertiary);
|
||||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(0, 116, 194, 0.6);
|
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(0, 116, 194, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
|
||||||
display: block;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin: 0;
|
|
||||||
padding: 10px 16px;
|
|
||||||
width: 100%;
|
|
||||||
outline: 0;
|
|
||||||
border: 1px solid var(--colour-secondary);
|
|
||||||
border-radius: 0;
|
|
||||||
background: var(--colour-primary);;
|
|
||||||
color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
text-decoration: none;
|
|
||||||
font-size: 18px;
|
|
||||||
line-height: 1.3333333;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button:hover {
|
|
||||||
background: var(--colour-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.button:focus {
|
|
||||||
border-color: var(--colour-tertiary);
|
|
||||||
box-shadow: 0 0 8px var(--colour-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React, { PropTypes } from 'react';
|
|||||||
import withStyles from 'isomorphic-style-loader/lib/withStyles';
|
import withStyles from 'isomorphic-style-loader/lib/withStyles';
|
||||||
import s from './AdminPeople.css';
|
import s from './AdminPeople.css';
|
||||||
import Link from '../../components/Link';
|
import Link from '../../components/Link';
|
||||||
|
import Button from '../../components/Button';
|
||||||
|
|
||||||
class AdminPeople extends React.Component {
|
class AdminPeople extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
@@ -41,9 +42,9 @@ class AdminPeople extends React.Component {
|
|||||||
<td>
|
<td>
|
||||||
<form method="post" action="/admin/person/delete">
|
<form method="post" action="/admin/person/delete">
|
||||||
<input type="hidden" name="key" value={person.key} />
|
<input type="hidden" name="key" value={person.key} />
|
||||||
<button className={s.button} type="submit">
|
<Button type="submit">
|
||||||
Delete
|
Delete
|
||||||
</button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -98,9 +99,9 @@ class AdminPeople extends React.Component {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={s.formGroup}>
|
<div className={s.formGroup}>
|
||||||
<button className={s.button} type="submit">
|
<Button type="submit">
|
||||||
Save
|
Save
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -37,7 +37,8 @@
|
|||||||
color: #616161;
|
color: #616161;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
line-height: 1.3333333;
|
line-height: 1.3333333;
|
||||||
transition: border-color ease-in-out 0.15s,
|
transition:
|
||||||
|
border-color ease-in-out 0.15s,
|
||||||
box-shadow ease-in-out 0.15s,
|
box-shadow ease-in-out 0.15s,
|
||||||
background-color ease-in-out 0.15s;
|
background-color ease-in-out 0.15s;
|
||||||
}
|
}
|
||||||
@@ -46,32 +47,3 @@
|
|||||||
border-color: var(--colour-tertiary);
|
border-color: var(--colour-tertiary);
|
||||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(0, 116, 194, 0.6);
|
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(0, 116, 194, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
|
||||||
display: block;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin: 0;
|
|
||||||
padding: 10px 16px;
|
|
||||||
width: 100%;
|
|
||||||
outline: 0;
|
|
||||||
border: 1px solid var(--colour-secondary);
|
|
||||||
border-radius: 0;
|
|
||||||
background: var(--colour-primary);;
|
|
||||||
color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
text-decoration: none;
|
|
||||||
font-size: 18px;
|
|
||||||
line-height: 1.3333333;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button:hover {
|
|
||||||
background: var(--colour-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.button:focus {
|
|
||||||
border-color: var(--colour-tertiary);
|
|
||||||
box-shadow: 0 0 8px var(--colour-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React, { PropTypes } from 'react';
|
import React, { PropTypes } from 'react';
|
||||||
import withStyles from 'isomorphic-style-loader/lib/withStyles';
|
import withStyles from 'isomorphic-style-loader/lib/withStyles';
|
||||||
import s from './AdminPerson.css';
|
import s from './AdminPerson.css';
|
||||||
|
import Button from '../../components/Button';
|
||||||
|
|
||||||
class AdminPerson extends React.Component {
|
class AdminPerson extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
@@ -86,9 +87,9 @@ class AdminPerson extends React.Component {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={s.formGroup}>
|
<div className={s.formGroup}>
|
||||||
<button className={s.button} type="submit">
|
<Button type="submit">
|
||||||
Save
|
Save
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user