@samitouri / QOS-React-2 / commits / 52a1ee492a

Remove duplicate fixture components

Brandon Dail committed Jan 3, 2017 at 17:43 UTC 52a1ee492aa87f794320cfa4eeb921deddf7d7b1
2 files changed -95
fixtures/src/components/RangeInputs.js deleted
-28
@@ -1,28 +0,0 @@
1 -const React = window.React;
2 -
3 -const RangeInputs = React.createClass({
4 - getInitialState() {
5 - return { value: 0.5 };
6 - },
7 - onChange(event) {
8 - this.setState({ value: event.target.value });
9 - },
10 - render() {
11 - return (
12 - <form>
13 - <fieldset>
14 - <legend>Controlled</legend>
15 - <input type="range" value={this.state.value} onChange={this.onChange.bind(this)} />
16 - <span className="hint">Value: {this.state.value}</span>
17 - </fieldset>
18 -
19 - <fieldset>
20 - <legend>Uncontrolled</legend>
21 - <input type="range" defaultValue={0.5} />
22 - </fieldset>
23 - </form>
24 - );
25 - },
26 -});
27 -
28 -export default RangeInputs;
fixtures/src/components/TextInputs.js deleted
-67
@@ -1,67 +0,0 @@
1 -const React = window.React;
2 -import '../styles/TextInputs.css';
3 -
4 -const TextInputFixtures = React.createClass({
5 - getInitialState() {
6 - return {
7 - color: '#ffaaee',
8 - };
9 - },
10 -
11 - renderControlled(type) {
12 - let id = `controlled_${type}`;
13 -
14 - let onChange = e => {
15 - let value = e.target.value;
16 - if (type === 'number') {
17 - value = value === '' ? '' : parseFloat(value, 10) || 0
18 - }
19 - this.setState({
20 - [type] : value,
21 - });
22 - };
23 -
24 - let state = this.state[type] || '';
25 -
26 - return (
27 - <div key={type} className="field">
28 - <label htmlFor={id}>{type}</label>
29 - <input id={id} type={type} value={state} onChange={onChange} />
30 - &nbsp; &rarr; {JSON.stringify(state)}
31 - </div>
32 - );
33 - },
34 -
35 - renderUncontrolled(type) {
36 - let id = `uncontrolled_${type}`;
37 - return (
38 - <div key={type} className="field">
39 - <label htmlFor={id}>{type}</label>
40 - <input id={id} type={type} />
41 - </div>
42 - );
43 - },
44 -
45 - render() {
46 - // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input
47 - let types = [
48 - 'text', 'email', 'number', 'url', 'tel',
49 - 'color', 'date', 'datetime-local',
50 - 'time', 'month', 'week', 'range', 'password',
51 - ];
52 - return (
53 - <form onSubmit={event => event.preventDefault()}>
54 - <fieldset>
55 - <legend>Controlled</legend>
56 - {types.map(this.renderControlled)}
57 - </fieldset>
58 - <fieldset>
59 - <legend>Uncontrolled</legend>
60 - {types.map(this.renderUncontrolled)}
61 - </fieldset>
62 - </form>
63 - );
64 - },
65 -});
66 -
67 -module.exports = TextInputFixtures;