-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2489 from oliviertassinari/docs-codegen-badge
[Doc] Migrate Badge to the new format
- Loading branch information
Showing
7 changed files
with
125 additions
and
134 deletions.
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