Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ondřej Bazala
PV247
Commits
f57a14bc
Unverified
Commit
f57a14bc
authored
Nov 22, 2021
by
Michal Čaniga
Browse files
Finish layout of home carousel
parent
bd4bafd2
Changes
2
Show whitespace changes
Inline
Side-by-side
src/pages/Home/Home.tsx
View file @
f57a14bc
import
{
Typography
}
from
'
antd
'
;
import
usePageTitle
from
'
../../hooks/usePageTitle
'
;
import
usePageTitle
from
'
../../hooks/usePageTitle
'
;
import
{
HomeCarousel
}
from
'
./HomeCarousel
'
;
import
{
HomeCarousel
}
from
'
./HomeCarousel
'
;
...
@@ -7,13 +5,7 @@ import { HomeCarousel } from './HomeCarousel';
...
@@ -7,13 +5,7 @@ import { HomeCarousel } from './HomeCarousel';
const
Home
=
()
=>
{
const
Home
=
()
=>
{
usePageTitle
(
'
Home
'
);
usePageTitle
(
'
Home
'
);
return
(
return
<
HomeCarousel
/>;
<>
<
Typography
>
Add text
</
Typography
>
<
HomeCarousel
/>
<
Typography
>
Add text
</
Typography
>
</>
);
};
};
export
default
Home
;
export
default
Home
;
src/pages/Home/HomeCarousel.tsx
View file @
f57a14bc
import
{
Carousel
}
from
'
antd
'
;
import
{
Carousel
,
Typography
}
from
'
antd
'
;
import
{
useMemo
,
useState
}
from
'
react
'
;
import
{
useMemo
,
useState
}
from
'
react
'
;
import
{
useLoggedInUser
}
from
'
../../hooks/useLoggedInUser
'
;
import
{
useLoggedInUser
}
from
'
../../hooks/useLoggedInUser
'
;
...
@@ -15,6 +15,7 @@ type SlideProps = {
...
@@ -15,6 +15,7 @@ type SlideProps = {
isLoggedIn
:
boolean
;
isLoggedIn
:
boolean
;
setAuthModalType
:
SetAuthModalType
;
setAuthModalType
:
SetAuthModalType
;
setIsAuthModalVisible
:
SetIsAuthModalVisible
;
setIsAuthModalVisible
:
SetIsAuthModalVisible
;
text
:
string
;
imagePath
:
string
;
imagePath
:
string
;
};
};
...
@@ -22,10 +23,11 @@ const Slide = ({
...
@@ -22,10 +23,11 @@ const Slide = ({
isLoggedIn
,
isLoggedIn
,
setAuthModalType
,
setAuthModalType
,
setIsAuthModalVisible
,
setIsAuthModalVisible
,
text
,
imagePath
imagePath
}:
SlideProps
)
=>
{
}:
SlideProps
)
=>
{
const
containerStyle
=
{
const
containerStyle
=
{
height
:
'
800px
'
,
height
:
'
95vh
'
,
backgroundImage
:
`url("
${
imagePath
}
")`
,
backgroundImage
:
`url("
${
imagePath
}
")`
,
backgroundSize
:
'
cover
'
,
backgroundSize
:
'
cover
'
,
backgroundPosition
:
'
center
'
,
backgroundPosition
:
'
center
'
,
...
@@ -37,7 +39,26 @@ const Slide = ({
...
@@ -37,7 +39,26 @@ const Slide = ({
return
(
return
(
<
div
style
=
{
containerStyle
}
>
<
div
style
=
{
containerStyle
}
>
{
!
isLoggedIn
?
(
{
!
isLoggedIn
?
(
<>
<
div
style
=
{
{
background
:
'
#eeeeee
'
,
padding
:
50
,
display
:
'
flex
'
,
flexDirection
:
'
column
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
}
}
>
<
Typography
style
=
{
{
fontSize
:
65
,
fontWeight
:
'
bold
'
,
textAlign
:
'
center
'
}
}
>
{
text
}
</
Typography
>
<
div
style
=
{
{
display
:
'
flex
'
}
}
>
<
SignInButton
<
SignInButton
setAuthModalType
=
{
setAuthModalType
}
setAuthModalType
=
{
setAuthModalType
}
setIsAuthModalVisible
=
{
setIsAuthModalVisible
}
setIsAuthModalVisible
=
{
setIsAuthModalVisible
}
...
@@ -46,18 +67,19 @@ const Slide = ({
...
@@ -46,18 +67,19 @@ const Slide = ({
setAuthModalType
=
{
setAuthModalType
}
setAuthModalType
=
{
setAuthModalType
}
setIsAuthModalVisible
=
{
setIsAuthModalVisible
}
setIsAuthModalVisible
=
{
setIsAuthModalVisible
}
/>
/>
</>
</
div
>
</
div
>
)
:
null
}
)
:
null
}
</
div
>
</
div
>
);
);
};
};
// replace placeholders with website screenshots
//
TODO:
replace placeholders with website screenshots
const
imagePaths
=
[
const
slideData
=
[
'
/placeholder.png
'
,
{
imagePath
:
'
/placeholder.png
'
,
text
:
'
Fight pokemons
'
},
// TODO: place image from game
'
/placeholder.png
'
,
{
imagePath
:
'
/placeholder.png
'
,
text
:
'
Buy items
'
},
// TODO: place image from store
'
/placeholder.png
'
,
{
imagePath
:
'
/placeholder.png
'
,
text
:
'
Reach the top
'
},
// TODO: place image from leaderboard
'
/placeholder.png
'
{
imagePath
:
'
/placeholder.png
'
,
text
:
'
Know your enemies
'
}
// TODO: place image from encyclopedia
];
];
export
const
HomeCarousel
=
()
=>
{
export
const
HomeCarousel
=
()
=>
{
...
@@ -70,13 +92,14 @@ export const HomeCarousel = () => {
...
@@ -70,13 +92,14 @@ export const HomeCarousel = () => {
return
(
return
(
<>
<>
<
Carousel
autoplay
>
<
Carousel
autoplay
>
{
imagePaths
.
map
((
path
,
idx
)
=>
(
{
slideData
.
map
(({
imagePath
,
text
}
,
idx
)
=>
(
<
Slide
<
Slide
key
=
{
idx
}
key
=
{
idx
}
text
=
{
text
}
setIsAuthModalVisible
=
{
setIsAuthModalVisible
}
setIsAuthModalVisible
=
{
setIsAuthModalVisible
}
setAuthModalType
=
{
setAuthModalType
}
setAuthModalType
=
{
setAuthModalType
}
isLoggedIn
=
{
isLoggedIn
}
isLoggedIn
=
{
isLoggedIn
}
imagePath
=
{
p
ath
}
imagePath
=
{
imageP
ath
}
/>
/>
))
}
))
}
</
Carousel
>
</
Carousel
>
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment