@@ -24,7 +24,7 @@ import React from 'react';
2424import classnames from 'classnames' ;
2525import { withRipple , InjectedProps } from '@material/react-ripple' ;
2626
27- const BUTTON_CLASS_NAME = 'mdc-button__icon ';
27+ import { CSS_CLASSES } from './constant ';
2828
2929type ButtonTypes = HTMLAnchorElement | HTMLButtonElement ;
3030
@@ -63,11 +63,11 @@ export const Button = <T extends ButtonTypes>(
6363 } : ButtonProps < T >
6464) => {
6565 const props = {
66- className : classnames ( 'mdc-button' , className , {
67- 'mdc-button--raised' : raised ,
68- 'mdc-button--unelevated' : unelevated ,
69- 'mdc-button--outlined' : outlined ,
70- 'mdc-button--dense' : dense ,
66+ className : classnames ( CSS_CLASSES . ROOT , className , {
67+ [ CSS_CLASSES . RAISED ] : raised ,
68+ [ CSS_CLASSES . UNELEVATED ] : unelevated ,
69+ [ CSS_CLASSES . OUTLINED ] : outlined ,
70+ [ CSS_CLASSES . DENSE ] : dense ,
7171 } ) ,
7272 ref : initRipple ,
7373 disabled,
@@ -78,7 +78,7 @@ export const Button = <T extends ButtonTypes>(
7878 return (
7979 < a { ...props as React . HTMLProps < HTMLAnchorElement > } href = { href } >
8080 { ! trailingIcon ? renderIcon ( icon ) : null }
81- < span className = 'mdc-button__label' >
81+ < span className = { CSS_CLASSES . LABEL } >
8282 { children }
8383 </ span >
8484 { trailingIcon ? renderIcon ( trailingIcon ) : null }
@@ -89,7 +89,7 @@ export const Button = <T extends ButtonTypes>(
8989 return (
9090 < button { ...props as React . HTMLProps < HTMLButtonElement > } >
9191 { ! trailingIcon ? renderIcon ( icon ) : null }
92- < span className = 'mdc-button__label' >
92+ < span className = { CSS_CLASSES . LABEL } >
9393 { children }
9494 </ span >
9595 { trailingIcon ? renderIcon ( trailingIcon ) : null }
@@ -100,7 +100,7 @@ export const Button = <T extends ButtonTypes>(
100100const renderIcon = ( icon ?: React . ReactElement < React . HTMLProps < HTMLOrSVGElement > > ) => (
101101 icon ?
102102 React . cloneElement ( icon , {
103- className : classnames ( BUTTON_CLASS_NAME , icon . props . className ) ,
103+ className : classnames ( CSS_CLASSES . ICON , icon . props . className ) ,
104104 } ) :
105105 null
106106) ;
0 commit comments