-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Doc] Convert Toolbars to use the new standard. #2415
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from 'react'; | ||
import IconMenu from 'material-ui/lib/menus/icon-menu'; | ||
import IconButton from 'material-ui/lib/icon-button'; | ||
import FontIcon from 'material-ui/lib/font-icon'; | ||
import NavigationExpandMoreIcon from 'material-ui/lib/svg-icons/navigation/expand-more'; | ||
import MenuItem from 'material-ui/lib/menus/menu-item'; | ||
import DropDownMenu from 'material-ui/lib/drop-down-menu'; | ||
import RaisedButton from 'material-ui/lib/raised-button'; | ||
import Toolbar from 'material-ui/lib/toolbar/toolbar'; | ||
import ToolbarGroup from 'material-ui/lib/toolbar/toolbar-group'; | ||
import ToolbarSeparator from 'material-ui/lib/toolbar/toolbar-separator'; | ||
import ToolbarTitle from 'material-ui/lib/toolbar/toolbar-title'; | ||
|
||
const menuItems = [ | ||
{payload: '1', text: 'All Broadcasts'}, | ||
{payload: '2', text: 'All Voice'}, | ||
{payload: '3', text: 'All Text'}, | ||
{payload: '4', text: 'Complete Voice'}, | ||
{payload: '5', text: 'Complete Text'}, | ||
{payload: '6', text: 'Active Voice'}, | ||
{payload: '7', text: 'Active Text'}, | ||
]; | ||
|
||
const ToolbarsExamplesSimple = React.createClass({ | ||
render() { | ||
return ( | ||
<Toolbar> | ||
<ToolbarGroup firstChild={true} float="left"> | ||
<DropDownMenu menuItems={menuItems} /> | ||
</ToolbarGroup> | ||
<ToolbarGroup float="right"> | ||
<ToolbarTitle text="Options" /> | ||
<FontIcon className="muidocs-icon-custom-sort" /> | ||
<IconMenu iconButtonElement={ | ||
<IconButton touch={true}> | ||
<NavigationExpandMoreIcon /> | ||
</IconButton> | ||
}> | ||
<MenuItem primaryText="Download" /> | ||
<MenuItem primaryText="More Info" /> | ||
</IconMenu> | ||
<ToolbarSeparator /> | ||
<RaisedButton label="Create Broadcast" primary={true} /> | ||
</ToolbarGroup> | ||
</Toolbar> | ||
); | ||
}, | ||
}); | ||
|
||
export default ToolbarsExamplesSimple; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## Toolbars | ||
|
||
Toolbars are collections of components stacked horizontally against each other. | ||
Toolbars provide greater versatility than AppBars which are a subset of toolbars. | ||
The following toolbar components can help organize your layout. | ||
|
||
### Examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
### Toolbar Properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
### ToolbarGroup Properties | ||
|
||
`ToolbarGroup` contains a collection of components for you. | ||
It is recommended that all components in a `Toolbar` are contained within a `ToolbarGroup`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
### ToolbarSeparator Properties | ||
|
||
A vertical bar used to separate groups of components. | ||
It is used to easily organize components within a `Toolbar`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### ToolbarTitle Properties | ||
|
||
a simple text that is displayed in the `Toolbar`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,143 +1,40 @@ | ||
import React from 'react'; | ||
import mui from 'material-ui'; | ||
import ComponentDoc from '../../component-doc'; | ||
|
||
const { | ||
DropDownIcon, | ||
DropDownMenu, | ||
FontIcon, | ||
RaisedButton, | ||
Toolbar, | ||
ToolbarGroup, | ||
ToolbarSeparator, | ||
ToolbarTitle, | ||
Paper, | ||
} = mui; | ||
import Code from 'toolbars-code'; | ||
import toolbarCode from '!raw!material-ui/toolbar/toolbar'; | ||
import toolbarGroupCode from '!raw!material-ui/toolbar/toolbar-group'; | ||
import toolbarSeparatorCode from '!raw!material-ui/toolbar/toolbar-separator'; | ||
import toolbarTitleCode from '!raw!material-ui/toolbar/toolbar-title'; | ||
import CodeExample from '../../code-example/code-example'; | ||
import CodeBlock from '../../code-example/code-block'; | ||
import PropTypeDescription from '../../PropTypeDescription'; | ||
import ToolbarsExampleSimple from '../../Toolbars/ExampleSimple'; | ||
import toolbarsExampleSimpleCode from '!raw!../../Toolbars/ExampleSimple'; | ||
import MarkdownElement from '../../MarkdownElement'; | ||
import toolbarsReadmeText from '../../Toolbars/README'; | ||
import toolbarReadmeText from '../../Toolbars/Toolbar'; | ||
import toolbarGroupReadmeText from '../../Toolbars/ToolbarGroup'; | ||
import toolbarSeparatorReadmeText from '../../Toolbars/ToolbarSeparator'; | ||
import toolbarTitleReadmeText from '../../Toolbars/ToolbarTitle'; | ||
|
||
export default class ToolbarPage extends React.Component { | ||
|
||
render() { | ||
|
||
let desc = 'Toolbars are collections of components stacked horizontally ' + | ||
'against each other. Toolbars provide greater versatility than ' + | ||
'appBars. AppBars are a subset of toolbars. The following ' + | ||
'toolbar components can help organize your layout. Note that ' + | ||
'every component listed here (including Toolbar) have a style ' + | ||
'prop which overrides the inline-styles of their root element.'; | ||
|
||
let componentInfo = [ | ||
{ | ||
name: 'ToolbarGroup', | ||
infoArray: [ | ||
{ | ||
name: 'Description', | ||
desc: 'Toolbar Group contains a collection of components for you. ' + | ||
'It is recommended that all components in a Toolbar are ' + | ||
'contained within a ToolbarGroup.', | ||
}, | ||
{ | ||
name: 'float', | ||
type: 'string', | ||
header: 'optional', | ||
desc: 'Optional pull "left" or "right"', | ||
}, | ||
{ | ||
name: 'style', | ||
type: 'object', | ||
header: 'optional', | ||
desc: 'Override the inline-styles of the toolbar group\'s root element.', | ||
}, | ||
], | ||
}, | ||
{ | ||
name: 'ToolbarSeparator', | ||
infoArray: [ | ||
{ | ||
name: 'Description', | ||
desc: 'A vertical bar used to separate groups of components. It ' + | ||
'is used to easily organize components.', | ||
}, | ||
{ | ||
name: 'style', | ||
type: 'object', | ||
header: 'optional', | ||
desc: 'Override the inline-styles of the toolbar separator\'s root element.', | ||
}, | ||
], | ||
}, | ||
{ | ||
name: 'ToolbarTitle', | ||
infoArray: [ | ||
{ | ||
name: 'Description', | ||
desc: 'Simply a string of text that is displayed in the Toolbar.', | ||
}, | ||
{ | ||
name: 'text', | ||
type: 'string', | ||
header: 'optional', | ||
desc: 'The text to be displayed for the element.', | ||
}, | ||
{ | ||
name: 'style', | ||
type: 'object', | ||
header: 'optional', | ||
desc: 'Override the inline-styles of the toolbar title\'s root element.', | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
let filterOptions = [ | ||
{payload: '1', text: 'All Broadcasts'}, | ||
{payload: '2', text: 'All Voice'}, | ||
{payload: '3', text: 'All Text'}, | ||
{payload: '4', text: 'Complete Voice'}, | ||
{payload: '5', text: 'Complete Text'}, | ||
{payload: '6', text: 'Active Voice'}, | ||
{payload: '7', text: 'Active Text'}, | ||
]; | ||
let iconMenuItems = [ | ||
{payload: '1', text: 'Download'}, | ||
{payload: '2', text: 'More Info'}, | ||
]; | ||
|
||
return ( | ||
<ComponentDoc | ||
name="Toolbars" | ||
desc={desc} | ||
componentInfo={componentInfo}> | ||
|
||
<Paper style = {{marginBottom: '22px'}}> | ||
<CodeBlock> | ||
{ | ||
'//Import statement:\nimport Toolbar from \'material-ui/lib/toolbar/toolbar\';\n' + | ||
'import ToolbarGroup from \'material-ui/lib/toolbar/toolbar-group\';\n' + | ||
'import ToolbarSeparator from \'material-ui/lib/toolbar/toolbar-separator\';\n' + | ||
'import ToolbarTitle from \'material-ui/lib/toolbar/toolbar-title\';\n\n' + | ||
'//See material-ui/lib/index.js for more\n' | ||
} | ||
</CodeBlock> | ||
</Paper> | ||
|
||
<CodeExample code={Code}> | ||
<Toolbar> | ||
<ToolbarGroup key={0} float="left"> | ||
<DropDownMenu menuItems={filterOptions} /> | ||
</ToolbarGroup> | ||
<ToolbarGroup key={1} float="right"> | ||
<ToolbarTitle text="Options" /> | ||
<FontIcon className="muidocs-icon-custom-sort" /> | ||
<DropDownIcon iconClassName="muidocs-icon-navigation-expand-more" menuItems={iconMenuItems} /> | ||
<ToolbarSeparator/> | ||
<RaisedButton label="Create Broadcast" primary={true} /> | ||
</ToolbarGroup> | ||
</Toolbar> | ||
<div> | ||
<MarkdownElement text={toolbarsReadmeText} /> | ||
<CodeExample code={toolbarsExampleSimpleCode}> | ||
<ToolbarsExampleSimple /> | ||
</CodeExample> | ||
</ComponentDoc> | ||
<PropTypeDescription | ||
code={toolbarCode} | ||
header={toolbarReadmeText} /> | ||
<PropTypeDescription | ||
code={toolbarGroupCode} | ||
header={toolbarGroupReadmeText} /> | ||
<PropTypeDescription | ||
code={toolbarSeparatorCode} | ||
header={toolbarSeparatorReadmeText} /> | ||
<PropTypeDescription | ||
code={toolbarTitleCode} | ||
header={toolbarTitleReadmeText} /> | ||
</div> | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following what we were saying about markdown over jsx. I'm wondering if we shouldn't do the opposite:
Optionally rendering the
### Properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get it O.o
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For instance
docs/src/app/components/Toolbars/ToolbarTitle.md
Would be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooo, I didn't think of it that way. I like your approach a lot more. I'll do a patch.