Skip to content

Commit ff19ccd

Browse files
wingrunr21kradio3
authored andcommitted
Update to material-components-web v0.22.0
Breaking changes: * DOM change to add a bottom line element * multi-line text field is now called textarea
1 parent e8495e9 commit ff19ccd

File tree

4 files changed

+290
-203
lines changed

4 files changed

+290
-203
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ npm i --save react-mdc-web
1717
### Default theme
1818
* Include CSS with default theme into HTML page
1919
```html
20-
<link rel="stylesheet" href="https://unpkg.com/material-components-web@0.19.0/dist/material-components-web.min.css">
20+
<link rel="stylesheet" href="https://unpkg.com/material-components-web@0.22.0/dist/material-components-web.min.css">
2121
```
2222
* Or import it into JS/JSX file
2323
```javascript

src/Textfield/BottomLine.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import classnames from 'classnames';
4+
5+
const propTypes = {
6+
active: PropTypes.bool,
7+
};
8+
9+
const ROOT = 'mdc-textfield__bottom-line';
10+
const ACTIVE = `${ROOT}--active`;
11+
12+
const BottomLine = ({ active }) => (
13+
<div
14+
className={classnames(ROOT, {
15+
[ACTIVE]: active,
16+
})}
17+
/>
18+
);
19+
BottomLine.propTypes = propTypes;
20+
export default BottomLine;

src/Textfield/Textfield.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
3-
import classnames from 'classnames';
43
import Label from './Label';
54
import Input from './Input';
65
import Field from './Field';
76
import Helptext from './Helptext';
8-
9-
const ROOT = 'mdc-textfield';
10-
const BOTTOMLINE = `${ROOT}__bottom-line`;
11-
const BOTTOMLINEFOCUSED = `${BOTTOMLINE}--active`;
7+
import BottomLine from './BottomLine';
128

139
class Textfield extends React.PureComponent {
1410

@@ -86,10 +82,7 @@ class Textfield extends React.PureComponent {
8682
>
8783
{floatingLabel}
8884
</Label>
89-
<div
90-
className={classnames(BOTTOMLINE, {
91-
[BOTTOMLINEFOCUSED]: focus })}
92-
/>
85+
<BottomLine active={focus} />
9386
</Field>
9487
);
9588
}

0 commit comments

Comments
 (0)