-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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] Migrate Badge to the new format #2489
Merged
oliviertassinari
merged 2 commits into
mui:master
from
oliviertassinari:docs-codegen-badge
Dec 13, 2015
Merged
Changes from all commits
Commits
Show all changes
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import Badge from 'material-ui/lib/badge'; | ||
import IconButton from 'material-ui/lib/icon-button'; | ||
import UploadIcon from 'material-ui/lib/svg-icons/file/cloud-upload'; | ||
import FolderIcon from 'material-ui/lib/svg-icons/file/folder-open'; | ||
|
||
const BadgeExampleContent = () => ( | ||
<div> | ||
<Badge | ||
badgeContent={<IconButton tooltip="Backup"><UploadIcon/></IconButton>} | ||
backgroundColor="#d8d8d8" | ||
> | ||
<FolderIcon /> | ||
</Badge> | ||
<Badge | ||
badgeContent="©" | ||
badgeStyle={{fontSize: 20}} | ||
> | ||
Company Name | ||
</Badge> | ||
</div> | ||
); | ||
|
||
export default BadgeExampleContent; |
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,26 @@ | ||
import React from 'react'; | ||
import Badge from 'material-ui/lib/badge'; | ||
import IconButton from 'material-ui/lib/icon-button'; | ||
import NotificationsIcon from 'material-ui/lib/svg-icons/social/notifications'; | ||
|
||
const BadgeExampleSimple = () => ( | ||
<div> | ||
<Badge | ||
badgeContent={4} | ||
primary={true} | ||
> | ||
<NotificationsIcon /> | ||
</Badge> | ||
<Badge | ||
badgeContent={10} | ||
secondary={true} | ||
badgeStyle={{top: 12, right: 12}} | ||
> | ||
<IconButton tooltip="Notifications"> | ||
<NotificationsIcon/> | ||
</IconButton> | ||
</Badge> | ||
</div> | ||
); | ||
|
||
export default BadgeExampleSimple; |
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,5 @@ | ||
## Badge | ||
|
||
This component generates a small badge to the top-right of it's child(ren). | ||
|
||
### 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
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,106 +1,27 @@ | ||
import React from 'react'; | ||
import { | ||
IconButton, | ||
Badge, | ||
Paper, | ||
} from 'material-ui'; | ||
import ComponentDoc from '../../component-doc'; | ||
import Code from 'badge-code'; | ||
import badgeCode from '!raw!material-ui/lib/badge'; | ||
import CodeExample from '../../code-example/code-example'; | ||
import NotificationsIcon from 'material-ui/svg-icons/social/notifications'; | ||
import ShoppingCartIcon from 'material-ui/svg-icons/action/shopping-cart'; | ||
import FolderIcon from 'material-ui/svg-icons/file/folder-open'; | ||
import UploadIcon from 'material-ui/svg-icons/file/cloud-upload'; | ||
import CodeBlock from '../../code-example/code-block'; | ||
|
||
export default class BadgePage extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.desc = 'This component generates a small badge to the top-right of it\'s child(ren)'; | ||
|
||
this.componentInfo = [ | ||
{ | ||
name: 'Props', | ||
infoArray: [ | ||
{ | ||
name: 'badgeContent', | ||
type: 'node', | ||
header: 'required', | ||
desc: 'This is the content rendered within the badge.', | ||
}, | ||
{ | ||
name: 'primary', | ||
type: 'bool', | ||
header: 'default: false', | ||
desc: 'If true, the badge will use the primary badge colors.', | ||
}, | ||
{ | ||
name: 'secondary', | ||
type: 'bool', | ||
header: 'default: false', | ||
desc: 'If true, the badge will use the secondary badge colors.', | ||
}, | ||
{ | ||
name: 'style', | ||
type: 'object', | ||
header: 'optional', | ||
desc: 'Override the inline-styles of the root element.', | ||
}, | ||
{ | ||
name: 'badgeStyle', | ||
type: 'object', | ||
header: 'optional', | ||
desc: 'Override the inline-styles of the badge element.', | ||
}, | ||
], | ||
}, | ||
]; | ||
} | ||
|
||
render() { | ||
return ( | ||
<ComponentDoc | ||
name="Badge" | ||
desc={this.desc} | ||
componentInfo={this.componentInfo}> | ||
|
||
<Paper style = {{marginBottom: '22px'}}> | ||
<CodeBlock> | ||
{ | ||
`//Import statement: | ||
import Badge from 'material-ui/lib/badge'; | ||
//See material-ui/lib/index.js for more | ||
` | ||
} | ||
</CodeBlock> | ||
</Paper> | ||
|
||
<CodeExample code={Code}> | ||
|
||
<Badge badgeContent={4} primary={true}> | ||
<NotificationsIcon /> | ||
</Badge> | ||
|
||
<Badge badgeContent={10} secondary={true} badgeStyle={{top:12, right:12}}> | ||
<IconButton tooltip="Go To Cart"> | ||
<ShoppingCartIcon/> | ||
</IconButton> | ||
</Badge> | ||
|
||
<Badge backgroundColor="#d8d8d8" | ||
badgeContent={<IconButton tooltip="Backup"><UploadIcon/></IconButton>}> | ||
<FolderIcon /> | ||
</Badge> | ||
|
||
<Badge badgeContent="©" badgeStyle={{fontSize:20}}> | ||
<h3>Company Name</h3> | ||
</Badge> | ||
|
||
</CodeExample> | ||
</ComponentDoc> | ||
); | ||
} | ||
|
||
} | ||
import PropTypeDescription from '../../PropTypeDescription'; | ||
import MarkdownElement from '../../MarkdownElement'; | ||
import badgeReadmeText from '../../Badge/README'; | ||
import BadgeExampleSimple from '../../Badge/ExampleSimple'; | ||
import badgeExampleSimpleCode from '!raw!../../Badge/ExampleSimple'; | ||
import BadgeExampleContent from '../../Badge/ExampleContent'; | ||
import badgeExampleContentCode from '!raw!../../Badge/ExampleContent'; | ||
|
||
const BadgePage = () => { | ||
return ( | ||
<div> | ||
<MarkdownElement text={badgeReadmeText} /> | ||
<CodeExample code={badgeExampleSimpleCode}> | ||
<BadgeExampleSimple /> | ||
</CodeExample> | ||
<CodeExample code={badgeExampleContentCode}> | ||
<BadgeExampleContent /> | ||
</CodeExample> | ||
<PropTypeDescription code={badgeCode}/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default BadgePage; |
This file was deleted.
Oops, something went wrong.
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
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.
I'm proposing this standard description. I don't think that we need to say that it's for the Badge component.
I have done the same for the
className
.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 like your approach. be sure to remind me when I make this mistake again 👍 👍