Skip to content

Commit c433007

Browse files
committed
[docs] Enable avatar ts demos
1 parent 5718fad commit c433007

File tree

3 files changed

+127
-0
lines changed

3 files changed

+127
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { withStyles, WithStyles, createStyles } from '@material-ui/core/styles';
4+
import pink from '@material-ui/core/colors/pink';
5+
import green from '@material-ui/core/colors/green';
6+
import Avatar, { AvatarProps } from '@material-ui/core/Avatar';
7+
import FolderIcon from '@material-ui/icons/Folder';
8+
import PageviewIcon from '@material-ui/icons/Pageview';
9+
import AssignmentIcon from '@material-ui/icons/Assignment';
10+
import Grid from '@material-ui/core/Grid';
11+
12+
const styles = createStyles({
13+
avatar: {
14+
margin: 10,
15+
},
16+
pinkAvatar: {
17+
margin: 10,
18+
color: '#fff',
19+
backgroundColor: pink[500],
20+
},
21+
greenAvatar: {
22+
margin: 10,
23+
color: '#fff',
24+
backgroundColor: green[500],
25+
},
26+
});
27+
28+
export interface Props extends WithStyles<typeof styles> {}
29+
30+
function IconAvatars(props: Props) {
31+
const { classes } = props;
32+
return (
33+
<Grid container justify="center" alignItems="center">
34+
<Avatar className={classes.avatar}>
35+
<FolderIcon />
36+
</Avatar>
37+
<Avatar className={classes.pinkAvatar}>
38+
<PageviewIcon />
39+
</Avatar>
40+
<Avatar className={classes.greenAvatar}>
41+
<AssignmentIcon />
42+
</Avatar>
43+
</Grid>
44+
);
45+
}
46+
47+
IconAvatars.propTypes = {
48+
classes: PropTypes.object.isRequired,
49+
} as any;
50+
51+
export default withStyles(styles)(IconAvatars);
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { withStyles, WithStyles, createStyles } from '@material-ui/core/styles';
4+
import Avatar from '@material-ui/core/Avatar';
5+
import Grid from '@material-ui/core/Grid';
6+
7+
const styles = createStyles({
8+
avatar: {
9+
margin: 10,
10+
},
11+
bigAvatar: {
12+
margin: 10,
13+
width: 60,
14+
height: 60,
15+
},
16+
});
17+
18+
export interface Props extends WithStyles<typeof styles> {}
19+
20+
function ImageAvatars(props: Props) {
21+
const { classes } = props;
22+
return (
23+
<Grid container justify="center" alignItems="center">
24+
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" className={classes.avatar} />
25+
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" className={classes.bigAvatar} />
26+
</Grid>
27+
);
28+
}
29+
30+
ImageAvatars.propTypes = {
31+
classes: PropTypes.object.isRequired,
32+
} as any;
33+
34+
export default withStyles(styles)(ImageAvatars);
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { withStyles, WithStyles, createStyles } from '@material-ui/core/styles';
4+
import Avatar from '@material-ui/core/Avatar';
5+
import deepOrange from '@material-ui/core/colors/deepOrange';
6+
import deepPurple from '@material-ui/core/colors/deepPurple';
7+
import Grid from '@material-ui/core/Grid';
8+
9+
const styles = createStyles({
10+
avatar: {
11+
margin: 10,
12+
},
13+
orangeAvatar: {
14+
margin: 10,
15+
color: '#fff',
16+
backgroundColor: deepOrange[500],
17+
},
18+
purpleAvatar: {
19+
margin: 10,
20+
color: '#fff',
21+
backgroundColor: deepPurple[500],
22+
},
23+
});
24+
25+
export interface Props extends WithStyles<typeof styles> {}
26+
27+
function LetterAvatars(props: Props) {
28+
const { classes } = props;
29+
return (
30+
<Grid container justify="center" alignItems="center">
31+
<Avatar className={classes.avatar}>H</Avatar>
32+
<Avatar className={classes.orangeAvatar}>N</Avatar>
33+
<Avatar className={classes.purpleAvatar}>OP</Avatar>
34+
</Grid>
35+
);
36+
}
37+
38+
LetterAvatars.propTypes = {
39+
classes: PropTypes.object.isRequired,
40+
} as any;
41+
42+
export default withStyles(styles)(LetterAvatars);

0 commit comments

Comments
 (0)