Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Olive
olive-frontend
Commits
542140d0
Commit
542140d0
authored
3 years ago
by
Filipe Oliveira
Browse files
Options
Download
Email Patches
Plain Diff
fix(Card): card difficulty bedge color
parent
c7a03de3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/__tests__/__snapshots__/Card.test.js.snap
+1
-1
src/__tests__/__snapshots__/Card.test.js.snap
src/components/Card/index.js
+13
-12
src/components/Card/index.js
src/components/Card/styles.js
+13
-1
src/components/Card/styles.js
with
27 additions
and
14 deletions
+27
-14
src/__tests__/__snapshots__/Card.test.js.snap
View file @
542140d0
...
...
@@ -28,7 +28,7 @@ exports[`renders a simple Card 1`] = `
type="button"
>
<div
className="makeStyles-tag-6"
className="makeStyles-tag-6
makeStyles-tag-7
"
/>
<img
className="MuiCardMedia-root MuiCardMedia-media MuiCardMedia-img"
...
...
This diff is collapsed.
Click to expand it.
src/components/Card/index.js
View file @
542140d0
...
...
@@ -19,7 +19,17 @@ import clsx from 'clsx';
import
ExpandMoreIcon
from
'
@material-ui/icons/ExpandMore
'
;
function
Card
({
data
,
onClickCard
,
onClickLike
,
...
others
})
{
const
classes
=
useStyles
();
const
{
description
,
difficulty
,
preparation_time
,
portions
,
status
,
title
,
logo
,
}
=
data
;
const
classes
=
useStyles
({
difficulty
});
const
[
expanded
,
setExpanded
]
=
React
.
useState
(
false
);
const
[
like
,
setLike
]
=
React
.
useState
(
false
);
...
...
@@ -37,16 +47,6 @@ function Card({ data, onClickCard, onClickLike, ...others }) {
if
(
onClickCard
)
onClickCard
(
data
);
};
const
{
description
,
difficulty
,
preparation_time
,
portions
,
status
,
title
,
logo
,
}
=
data
;
const
difficultyObject
=
{
1
:
'
Fácil
'
,
2
:
'
Fácil
'
,
...
...
@@ -62,7 +62,8 @@ function Card({ data, onClickCard, onClickLike, ...others }) {
style
=
{{
position
:
'
relative
'
}}
>
<
div
className
=
{
classes
.
tag
}
>
{
status
||
difficultyObject
[
difficulty
]}
{
/* TODO: Levar em consideracao status */
}
{
difficultyObject
[
difficulty
]}
<
/div
>
<
CardMedia
component
=
"
img
"
...
...
This diff is collapsed.
Click to expand it.
src/components/Card/styles.js
View file @
542140d0
import
{
makeStyles
}
from
'
@material-ui/styles
'
;
function
getDifficultyColor
(
difficulty
)
{
const
colorMap
=
{
1
:
'
#52944F
'
,
2
:
'
#52944F
'
,
3
:
'
#FFCE00
'
,
4
:
'
#FFCE00
'
,
5
:
'
#FF6E61
'
,
};
return
colorMap
[
difficulty
];
}
const
useStyles
=
makeStyles
(
theme
=>
({
root
:
{
borderRadius
:
20
,
...
...
@@ -34,7 +46,7 @@ const useStyles = makeStyles(theme => ({
top
:
10
,
left
:
10
,
color
:
'
white
'
,
backgroundColor
:
'
#FF6E61
'
,
backgroundColor
:
props
=>
getDifficultyColor
(
props
.
difficulty
)
,
padding
:
'
6px 10px
'
,
borderRadius
:
21
,
letterSpacing
:
0.9
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment