import style from './style.css';
export class Button extends React.Component {
+ static defaultProps = {
+ className: null,
+ default: false,
+ disabled: false,
+ dangerous: false,
+ object: null,
+ };
+
render() {
let className = classNames({
[style.button]: true,
[style.button_default]: this.props.default,
[style.button_disabled]: this.props.disabled,
- });
+ [style.button_dangerous]: this.props.dangerous,
+ }, this.props.className);
return <button className={className} onClick={this.clicked}>{this.props.children}</button>;
}
clicked = (event) => {
event.preventDefault();
- this.props.onClick();
+ const {object, onClick} = this.props;
+ onClick(object);
}
}
color: white;
}
+.button_dangerous {
+ border: 2px solid #600;
+ background: linear-gradient(to top, #933, #CC3434 16px);
+ font-weight: bold;
+ color: white;
+}
+
.button_disabled {
background: #e1e1e1;
color: #888;
import style from './style.css';
export class Link extends React.Component {
- constructor(...args) {
- super(...args);
- this.clicked = this.clicked.bind(this);
- }
+ static defaultProps = {
+ className: style.link,
+ object: null,
+ };
render() {
return (
- <a className={style.link} href="#" onClick={this.clicked}>{this.props.children}</a>
+ <a className={this.props.className} href="#" onClick={this.clicked}>{this.props.children}</a>
);
}
- clicked(event) {
+ clicked = (event) => {
event.preventDefault();
const {object, onClick} = this.props;
onClick(object);
- }
+ };
}
-a.link,
-a.link:link,
-a.link:visited {
+.link,
+.link:link,
+.link:visited {
color: #006A95;
text-decoration: none;
}
-a.link:hover {
+.link:hover {
color: #036;
}
import React from 'react';
export class TextInput extends React.Component {
- constructor(...args) {
- super(...args);
- this.changed = this.changed.bind(this);
- }
-
render() {
+ const type = this.props.password ? 'password' : 'text';
return (
- <input type='text' value={this.props.value} onChange={this.changed}/>
+ <input type={type} value={this.props.value || ''} onChange={this.changed}/>
);
}
- changed(event) {
+ changed = (event) => {
if (this.props.onChange) {
this.props.onChange(event.target.value);
}