-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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 Avatar to use the new standard #2407
Merged
oliviertassinari
merged 1 commit into
mui:master
from
oliviertassinari:doc-codgen-avatar
Dec 8, 2015
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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,87 @@ | ||
import React from 'react'; | ||
import Avatar from 'material-ui/lib/avatar'; | ||
import FileFolder from 'material-ui/lib/svg-icons/file/folder'; | ||
import styles from 'material-ui/lib/styles'; | ||
import FontIcon from 'material-ui/lib/font-icon'; | ||
import List from 'material-ui/lib/lists/list'; | ||
import ListItem from 'material-ui/lib/lists/list-item'; | ||
|
||
const colors = styles.Colors; | ||
|
||
const AvatarExampleSimple = React.createClass({ | ||
render() { | ||
return ( | ||
<List> | ||
<ListItem | ||
disabled={true} | ||
leftAvatar={ | ||
<Avatar src="images/uxceo-128.jpg" /> | ||
} | ||
> | ||
Image Avatar | ||
</ListItem> | ||
<ListItem | ||
disabled={true} | ||
leftAvatar={ | ||
<Avatar icon={<FileFolder />} /> | ||
} | ||
> | ||
SvgIcon Avatar | ||
</ListItem> | ||
<ListItem | ||
disabled={true} | ||
leftAvatar={ | ||
<Avatar | ||
icon={<FileFolder />} | ||
color={colors.orange200} | ||
backgroundColor={colors.pink400} | ||
/> | ||
} | ||
> | ||
SvgIcon Avatar with custom colors | ||
</ListItem> | ||
<ListItem | ||
disabled={true} | ||
leftAvatar={ | ||
<Avatar icon={<FontIcon className="muidocs-icon-communication-voicemail" />} /> | ||
} | ||
> | ||
FontIcon Avatar | ||
</ListItem> | ||
<ListItem | ||
disabled={true} | ||
leftAvatar={ | ||
<Avatar | ||
icon={<FontIcon className="muidocs-icon-communication-voicemail" />} | ||
color={colors.blue300} | ||
backgroundColor={colors.indigo900} | ||
/> | ||
} | ||
> | ||
FontIcon Avatar with custom colors | ||
</ListItem> | ||
<ListItem | ||
disabled={true} | ||
leftAvatar={<Avatar>A</Avatar>} | ||
> | ||
Letter Avatar | ||
</ListItem> | ||
<ListItem | ||
disabled={true} | ||
leftAvatar={ | ||
<Avatar | ||
color={colors.deepOrange300} | ||
backgroundColor={colors.purple500} | ||
> | ||
A | ||
</Avatar> | ||
} | ||
> | ||
Letter Avatar with custom colors | ||
</ListItem> | ||
</List> | ||
); | ||
}, | ||
}); | ||
|
||
export default AvatarExampleSimple; |
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 @@ | ||
## Avatar | ||
|
||
Avatars can be used to represent people or object. | ||
|
||
### 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,108 +1,27 @@ | ||
import React from 'react'; | ||
import { | ||
Avatar, | ||
FontIcon, | ||
List, | ||
ListItem, | ||
Styles, | ||
Paper, | ||
} from 'material-ui'; | ||
import ComponentDoc from '../../component-doc'; | ||
import FileFolder from 'material-ui/svg-icons/file/folder'; | ||
const {Colors} = Styles; | ||
import Code from 'avatars-code'; | ||
import avatarCode from '!raw!material-ui/avatar'; | ||
import CodeExample from '../../code-example/code-example'; | ||
import CodeBlock from '../../code-example/code-block'; | ||
|
||
import PropTypeDescription from '../../PropTypeDescription'; | ||
import AvatarExampleSimple from '../../Avatar/ExampleSimple'; | ||
import avatarExampleSimpleCode from '!raw!../../Avatar/ExampleSimple'; | ||
import MarkdownElement from '../../MarkdownElement'; | ||
import avatarReadmeText from '../../Avatar/README'; | ||
|
||
export default class AvatarsPage extends React.Component { | ||
|
||
render() { | ||
|
||
let desc = null; | ||
|
||
let componentInfo = [ | ||
{ | ||
name: 'Props', | ||
infoArray: [ | ||
{ | ||
name: 'icon', | ||
type: 'element', | ||
header: 'optional', | ||
desc: 'This is the SvgIcon or FontIcon to be used inside the avatar.', | ||
}, | ||
{ | ||
name: 'backgroundColor', | ||
type: 'string', | ||
header: 'default: grey400', | ||
desc: 'The backgroundColor of the avatar. Does not apply to image avatars.', | ||
}, | ||
{ | ||
name: 'color', | ||
type: 'string', | ||
header: 'default: white', | ||
desc: 'The icon or letter color.', | ||
}, | ||
{ | ||
name: 'size', | ||
type: 'number', | ||
header: 'default: 40', | ||
desc: 'This is the size of the avatar in pixels', | ||
}, | ||
{ | ||
name: 'src', | ||
type: 'string', | ||
header: 'optional', | ||
desc: 'If passed in, this component will render an img element. Otherwise, a div will be rendered.', | ||
}, | ||
{ | ||
name: 'style', | ||
type: 'object', | ||
header: 'optional', | ||
desc: 'Override the inline-styles of the root element.', | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
let imageAvatar = <Avatar src="images/uxceo-128.jpg" />; | ||
let svgAvatar = <Avatar icon={<FileFolder />} />; | ||
let customSvgAvatar = <Avatar icon={<FileFolder />} color={Colors.orange200} backgroundColor={Colors.pink400} />; | ||
let fontAvatar = <Avatar icon={<FontIcon className="muidocs-icon-communication-voicemail" />} />; | ||
let customFontAvatar = <Avatar icon={<FontIcon className="muidocs-icon-communication-voicemail" />} | ||
color={Colors.blue300} backgroundColor={Colors.indigo900} />; | ||
let letterAvatar = <Avatar>A</Avatar>; | ||
let customLetterAvatar = <Avatar color={Colors.deepOrange300} backgroundColor={Colors.purple500}>A</Avatar>; | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
render() { | ||
return ( | ||
<ComponentDoc | ||
name="Avatars" | ||
desc={desc} | ||
componentInfo={componentInfo}> | ||
|
||
<Paper style = {{marginBottom: '22px'}}> | ||
<CodeBlock> | ||
{ | ||
'//Import statement:\nimport Avatar from \'material-ui/lib/avatar\';\n\n' + | ||
'//See material-ui/lib/index.js for more\n' | ||
} | ||
</CodeBlock> | ||
</Paper> | ||
|
||
<CodeExample code={Code}> | ||
<List> | ||
<ListItem leftAvatar={imageAvatar} disabled={true}>Image Avatar</ListItem> | ||
<ListItem leftAvatar={svgAvatar} disabled={true}>SvgIcon Avatar</ListItem> | ||
<ListItem leftAvatar={customSvgAvatar} disabled={true}>SvgIcon Avatar with custom colors</ListItem> | ||
<ListItem leftAvatar={fontAvatar} disabled={true}>FontIcon Avatar</ListItem> | ||
<ListItem leftAvatar={customFontAvatar} disabled={true}>FontIcon Avatar with custom colors</ListItem> | ||
<ListItem leftAvatar={letterAvatar} disabled={true}>Letter Avatar</ListItem> | ||
<ListItem leftAvatar={customLetterAvatar} disabled={true}>Letter Avatar with custom colors</ListItem> | ||
</List> | ||
<div> | ||
<MarkdownElement text={avatarReadmeText} /> | ||
<CodeExample code={avatarExampleSimpleCode}> | ||
<AvatarExampleSimple /> | ||
</CodeExample> | ||
</ComponentDoc> | ||
<PropTypeDescription code={avatarCode}/> | ||
</div> | ||
); | ||
|
||
} | ||
|
||
} |
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 don't mind this, but I think it helps readability to be more explicit. If you agree please add className to props destructuring and to the div's props.