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
Harbor Registry
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
13807c12
Commit
13807c12
authored
5 years ago
by
Raul Almeida
Browse files
Options
Downloads
Patches
Plain Diff
WIP Item Carousel
parent
4dd73677
No related branches found
No related tags found
1 merge request
!21
Gamification
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Components/ItemCardAction.js
+3
-3
3 additions, 3 deletions
src/Components/ItemCardAction.js
src/Components/ItemCarousel.js
+15
-11
15 additions, 11 deletions
src/Components/ItemCarousel.js
src/Pages/ItemStore.js
+16
-5
16 additions, 5 deletions
src/Pages/ItemStore.js
with
34 additions
and
19 deletions
src/Components/ItemCardAction.js
+
3
−
3
View file @
13807c12
...
@@ -64,15 +64,15 @@ export default function ItemCardAction (props) {
...
@@ -64,15 +64,15 @@ export default function ItemCardAction (props) {
const
handleClick
=
()
=>
{
const
handleClick
=
()
=>
{
// this will become an axios get
// this will become an axios get
if
(
true
)
{
if
(
props
.
operation
==
'
unequip
'
)
{
setInfo
(
true
);
setInfo
(
true
);
setMessage
(
"
Item retirado
"
);
setMessage
(
"
Item retirado
"
);
}
}
else
if
(
true
)
{
else
if
(
props
.
operation
==
'
equip
'
)
{
setInfo
(
true
);
setInfo
(
true
);
setMessage
(
"
Item equipado
"
);
setMessage
(
"
Item equipado
"
);
}
}
else
if
(
true
)
{
else
if
(
props
.
operation
==
'
buy
'
)
{
setSuccess
(
true
);
setSuccess
(
true
);
setMessage
(
"
Item comprado
"
);
setMessage
(
"
Item comprado
"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/Components/ItemCarousel.js
+
15
−
11
View file @
13807c12
...
@@ -25,16 +25,18 @@ import ItemCard from './ItemCard.js';
...
@@ -25,16 +25,18 @@ import ItemCard from './ItemCard.js';
//url/user_items/index?q={"item_type": umdaqueles, "op": "none", "unlock_rule": "purchase"}
//url/user_items/index?q={"item_type": umdaqueles, "op": "none", "unlock_rule": "purchase"}
export
default
function
ItemCarousel
(
props
)
{
export
default
function
ItemCarousel
(
props
)
{
var
items
=
[
const
[
left
,
setLeft
]
=
useState
(
0
);
{
const
[
right
,
setRight
]
=
useState
(
5
);
src
:
"
https://upload.wikimedia.org/wikipedia/en/9/90/The_DuckDuckGo_Duck.png
"
,
action
:
"
equip
"
,
const
goLeft
=
()
=>
{
name
:
"
Avatar um
"
,
setLeft
(
left
-
1
);
description
:
"
Descrição | Descrição
"
setRight
(
right
-
1
);
}
const
goRight
=
()
=>
{
setRight
(
right
+
1
);
setLeft
(
left
+
1
);
}
}
];
for
(
let
i
=
0
;
i
<
2
;
i
++
)
items
=
items
.
concat
(
items
);
return
(
return
(
<
Grid
<
Grid
...
@@ -45,7 +47,9 @@ export default function ItemCarousel (props) {
...
@@ -45,7 +47,9 @@ export default function ItemCarousel (props) {
xs
=
{
12
}
xs
=
{
12
}
spacing
=
{
3
}
spacing
=
{
3
}
>
>
{
items
.
map
((
i
)
=>
{
<
p
onClick
=
{
goLeft
}
>
ESQUERDA
<
/p>
<
p
onClick
=
{
goRight
}
>
DIREITA
<
/p>
{
props
.
items
.
slice
(
left
,
right
).
map
((
i
)
=>
{
return
<
ItemCard
return
<
ItemCard
src
=
{
i
.
src
}
src
=
{
i
.
src
}
action
=
{
i
.
action
}
action
=
{
i
.
action
}
...
...
This diff is collapsed.
Click to expand it.
src/Pages/ItemStore.js
+
16
−
5
View file @
13807c12
...
@@ -51,8 +51,19 @@ export default function ItemStoreContainer (props) {
...
@@ -51,8 +51,19 @@ export default function ItemStoreContainer (props) {
}));
}));
},
[])
},
[])
var
items
=
[
{
src
:
"
https://upload.wikimedia.org/wikipedia/en/9/90/The_DuckDuckGo_Duck.png
"
,
action
:
"
equip
"
,
name
:
"
Avatar um
"
,
description
:
"
Descrição | Descrição
"
}
];
for
(
let
i
=
0
;
i
<
6
;
i
++
)
items
=
items
.
concat
(
items
);
return
(
return
(
<
Container
style
=
{{
paddingTop
:
"
2em
"
,
backgroundColor
:
"
purple
"
}}
>
<
Container
style
=
{{
paddingTop
:
"
2em
"
,
backgroundColor
:
"
#f4f4f4
"
}}
>
<
Grid
container
<
Grid
container
direction
=
"
row
"
direction
=
"
row
"
justify
=
"
space-around
"
justify
=
"
space-around
"
...
@@ -67,19 +78,19 @@ export default function ItemStoreContainer (props) {
...
@@ -67,19 +78,19 @@ export default function ItemStoreContainer (props) {
<
/Grid
>
<
/Grid
>
<
StoreSection
>
<
StoreSection
>
Bordas
de
avatar
Bordas
de
avatar
<
ItemCarousel
items
=
{
avatar_frame
s
}
/
>
<
ItemCarousel
items
=
{
item
s
}
/
>
<
/StoreSection
>
<
/StoreSection
>
<
StoreSection
>
<
StoreSection
>
Insígnias
Insígnias
<
ItemCarousel
items
=
{
badge
s
}
/
>
<
ItemCarousel
items
=
{
item
s
}
/
>
<
/StoreSection
>
<
/StoreSection
>
<
StoreSection
>
<
StoreSection
>
Bordas
de
card
Bordas
de
card
<
ItemCarousel
items
=
{
card_frame
s
}
/
>
<
ItemCarousel
items
=
{
item
s
}
/
>
<
/StoreSection
>
<
/StoreSection
>
<
StoreSection
>
<
StoreSection
>
Bordas
de
capa
de
perfil
Bordas
de
capa
de
perfil
<
ItemCarousel
items
=
{
cover_frame
s
}
/
>
<
ItemCarousel
items
=
{
item
s
}
/
>
<
/StoreSection
>
<
/StoreSection
>
<
/Container
>
<
/Container
>
)
)
...
...
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