File tree Expand file tree Collapse file tree 4 files changed +290
-203
lines changed
Expand file tree Collapse file tree 4 files changed +290
-203
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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 ;
Original file line number Diff line number Diff line change 11import PropTypes from 'prop-types' ;
22import React from 'react' ;
3- import classnames from 'classnames' ;
43import Label from './Label' ;
54import Input from './Input' ;
65import Field from './Field' ;
76import 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
139class 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 }
You can’t perform that action at this time.
0 commit comments