File tree 6 files changed +97
-4
lines changed
src/components/classrooms
6 files changed +97
-4
lines changed Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import PropTypes from 'prop-types' ;
3
+ import Icon from '@material-ui/icons/Assessment' ;
4
+ import { withTranslation } from 'react-i18next' ;
5
+
6
+ const ActionIcon = ( { className, text, t } ) => {
7
+ return (
8
+ < >
9
+ < Icon className = { className } />
10
+ { text && < span > { t ( 'Actions' ) } </ span > }
11
+ </ >
12
+ ) ;
13
+ } ;
14
+
15
+ ActionIcon . propTypes = {
16
+ className : PropTypes . string ,
17
+ text : PropTypes . bool ,
18
+ t : PropTypes . func . isRequired ,
19
+ } ;
20
+
21
+ ActionIcon . defaultProps = {
22
+ className : '' ,
23
+ text : false ,
24
+ } ;
25
+
26
+ export default withTranslation ( ) ( ActionIcon ) ;
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import PropTypes from 'prop-types' ;
3
+ import { withStyles } from '@material-ui/core' ;
4
+ import ResourceIcon from './ResourceIcon' ;
5
+ import ActionIcon from './ActionIcon' ;
6
+
7
+ const styles = theme => ( {
8
+ legend : {
9
+ display : 'flex' ,
10
+ justifyContent : 'flex-end' ,
11
+ alignItems : 'center' ,
12
+
13
+ '& span' : {
14
+ marginLeft : theme . spacing ( 0.5 ) ,
15
+ marginRight : theme . spacing ( 2 ) ,
16
+ } ,
17
+ } ,
18
+ } ) ;
19
+
20
+ const ClassroomLegend = ( { classes } ) => {
21
+ return (
22
+ < div className = { classes . legend } >
23
+ < ResourceIcon text />
24
+ < ActionIcon text />
25
+ </ div >
26
+ ) ;
27
+ } ;
28
+
29
+ ClassroomLegend . propTypes = {
30
+ classes : PropTypes . shape ( {
31
+ legend : PropTypes . string . isRequired ,
32
+ } ) . isRequired ,
33
+ } ;
34
+
35
+ const StyledComponent = withStyles ( styles , { withTheme : true } ) (
36
+ ClassroomLegend
37
+ ) ;
38
+
39
+ export default StyledComponent ;
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import Button from '@material-ui/core/Button';
9
9
import Toolbar from '@material-ui/core/Toolbar' ;
10
10
import CssBaseline from '@material-ui/core/CssBaseline/CssBaseline' ;
11
11
import AppBar from '@material-ui/core/AppBar/AppBar' ;
12
+ import ClassroomLegend from './ClassroomLegend' ;
12
13
import Styles from '../../Styles' ;
13
14
import Loader from '../common/Loader' ;
14
15
import Main from '../common/Main' ;
@@ -124,6 +125,7 @@ class ClassroomScreen extends Component {
124
125
< Main >
125
126
< div className = { classes . screen } >
126
127
< StudentsTable classroom = { classroom } />
128
+ < ClassroomLegend />
127
129
< ImportDataButton classroomId = { classroomId } />
128
130
< AddUserInClassroomButton classroomId = { classroomId } />
129
131
{ this . renderBackButton ( ) }
Original file line number Diff line number Diff line change @@ -13,8 +13,6 @@ import Button from '@material-ui/core/Button';
13
13
import IconButton from '@material-ui/core/IconButton' ;
14
14
import { withTranslation } from 'react-i18next' ;
15
15
import Typography from '@material-ui/core/Typography' ;
16
- import ResourceIcon from '@material-ui/icons/AssignmentInd' ;
17
- import ActionIcon from '@material-ui/icons/Assessment' ;
18
16
import CancelIcon from '@material-ui/icons/Cancel' ;
19
17
import TextField from '@material-ui/core/TextField' ;
20
18
import Dialog from '@material-ui/core/Dialog' ;
@@ -39,6 +37,8 @@ import {
39
37
hasUserResourcesForSpaceInClassroom ,
40
38
hasUserDataInClassroom ,
41
39
} from '../../utils/classroom' ;
40
+ import ResourceIcon from './ResourceIcon' ;
41
+ import ActionIcon from './ActionIcon' ;
42
42
43
43
const styles = theme => ( {
44
44
formControl : {
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import PropTypes from 'prop-types' ;
3
+ import Icon from '@material-ui/icons/AssignmentInd' ;
4
+ import { withTranslation } from 'react-i18next' ;
5
+
6
+ const ResourceIcon = ( { className, text, t } ) => {
7
+ return (
8
+ < >
9
+ < Icon className = { className } />
10
+ { text && < span > { t ( 'Resources' ) } </ span > }
11
+ </ >
12
+ ) ;
13
+ } ;
14
+
15
+ ResourceIcon . propTypes = {
16
+ className : PropTypes . string ,
17
+ text : PropTypes . bool ,
18
+ t : PropTypes . func . isRequired ,
19
+ } ;
20
+
21
+ ResourceIcon . defaultProps = {
22
+ className : '' ,
23
+ text : false ,
24
+ } ;
25
+
26
+ export default withTranslation ( ) ( ResourceIcon ) ;
Original file line number Diff line number Diff line change @@ -11,8 +11,6 @@ import TableContainer from '@material-ui/core/TableContainer';
11
11
import TablePagination from '@material-ui/core/TablePagination' ;
12
12
import TableRow from '@material-ui/core/TableRow' ;
13
13
import DeleteIcon from '@material-ui/icons/Delete' ;
14
- import ResourceIcon from '@material-ui/icons/AssignmentInd' ;
15
- import ActionIcon from '@material-ui/icons/Assessment' ;
16
14
import IconButton from '@material-ui/core/IconButton/IconButton' ;
17
15
import Tooltip from '@material-ui/core/Tooltip' ;
18
16
import Paper from '@material-ui/core/Paper' ;
@@ -39,6 +37,8 @@ import {
39
37
getUserResourcesForSpaceInClassroom ,
40
38
getUserActionsForSpaceInClassroom ,
41
39
} from '../../utils/classroom' ;
40
+ import ActionIcon from './ActionIcon' ;
41
+ import ResourceIcon from './ResourceIcon' ;
42
42
43
43
const styles = theme => ( {
44
44
root : {
You can’t perform that action at this time.
0 commit comments