Skip to content
Snippets Groups Projects
Commit a473554a authored by lfr20's avatar lfr20
Browse files

finish to build the material card

parent 6f23caa6
No related branches found
No related tags found
6 merge requests!57Merge of develop into master,!56Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...,!39Update admin system,!32Homologa,!31Fix console error,!27Training materials
...@@ -16,40 +16,78 @@ GNU Affero General Public License for more details. ...@@ -16,40 +16,78 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License You should have received a copy of the GNU Affero General Public License
along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/
import React, {Component} from 'react'; import React, {useState} from 'react';
import Card from '@material-ui/core/Card'; import Card from '@material-ui/core/Card';
import CardContent from '@material-ui/core/CardContent'; import CardContent from '@material-ui/core/CardContent';
import CardActions from '@material-ui/core/CardActions'; import CardActions from '@material-ui/core/CardActions';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
import livro from "../img/laranja/LIVRO_DIGITAL.jpg";
import Library from '@material-ui/icons/LibraryBooks'; import Library from '@material-ui/icons/LibraryBooks';
import Rating from '@material-ui/lab/Rating';
import StarBorderIcon from '@material-ui/icons/StarBorder';
import Grid from '@material-ui/core/Grid';
import styled from 'styled-components';
import Button from '@material-ui/core/Button';
import ExpandMoreRoundedIcon from '@material-ui/icons/ExpandMoreRounded';
import ExpandLessRoundedIcon from '@material-ui/icons/ExpandLessRounded';
export default function MaterialCard(props) {
class MaterialCard extends Component { const [expanded, setExpanded] = useState(false);
constructor(props) {
super(props); const thumb = require(`../../public/${props.thumb}`)
this.state={
thumbnail: livro, return (
}; <Card>
} <img src={thumb} alt="thumbnail do recurso" />
render(){ <CardContent style={{ height: "60px", textAlign: "left", paddingBottom: "0px", width: "100%" }}>
return ( <Title>
<Card> {props.name}
<img src={this.state.thumbnail} alt="thumbnail do recurso"/> </Title>
<CardContent style={{height: "60%", textAlign: "left", paddingBottom: "0px"}}> </CardContent>
<Typography variant="body2" color="textSecondary" component="p" style={{overflow: "hidden", fontSize: "0.8em"}}> <CardActions>
{this.props.name} <Grid container direction="column" justify="flex-start" alignItems="flex-start" style={{ marginLeft: "5px" }}>
</Typography> <Grid item>
</CardContent> <Rating
<CardActions style={{justifyContent: "space-between"}}> name="customized-empty"
<Library style={{color:"#e81f4f"}} /> value={props.score}
</CardActions> precision={0.5}
<CardActions style={{borderTop:"1px solid #e5e5e5", justifyContent: "space-between"}}> style={{ color: "#666" }}
<Typography>Expandir??</Typography> emptyIcon={<StarBorderIcon fontSize="inherit" />}
</CardActions> readOnly
</Card> />
);} </Grid>
} <Grid container direction="row" alignItems="center">
<Library style={{ color: "#e81f4f" }} />
<SizedBox />
export default MaterialCard; <Typography variant="body2" color="textSecondary" component="p" style={{ overflow: "hidden", fontSize: "0.8em" }}>
{props.modules.length} módulos
</Typography>
</Grid>
</Grid>
</CardActions>
<CardActions style={{ borderTop: "1px solid #e5e5e5", justifyContent: "center" }}>
<Button
color="secondary"
endIcon={expanded ? <ExpandLessRoundedIcon/> : <ExpandMoreRoundedIcon/>}
onClick={() => props.handleExpand(props.id)}
>
Expandir
</Button>
</CardActions>
</Card >
)
}
const SizedBox = styled.div`
width : 5px;
`
const Title = styled(Typography)`
text-overflow: ellipsis;
overflow: hidden;
margin-bottom: 10px;
font-size: 1.2em;
line-height: 1.1;
max-height: 46px;
color: #666;
`
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment