#575: Use classname 'material-icons' if children is a string

old
Bao Dang 2016-06-17 07:55:19 +10:00
parent d010c6d882
commit 1d725dc062
3 changed files with 5 additions and 3 deletions

View File

@ -4,7 +4,7 @@ import classnames from 'classnames';
const FontIcon = ({ children, className, value, ...other}) => ( const FontIcon = ({ children, className, value, ...other}) => (
<span <span
data-react-toolbox='font-icon' data-react-toolbox='font-icon'
className={classnames({'material-icons': typeof value === 'string'}, className)} className={classnames({'material-icons': typeof value === 'string' || typeof children === 'string'}, className)}
{...other} {...other}
> >
{value} {value}

View File

@ -3,14 +3,14 @@ import FontIcon from '../../components/font_icon';
const FontIconTest = () => ( const FontIconTest = () => (
<section> <section>
<h2>Font Icon</h2> <h5>Font Icons</h5>
<p>lorem ipsum...</p> <p>lorem ipsum...</p>
<FontIcon value="add"/> <FontIcon value="add"/>
<FontIcon value="access_alarm"/> <FontIcon value="access_alarm"/>
<FontIcon value="explore"/> <FontIcon value="explore"/>
<FontIcon value="zoom_in"/> <FontIcon value="zoom_in"/>
<FontIcon value="input"/> <FontIcon>input</FontIcon>
</section> </section>
); );

View File

@ -4,6 +4,7 @@ import React from 'react';
import AppBar from '../components/app_bar'; import AppBar from '../components/app_bar';
import Autocomplete from './components/autocomplete'; import Autocomplete from './components/autocomplete';
import Avatar from './components/avatar'; import Avatar from './components/avatar';
import FontIcon from './components/font_icon';
import Button from './components/button'; import Button from './components/button';
import ButtonToolbox from '../components/button'; import ButtonToolbox from '../components/button';
import Card from './components/card'; import Card from './components/card';
@ -42,6 +43,7 @@ const Root = () => (
</AppBar> </AppBar>
<Autocomplete /> <Autocomplete />
<Avatar /> <Avatar />
<FontIcon />
<Button /> <Button />
<Card /> <Card />
<Checkbox /> <Checkbox />