Unverified Commit f57a14bc authored by Michal Čaniga's avatar Michal Čaniga
Browse files

Finish layout of home carousel

parent bd4bafd2
import { Typography } from 'antd';
import usePageTitle from '../../hooks/usePageTitle';
import { HomeCarousel } from './HomeCarousel';
......@@ -7,13 +5,7 @@ import { HomeCarousel } from './HomeCarousel';
const Home = () => {
usePageTitle('Home');
return (
<>
<Typography>Add text</Typography>
<HomeCarousel />
<Typography>Add text</Typography>
</>
);
return <HomeCarousel />;
};
export default Home;
import { Carousel } from 'antd';
import { Carousel, Typography } from 'antd';
import { useMemo, useState } from 'react';
import { useLoggedInUser } from '../../hooks/useLoggedInUser';
......@@ -15,6 +15,7 @@ type SlideProps = {
isLoggedIn: boolean;
setAuthModalType: SetAuthModalType;
setIsAuthModalVisible: SetIsAuthModalVisible;
text: string;
imagePath: string;
};
......@@ -22,10 +23,11 @@ const Slide = ({
isLoggedIn,
setAuthModalType,
setIsAuthModalVisible,
text,
imagePath
}: SlideProps) => {
const containerStyle = {
height: '800px',
height: '95vh',
backgroundImage: `url("${imagePath}")`,
backgroundSize: 'cover',
backgroundPosition: 'center',
......@@ -37,27 +39,47 @@ const Slide = ({
return (
<div style={containerStyle}>
{!isLoggedIn ? (
<>
<SignInButton
setAuthModalType={setAuthModalType}
setIsAuthModalVisible={setIsAuthModalVisible}
/>
<SignUpButton
setAuthModalType={setAuthModalType}
setIsAuthModalVisible={setIsAuthModalVisible}
/>
</>
<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
setAuthModalType={setAuthModalType}
setIsAuthModalVisible={setIsAuthModalVisible}
/>
<SignUpButton
setAuthModalType={setAuthModalType}
setIsAuthModalVisible={setIsAuthModalVisible}
/>
</div>
</div>
) : null}
</div>
);
};
// replace placeholders with website screenshots
const imagePaths = [
'/placeholder.png',
'/placeholder.png',
'/placeholder.png',
'/placeholder.png'
// TODO: replace placeholders with website screenshots
const slideData = [
{ imagePath: '/placeholder.png', text: 'Fight pokemons' }, // TODO: place image from game
{ imagePath: '/placeholder.png', text: 'Buy items' }, // TODO: place image from store
{ imagePath: '/placeholder.png', text: 'Reach the top' }, // TODO: place image from leaderboard
{ imagePath: '/placeholder.png', text: 'Know your enemies' } // TODO: place image from encyclopedia
];
export const HomeCarousel = () => {
......@@ -70,13 +92,14 @@ export const HomeCarousel = () => {
return (
<>
<Carousel autoplay>
{imagePaths.map((path, idx) => (
{slideData.map(({ imagePath, text }, idx) => (
<Slide
key={idx}
text={text}
setIsAuthModalVisible={setIsAuthModalVisible}
setAuthModalType={setAuthModalType}
isLoggedIn={isLoggedIn}
imagePath={path}
imagePath={imagePath}
/>
))}
</Carousel>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment