Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Icon's docs update #2695

Merged
merged 1 commit into from
Jan 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/src/app/app-routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import DatePicker from './components/pages/components/DatePicker/Page';
import DialogPage from './components/pages/components/Dialog/Page';
import DividerPage from './components/pages/components/Divider/Page';
import DropDownMenuPage from './components/pages/components/DropDownMenu/Page';
import FontIconPage from './components/pages/components/FontIcon/Page';
import GridListPage from './components/pages/components/GridList/Page';
import Icons from './components/pages/components/icons';
import IconButtonPage from './components/pages/components/IconButton/Page';
import IconMenus from './components/pages/components/icon-menus';
import LeftNavPage from './components/pages/components/LeftNav/Page';
Expand All @@ -43,6 +43,7 @@ import RefreshIndicator from './components/pages/components/refresh-indicator';
import SelectField from './components/pages/components/SelectField/Page';
import Sliders from './components/pages/components/sliders';
import SnackbarPage from './components/pages/components/Snackbar/Page';
import SvgIconPage from './components/pages/components/SvgIcon/Page';
import Switches from './components/pages/components/switches';
import Table from './components/pages/components/table';
import TabsPage from './components/pages/components/Tabs/Page';
Expand Down Expand Up @@ -90,8 +91,8 @@ const AppRoutes = (
<Route path="dialog" component={DialogPage} />
<Route path="divider" component={DividerPage} />
<Route path="dropdown-menu" component={DropDownMenuPage} />
<Route path="font-icon" component={FontIconPage} />
<Route path="grid-list" component={GridListPage} />
<Route path="icons" component={Icons} />
<Route path="icon-button" component={IconButtonPage} />
<Route path="icon-menus" component={IconMenus} />
<Route path="left-nav" component={LeftNavPage} />
Expand All @@ -103,6 +104,7 @@ const AppRoutes = (
<Route path="refresh-indicator" component={RefreshIndicator} />
<Route path="select-field" component={SelectField} />
<Route path="sliders" component={Sliders} />
<Route path="svg-icon" component={SvgIconPage} />
<Route path="switches" component={Switches} />
<Route path="snackbar" component={SnackbarPage} />
<Route path="table" component={Table} />
Expand Down
18 changes: 14 additions & 4 deletions docs/src/app/components/app-left-nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,6 @@ const AppLeftNav = React.createClass({
value="/components/grid-list"
primaryText="Grid List"
/>,
<ListItem
value="/components/icons"
primaryText="Icons"
/>,
<ListItem
value="/components/icon-button"
primaryText="Icon Button"
Expand All @@ -195,6 +191,20 @@ const AppLeftNav = React.createClass({
value="/components/icon-menus"
primaryText="Icon Menus"
/>,
<ListItem
primaryText="Icons"
primaryTogglesNestedList={true}
nestedItems={[
<ListItem
value="/components/font-icon"
primaryText="Font Icon"
/>,
<ListItem
value="/components/svg-icon"
primaryText="SVG Icon"
/>,
]}
/>,
<ListItem
value="/components/left-nav"
primaryText="Left Nav"
Expand Down
18 changes: 18 additions & 0 deletions docs/src/app/components/pages/components/FontIcon/ExampleIcons.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import FontIcon from 'material-ui/lib/font-icon';
import Colors from 'material-ui/lib/styles/colors';

const iconStyles = {
marginRight: 24,
};

const FontIconExampleIcons = () => (
<div>
<FontIcon className="material-icons" style={iconStyles} >home</FontIcon>
<FontIcon className="material-icons" style={iconStyles} color={Colors.red500}>flight_takeoff</FontIcon>
<FontIcon className="material-icons" style={iconStyles} color={Colors.yellow500}>cloud_download</FontIcon>
<FontIcon className="material-icons" style={iconStyles} color={Colors.blue500}>videogame_asset</FontIcon>
</div>
);

export default FontIconExampleIcons;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import FontIcon from 'material-ui/lib/font-icon';
import Colors from 'material-ui/lib/styles/colors';

const iconStyles = {
marginRight: 24,
};

const FontIconExampleSimple = () => (
<div>
<FontIcon
className="muidocs-icon-action-home"
style={iconStyles} />
<FontIcon
className="muidocs-icon-action-home"
style={iconStyles}
color={Colors.blue500} />
<FontIcon
className="muidocs-icon-action-home"
style={iconStyles}
color={Colors.red500}
hoverColor={Colors.greenA200} />
</div>
);

export default FontIconExampleSimple;
26 changes: 26 additions & 0 deletions docs/src/app/components/pages/components/FontIcon/Page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import CodeExample from '../../../CodeExample';
import PropTypeDescription from '../../../PropTypeDescription';
import MarkdownElement from '../../../MarkdownElement';

import iconCode from '!raw!material-ui/lib/font-icon';
import iconReadmeText from './README';
import IconExampleSimple from './ExampleSimple';
import iconExampleSimpleCode from '!raw!./ExampleSimple';
import IconExampleIcons from './ExampleIcons';
import iconExampleIconsCode from '!raw!./ExampleIcons';

const FontIconPage = () => (
<div>
<MarkdownElement text={iconReadmeText} />
<CodeExample code={iconExampleSimpleCode}>
<IconExampleSimple />
</CodeExample>
<CodeExample code={iconExampleIconsCode}>
<IconExampleIcons />
</CodeExample>
<PropTypeDescription code={iconCode} />
</div>
);

export default FontIconPage;
16 changes: 16 additions & 0 deletions docs/src/app/components/pages/components/FontIcon/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Font Icon
This component will render any [icon](https://www.google.com/design/spec/style/icons.html#) defined in any style sheets included in your project.
We are using [Google's Material Design Icons](https://github.com/google/material-design-icons) for our documentation site along with some custom icons.
You can use sites like IcoMoon for generating custom font files.
To use FontIcon, add your stylesheet to your project and reference the icon's className in the className prop.

We also support [Google's Material Icons](http://google.github.io/material-design-icons/) as seen in the third block of code.
If you're using the material icons, be sure to include the link to the font icon file in your head section:
```html
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
```

To see available Material Icons, go to [material icons library](https://design.google.com/icons/).
Google's material icon's names are in snake_case format. For example: ActionHome would be written as action_home.

### Examples
22 changes: 22 additions & 0 deletions docs/src/app/components/pages/components/SVGIcon/ExampleIcons.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import ActionHome from 'material-ui/lib/svg-icons/action/home';
import ActionFlightTakeoff from 'material-ui/lib/svg-icons/action/flight-takeoff';
import FileCloudDownload from 'material-ui/lib/svg-icons/file/cloud-download';
import HardwareVideogameAsset from 'material-ui/lib/svg-icons/hardware/videogame-asset';
import Colors from 'material-ui/lib/styles/colors';


const iconStyles = {
marginRight: 24,
};

const SvgIconExampleIcons = () => (
<div>
<ActionHome style={iconStyles}/>
<ActionFlightTakeoff style={iconStyles} color={Colors.red500} />
<FileCloudDownload style={iconStyles} color={Colors.yellow500} />
<HardwareVideogameAsset style={iconStyles} color={Colors.blue500} />
</div>
);

export default SvgIconExampleIcons;
18 changes: 18 additions & 0 deletions docs/src/app/components/pages/components/SVGIcon/ExampleSimple.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import ActionHome from 'material-ui/lib/svg-icons/action/home';
import Colors from 'material-ui/lib/styles/colors';


const iconStyles = {
marginRight: 24,
};

const SvgIconExampleSimple = () => (
<div>
<ActionHome style={iconStyles} />
<ActionHome style={iconStyles} color={Colors.blue500} />
<ActionHome style={iconStyles} color={Colors.red500} hoverColor={Colors.greenA200} />
</div>
);

export default SvgIconExampleSimple;
26 changes: 26 additions & 0 deletions docs/src/app/components/pages/components/SVGIcon/Page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import CodeExample from '../../../CodeExample';
import PropTypeDescription from '../../../PropTypeDescription';
import MarkdownElement from '../../../MarkdownElement';

import iconCode from '!raw!material-ui/lib/svg-icon';
import iconReadmeText from './README';
import IconExampleSimple from './ExampleSimple';
import iconExampleSimpleCode from '!raw!./ExampleSimple';
import IconExampleIcons from './ExampleIcons';
import iconExampleIconsCode from '!raw!./ExampleIcons';

const SvgIconPage = () => (
<div>
<MarkdownElement text={iconReadmeText} />
<CodeExample code={iconExampleSimpleCode}>
<IconExampleSimple />
</CodeExample>
<CodeExample code={iconExampleIconsCode}>
<IconExampleIcons />
</CodeExample>
<PropTypeDescription code={iconCode} />
</div>
);

export default SvgIconPage;
9 changes: 9 additions & 0 deletions docs/src/app/components/pages/components/SVGIcon/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## SVG Icons
Using material-ui's SVG Icon, we can create a custom [svg component](https://www.google.com/design/spec/style/icons.html#icons-system-icons). In our examples, we are creating the ActionHome SvgIcon for this docs site, and using it in some separate component.
Custom SvgIcon components can be included as children for other Material UI components that use icons such as [IconButtons](http://www.material-ui.com/#/components/icon-button).

To see available Material Icons, go to [material icons library](https://design.google.com/icons/).
All those icons are available in the [svg-icons](https://github.com/callemall/material-ui/tree/master/src/svg-icons) folder.
For instance to use the `home` icon you need to import `material-ui/lib/svg-icons/action/home`

### Examples
Loading