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
60a8d27b
Commit
60a8d27b
authored
5 years ago
by
Raul Almeida
Browse files
Options
Downloads
Patches
Plain Diff
WIP Item Store: finish item card carousel
It's a circular linked list
parent
13807c12
No related branches found
No related tags found
1 merge request
!21
Gamification
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Components/ItemCarousel.js
+17
-7
17 additions, 7 deletions
src/Components/ItemCarousel.js
src/Pages/ItemStore.js
+12
-7
12 additions, 7 deletions
src/Pages/ItemStore.js
with
29 additions
and
14 deletions
src/Components/ItemCarousel.js
+
17
−
7
View file @
60a8d27b
...
@@ -22,6 +22,9 @@ import Card from '@material-ui/core/Card';
...
@@ -22,6 +22,9 @@ import Card from '@material-ui/core/Card';
import
CardActions
from
'
@material-ui/core/CardActions
'
;
import
CardActions
from
'
@material-ui/core/CardActions
'
;
import
CardContent
from
'
@material-ui/core/CardContent
'
;
import
CardContent
from
'
@material-ui/core/CardContent
'
;
import
ItemCard
from
'
./ItemCard.js
'
;
import
ItemCard
from
'
./ItemCard.js
'
;
import
ArrowBackIcon
from
'
@material-ui/icons/ArrowBack
'
;
import
ArrowForwardIcon
from
'
@material-ui/icons/ArrowForward
'
;
import
IconButton
from
'
@material-ui/core/IconButton
'
;
//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
)
{
...
@@ -29,13 +32,13 @@ export default function ItemCarousel (props) {
...
@@ -29,13 +32,13 @@ export default function ItemCarousel (props) {
const
[
right
,
setRight
]
=
useState
(
5
);
const
[
right
,
setRight
]
=
useState
(
5
);
const
goLeft
=
()
=>
{
const
goLeft
=
()
=>
{
set
Left
(
lef
t
-
1
);
set
Right
(
right
==
0
?
props
.
items
.
length
-
1
:
righ
t
-
1
);
set
Right
(
righ
t
-
1
);
set
Left
(
left
==
0
?
props
.
items
.
length
-
1
:
lef
t
-
1
);
}
}
const
goRight
=
()
=>
{
const
goRight
=
()
=>
{
setRight
(
right
+
1
);
setRight
(
right
==
props
.
items
.
length
-
1
?
0
:
right
+
1
);
setLeft
(
left
+
1
);
setLeft
(
left
==
props
.
items
.
length
-
1
?
0
:
left
+
1
);
}
}
return
(
return
(
...
@@ -47,15 +50,22 @@ export default function ItemCarousel (props) {
...
@@ -47,15 +50,22 @@ export default function ItemCarousel (props) {
xs
=
{
12
}
xs
=
{
12
}
spacing
=
{
3
}
spacing
=
{
3
}
>
>
<
p
onClick
=
{
goLeft
}
>
ESQUERDA
<
/p>
<
IconButton
onClick
=
{
goLeft
}
>
<
p
onClick
=
{
goRight
}
>
DIREITA
<
/p>
<
ArrowBackIcon
/>
{
props
.
items
.
slice
(
left
,
right
).
map
((
i
)
=>
{
<
/IconButton
>
{(
left
>
right
?
props
.
items
.
slice
(
left
,
props
.
items
.
length
).
concat
(
props
.
items
.
slice
(
0
,
right
))
:
props
.
items
.
slice
(
left
,
right
)
).
map
((
i
)
=>
{
return
<
ItemCard
return
<
ItemCard
src
=
{
i
.
src
}
src
=
{
i
.
src
}
action
=
{
i
.
action
}
action
=
{
i
.
action
}
name
=
{
i
.
name
}
name
=
{
i
.
name
}
description
=
{
i
.
description
}
/
>
description
=
{
i
.
description
}
/
>
})}
})}
<
IconButton
onClick
=
{
goRight
}
>
<
ArrowForwardIcon
/>
<
/IconButton
>
<
/Grid
>
<
/Grid
>
)
)
}
}
This diff is collapsed.
Click to expand it.
src/Pages/ItemStore.js
+
12
−
7
View file @
60a8d27b
...
@@ -28,9 +28,14 @@ import StoreGuide from '../Components/StoreGuide.js';
...
@@ -28,9 +28,14 @@ import StoreGuide from '../Components/StoreGuide.js';
import
ItemCarousel
from
'
../Components/ItemCarousel.js
'
;
import
ItemCarousel
from
'
../Components/ItemCarousel.js
'
;
import
{
apiUrl
}
from
'
../env
'
;
import
{
apiUrl
}
from
'
../env
'
;
const
Store
Section
=
styled
.
h
2
`
const
Section
Title
=
styled
.
h
3
`
font-weight: 100;
font-weight: 100;
`
`
const
StoreSection
=
styled
.
div
`
font-size: 1.5em;
margin-top: 20px;
margin-bottom: 20px;
`
export
default
function
ItemStoreContainer
(
props
)
{
export
default
function
ItemStoreContainer
(
props
)
{
const
[
avatar_frames
,
setAvatarFrames
]
=
useState
([]);
const
[
avatar_frames
,
setAvatarFrames
]
=
useState
([]);
...
@@ -59,8 +64,8 @@ export default function ItemStoreContainer (props) {
...
@@ -59,8 +64,8 @@ export default function ItemStoreContainer (props) {
description
:
"
Descrição | Descrição
"
description
:
"
Descrição | Descrição
"
}
}
];
];
for
(
let
i
=
0
;
i
<
6
;
i
++
)
for
(
let
i
=
0
;
i
<
10
;
i
++
)
items
=
items
.
concat
(
items
);
items
=
items
.
concat
(
items
[
0
]
);
return
(
return
(
<
Container
style
=
{{
paddingTop
:
"
2em
"
,
backgroundColor
:
"
#f4f4f4
"
}}
>
<
Container
style
=
{{
paddingTop
:
"
2em
"
,
backgroundColor
:
"
#f4f4f4
"
}}
>
...
@@ -77,19 +82,19 @@ export default function ItemStoreContainer (props) {
...
@@ -77,19 +82,19 @@ export default function ItemStoreContainer (props) {
<
StoreGuide
/>
<
StoreGuide
/>
<
/Grid
>
<
/Grid
>
<
StoreSection
>
<
StoreSection
>
Bordas
de
avatar
<
SectionTitle
>
Bordas
de
avatar
<
/SectionTitle
>
<
ItemCarousel
items
=
{
items
}
/
>
<
ItemCarousel
items
=
{
items
}
/
>
<
/StoreSection
>
<
/StoreSection
>
<
StoreSection
>
<
StoreSection
>
Insígnias
<
SectionTitle
>
Insígnias
<
/SectionTitle
>
<
ItemCarousel
items
=
{
items
}
/
>
<
ItemCarousel
items
=
{
items
}
/
>
<
/StoreSection
>
<
/StoreSection
>
<
StoreSection
>
<
StoreSection
>
Bordas
de
card
<
SectionTitle
>
Bordas
de
card
<
/SectionTitle
>
<
ItemCarousel
items
=
{
items
}
/
>
<
ItemCarousel
items
=
{
items
}
/
>
<
/StoreSection
>
<
/StoreSection
>
<
StoreSection
>
<
StoreSection
>
Bordas
de
capa
de
perfil
<
SectionTitle
>
Bordas
de
capa
de
perfil
<
/SectionTitle
>
<
ItemCarousel
items
=
{
items
}
/
>
<
ItemCarousel
items
=
{
items
}
/
>
<
/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