Skip to content

Commit dbcad62

Browse files
committed
Merge pull request airbnb#6 from drivetribe/container
Scrollable container horizontal & vertical + some input refactoring
2 parents 522756e + 7df0147 commit dbcad62

14 files changed

Lines changed: 156 additions & 70 deletions

File tree

react-dom/DTImage/src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import wrapImageInApiParser from '@drivetribe/react-higher-wrap-image-in-api-par
33

44
const DTImage = (props) => (
55
<img
6-
{...props}
6+
alt={props.alt}
77
role="presentation"
8+
{...props}
89
/>
910
);
1011

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import React, { PropTypes } from 'react';
2+
import classNames from 'classnames';
3+
import styles from './styles.css';
4+
5+
/**
6+
* Class representing a DefaultInput.
7+
* @author julia.sklyar@drivetribe.com
8+
*/
9+
10+
const DefaultInput = ({ error, valid, disabled, className, ...restProps }) => {
11+
const InputClass = classNames({
12+
[styles.defaultInput]: true,
13+
[styles.error]: error,
14+
[styles.valid]: valid,
15+
[styles.disabled]: disabled,
16+
className,
17+
});
18+
19+
return (
20+
<input
21+
className={InputClass}
22+
{...restProps}
23+
/>
24+
);
25+
};
26+
27+
DefaultInput.propTypes = {
28+
type: PropTypes.string.isRequired,
29+
error: PropTypes.boolean,
30+
valid: PropTypes.boolean,
31+
disabled: PropTypes.boolean,
32+
className: PropTypes.string,
33+
placeholder: PropTypes.string,
34+
};
35+
36+
export default DefaultInput;
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.default {
1+
.defaultInput {
22
padding: 8px 10px;
33
border: 1px solid #ccc;
44
font-size: 16px;
@@ -7,14 +7,14 @@
77
box-sizing: border-box;
88
}
99

10-
.default:focus {
10+
.defaultInput:focus {
1111
outline: 0;
1212
border-color: #129fea;
1313
box-shadow: 0 0 3px #74bee6;
1414
}
1515

1616
.error {
17-
composes: default;
17+
composes: defaultInput;
1818
border: 1px solid #cb0101;
1919
}
2020

@@ -25,7 +25,7 @@
2525
}
2626

2727
.valid {
28-
composes: default;
28+
composes: defaultInput;
2929
border: 1px solid #05b636;
3030
}
3131

@@ -36,7 +36,7 @@
3636
}
3737

3838
.disabled {
39-
composes: default;
39+
composes: defaultInput;
4040
cursor: not-allowed;
4141
background-color: #eaeded;
4242
color: #cad2d3;

react-dom/DTInput/Email/index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react';
2+
import DefaultInput from '../DefaultInput';
3+
4+
/**
5+
* Class representing a DefaultInput.
6+
* @author julia.sklyar@drivetribe.com
7+
* @extends DefaultInput
8+
*/
9+
10+
const EmailInput = (props) => (
11+
<DefaultInput
12+
type="email"
13+
placeholder="Email"
14+
{...props}
15+
/>
16+
);
17+
18+
export default EmailInput;

react-dom/DTInput/EmailInput/index.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

react-dom/DTInput/Input/index.js

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react';
2+
import DefaultInput from '../DefaultInput';
3+
4+
/**
5+
* Class representing a DefaultInput.
6+
* @author julia.sklyar@drivetribe.com
7+
* @extends DefaultInput
8+
*/
9+
10+
const PasswordInput = (props) => (
11+
<DefaultInput
12+
type="password"
13+
placeholder="Password"
14+
{...props}
15+
/>
16+
);
17+
18+
export default PasswordInput;

react-dom/DTInput/PasswordInput/index.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

react-dom/DTInput/Text/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
import DefaultInput from '../DefaultInput';
3+
4+
/**
5+
* Class representing a DefaultInput.
6+
* @author julia.sklyar@drivetribe.com
7+
* @extends DefaultInput
8+
*/
9+
10+
const TextInput = (props) => (
11+
<DefaultInput type="text" {...props} />
12+
);
13+
14+
export default TextInput;

react-dom/DTInput/TextInput/index.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)