Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PortalMEC-React
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PortalMEC
PortalMEC-React
Commits
e3f0993d
Commit
e3f0993d
authored
4 years ago
by
lfr20
Browse files
Options
Downloads
Patches
Plain Diff
added links and removed verifications if its published
parent
7333c7b2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
4 merge requests
!57
Merge of develop into master
,
!56
Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...
,
!39
Update admin system
,
!36
Fix perfil into develop
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Components/ResourceCardFunction.js
+43
-70
43 additions, 70 deletions
src/Components/ResourceCardFunction.js
with
43 additions
and
70 deletions
src/Components/ResourceCardFunction.js
+
43
−
70
View file @
e3f0993d
...
@@ -18,31 +18,13 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>
...
@@ -18,31 +18,13 @@ along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
Card
from
'
@material-ui/core/Card
'
;
import
Card
from
'
@material-ui/core/Card
'
;
import
{
apiDomain
}
from
'
../env
'
;
import
{
apiDomain
}
from
'
../env
'
;
import
ResourceCardOptions
from
'
./ResourceCardOptions
'
import
ResourceCardOptions
from
'
./ResourceCardOptions
'
import
noAvatar
from
"
../img/default_profile.png
"
;
import
noAvatar
from
"
../img/default_profile.png
"
;
// import { makeStyles } from '@material-ui/core/styles';
import
Button
from
'
@material-ui/core/Button
'
;
import
Button
from
'
@material-ui/core/Button
'
;
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
// import animacao from "../img/laranja/ANIMACAO_SIMULACAO.jpg";
// import apresentacao from "../img/laranja/APRESENTACAO.jpg";
// import aplicativo from "../img/laranja/APP.jpg";
// import audio from "../img/laranja/AUDIO.jpg";
// import vazio from "../img/laranja/EMPTY.jpg";
// import imagem from "../img/laranja/IMAGEM.jpg";
// import grafico from "../img/laranja/INFOGRAFICO.jpg";
// import jogo from "../img/laranja/JOGO.jpg";
// import livro from "../img/laranja/LIVRO_DIGITAL.jpg";
// import mapa from "../img/laranja/MAPA.jpg";
// import outros from "../img/laranja/OUTROS.jpg";
// import software from "../img/laranja/SOFTWARE.jpg";
// import texto from "../img/laranja/TEXTO.jpg";
// import video from "../img/laranja/VIDEO.jpg";
import
Rating
from
'
@material-ui/lab/Rating
'
;
import
Rating
from
'
@material-ui/lab/Rating
'
;
import
StarBorderIcon
from
'
@material-ui/icons/StarBorder
'
;
import
StarBorderIcon
from
'
@material-ui/icons/StarBorder
'
;
// import AddIcon from '@material-ui/icons/CreateNewFolder';
// import Video from '@material-ui/icons/OndemandVideo';
// import MoreIcon from '@material-ui/icons/More';
import
FavoriteIcon
from
'
@material-ui/icons/Favorite
'
;
import
FavoriteIcon
from
'
@material-ui/icons/Favorite
'
;
import
ButtonGuardarColecao
from
'
./ButtonGuardarColecao.js
'
import
ButtonGuardarColecao
from
'
./ButtonGuardarColecao.js
'
import
Slide
from
'
@material-ui/core/Slide
'
;
import
Slide
from
'
@material-ui/core/Slide
'
;
...
@@ -51,7 +33,7 @@ import { Link } from 'react-router-dom';
...
@@ -51,7 +33,7 @@ import { Link } from 'react-router-dom';
import
{
getDefaultThumbnail
}
from
'
./HelperFunctions/getDefaultThumbnail
'
import
{
getDefaultThumbnail
}
from
'
./HelperFunctions/getDefaultThumbnail
'
import
GetIconByName
from
'
./UploadPageComponents/GetIconByName
'
import
GetIconByName
from
'
./UploadPageComponents/GetIconByName
'
import
"
./ResourceCard.css
"
;
import
"
./ResourceCard.css
"
;
import
{
putRequest
}
from
'
./HelperFunctions/getAxiosConfig
'
import
{
putRequest
}
from
'
./HelperFunctions/getAxiosConfig
'
export
default
function
ResourceCardFunction
(
props
)
{
export
default
function
ResourceCardFunction
(
props
)
{
const
[
thumbnail
,
setThumbnail
]
=
useState
(
null
)
const
[
thumbnail
,
setThumbnail
]
=
useState
(
null
)
...
@@ -81,7 +63,7 @@ export default function ResourceCardFunction(props) {
...
@@ -81,7 +63,7 @@ export default function ResourceCardFunction(props) {
},
[])
},
[])
function
handleSuccessLike
(
data
)
{
function
handleSuccessLike
(
data
)
{
toggleLiked
(
!
liked
)
toggleLiked
(
!
liked
)
setLikesCount
(
data
.
count
)
setLikesCount
(
data
.
count
)
}
}
...
@@ -89,32 +71,35 @@ export default function ResourceCardFunction(props) {
...
@@ -89,32 +71,35 @@ export default function ResourceCardFunction(props) {
const
handleLike
=
()
=>
{
const
handleLike
=
()
=>
{
const
url
=
`/learning_objects/
${
props
.
id
}
/like/`
const
url
=
`/learning_objects/
${
props
.
id
}
/like/`
putRequest
(
url
,
{},
handleSuccessLike
,
(
error
)
=>
{
console
.
log
(
error
)})
putRequest
(
url
,
{},
handleSuccessLike
,
(
error
)
=>
{
console
.
log
(
error
)
})
}
}
const
SlideAnimationContent
=
()
=>
{
const
SlideAnimationContent
=
()
=>
{
return
(
return
(
<
SlideContentDiv
>
<
SlideContentDiv
>
<
div
style
=
{{
padding
:
7
}}
>
<
div
style
=
{{
padding
:
7
}}
>
<
HeaderContainer
container
=
"
row
"
justify
=
"
flex-start
"
alignItems
=
"
center
"
>
{
/*marginBottom:10px*/
}
<
HeaderContainer
container
=
"
row
"
justify
=
"
flex-start
"
alignItems
=
"
center
"
>
{
/*marginBottom:10px*/
}
<
AvatarDiv
item
xs
=
{
2
}
>
<
AvatarDiv
item
xs
=
{
2
}
>
<
img
className
=
"
img
"
src
=
{
userAvatar
}
alt
=
"
user avatar
"
/>
<
img
className
=
"
img
"
src
=
{
userAvatar
}
alt
=
"
user avatar
"
/>
<
/AvatarDiv
>
<
/AvatarDiv
>
<
EnviadoPor
item
xs
=
{
10
}
>
<
EnviadoPor
item
xs
=
{
10
}
>
Enviado
por
:
Enviado
por
:
<
br
/>
<
p
>
{
props
.
author
}
<
/p
>
<
p
>
{
props
.
author
}
<
/p
>
<
/EnviadoPor
>
<
/EnviadoPor
>
<
/HeaderContainer
>
<
/HeaderContainer
>
<
TagContainer
container
direction
=
"
row
"
>
{
{
props
.
tags
?
props
.
tags
.
map
((
tag
)
=>
<
TagContainer
container
direction
=
"
row
"
>
<
Grid
item
key
=
{
tag
.
id
}
>
{
<
span
>
{
tag
.
name
}
<
/span
>
props
.
tags
.
map
((
tag
)
=>
<
/Grid
>
<
Grid
item
key
=
{
tag
.
id
}
>
)
<
span
>
{
tag
.
name
}
<
/span
>
}
<
/Grid
>
<
/TagContainer
>
)
}
<
/TagContainer>
:
null
}
<
/div
>
<
/div
>
<
/SlideContentDiv
>
<
/SlideContentDiv
>
)
)
...
@@ -135,9 +120,7 @@ export default function ResourceCardFunction(props) {
...
@@ -135,9 +120,7 @@ export default function ResourceCardFunction(props) {
<
/Slide
>
<
/Slide
>
}
}
<
div
className
=
{
`slideContentLinkBeforeActive
${
slideIn
}
`
}
style
=
{{
height
:
'
100%
'
}}
>
<
div
className
=
{
`slideContentLinkBeforeActive
${
slideIn
}
`
}
style
=
{{
height
:
'
100%
'
}}
>
<
Link
to
=
{
props
.
href
}
>
<
img
className
=
"
img-cover
"
src
=
{
thumbnail
}
alt
=
"
learning object thumbnail
"
style
=
{{
width
:
"
272.5px
"
}}
/
>
<
img
className
=
"
img-cover
"
src
=
{
thumbnail
}
alt
=
"
learning object thumbnail
"
style
=
{{
width
:
"
272.5px
"
}}
/
>
<
/Link
>
<
/div
>
<
/div
>
<
/Header
>
<
/Header
>
<
Description
>
<
Description
>
...
@@ -146,49 +129,39 @@ export default function ResourceCardFunction(props) {
...
@@ -146,49 +129,39 @@ export default function ResourceCardFunction(props) {
{
props
.
title
}
{
props
.
title
}
<
/Title
>
<
/Title
>
<
/Link
>
<
/Link
>
{
<
Rating
props
.
published
&&
name
=
"
customized-empty
"
<
Rating
value
=
{
props
.
rating
}
name
=
"
customized-empty
"
readOnly
value
=
{
props
.
rating
}
style
=
{{
color
:
"
#666
"
}}
readOnly
emptyIcon
=
{
<
StarBorderIcon
fontSize
=
"
inherit
"
/>
}
style
=
{{
color
:
"
#666
"
}}
/
>
emptyIcon
=
{
<
StarBorderIcon
fontSize
=
"
inherit
"
/>
}
/
>
}
<
Footer
>
<
Footer
>
<
Type
>
<
Type
>
{
GetIconByName
(
label
)}
{
GetIconByName
(
label
)}
<
span
>
{
label
}
<
/span
>
<
span
>
{
label
}
<
/span
>
<
/Type
>
<
/Type
>
{
<
LikeCounter
>
props
.
published
&&
<
span
>
{
likesCount
}
<
/span
>
<
LikeCounter
>
<
ButtonNoWidth
onClick
=
{
handleLike
}
>
<
span
>
{
likesCount
}
<
/span
>
<
FavoriteIcon
style
=
{{
color
:
liked
?
"
red
"
:
"
#666
"
}}
/
>
<
ButtonNoWidth
onClick
=
{
handleLike
}
>
<
/ButtonNoWidth
>
<
FavoriteIcon
style
=
{{
color
:
liked
?
"
red
"
:
"
#666
"
}}
/
>
<
/LikeCounter
>
<
/ButtonNoWidth
>
<
/LikeCounter
>
}
<
/Footer
>
<
/Footer
>
<
/Description
>
<
/Description
>
<
/CardReaDiv
>
<
/CardReaDiv
>
<
CardReaFooter
>
{
<
div
style
=
{{
display
:
"
flex
"
,
height
:
"
100%
"
}}
>
props
.
published
&&
<
ButtonGuardarColecao
thumb
=
{
props
.
thumbnail
}
title
=
{
props
.
title
}
recursoId
=
{
props
.
id
}
<
CardReaFooter
>
<
div
style
=
{{
display
:
"
flex
"
,
height
:
"
100%
"
}}
>
<
ButtonGuardarColecao
thumb
=
{
props
.
thumbnail
}
title
=
{
props
.
title
}
recursoId
=
{
props
.
id
}
/
>
<
/div
>
<
ResourceCardOptions
learningObjectId
=
{
props
.
id
}
downloadableLink
=
{
props
.
downloadableLink
}
thumb
=
{
props
.
thumbnail
}
title
=
{
props
.
title
}
/
>
/
>
<
/CardReaFooter
>
<
/div
>
}
<
ResourceCardOptions
learningObjectId
=
{
props
.
id
}
downloadableLink
=
{
props
.
downloadableLink
}
thumb
=
{
props
.
thumbnail
}
title
=
{
props
.
title
}
/
>
<
/CardReaFooter
>
<
/CardDiv
>
<
/CardDiv
>
<
/StyledCard
>
<
/StyledCard
>
)
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment