Skip to content

Commit

Permalink
Added Carousel and Calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
VarunMK committed Jan 30, 2021
2 parents 3b39c37 + 5cfeceb commit 25152eb
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 27 deletions.
129 changes: 129 additions & 0 deletions components/Carousel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import { Box, Image } from '@chakra-ui/react';
import React, { useState } from 'react';
import { FaArrowCircleRight, FaArrowCircleLeft } from 'react-icons/fa';
import MediaQuery from 'react-responsive';
// help from: https://www.youtube.com/watch?v=l1MYfu5YWHc :)

const images = [
'https://lh3.googleusercontent.com/pw/ACtC-3eAOr_3m8nkwHFxUGVCocpqAsfRXF9iBmFBJ9Vsu6cUNNBf1KblJizIy-ouzALEPFiO3cPxHnBdcnGmWSzupTLDEdmjrjyTsEiG9OnGPSL_Oq8VED1IQ3Wn3MSpokTIJXZANbbmcmg3Loq_rv-YK_8jJQ=w1258-h944-no?authuser=0',
'https://lh3.googleusercontent.com/pw/ACtC-3eRo1AoiFwa2Ae5_SHXdEWVHcCEOIELaImOC832EgsRSCjUmjfXXEPd9QMvYfiHfCW9yJhZWFc_Zj0pwBMcBf4MeqOEV-QwLYD8CTOjzWudM8BcO1Zj-cnOtQGdliJ8ggUliYJcorb-tbWrOGob4eXCAA=w1258-h944-no?authuser=0',
'https://lh3.googleusercontent.com/pw/ACtC-3cnkp2xlwwIbF8sYZ4U3ODlOg4MHlX4UNA2ZhM8XQ01IYLkT5ig7VmCMyHoJHz2-cBehp4_7kwn7jK7d5ruXbLUeLiqtHjuglkXUX4j8bll4x0AjNzZg9424ep6VQqEgCh9TOUdhc3qGgEoAmMt_PFLzg=w1258-h944-no?authuser=0',
];

const Carousel = () => {
const [current, setCurrent] = useState<number>(0);
const increment = () => setCurrent((current + 1) % images.length);
const decrement = () => {
setCurrent(current !== 0 ? current - 1 : images.length - 1);
};
return (
<>
<MediaQuery minDeviceWidth={1224}>
<Box
my="10"
w="100%"
display="flex"
justifyContent="center"
userSelect="none"
position="relative"
>
<FaArrowCircleLeft
cursor="pointer"
size="35"
style={{
position: 'absolute',
top: '50%',
left: '20%',
zIndex: 10,
}}
onClick={decrement}
/>
{images.map((src, key) => (
<Box
position="relative"
zIndex="1"
key={key}
opacity={key === current ? '1' : '0'}
transitionDuration={
key === current ? '1s' : '1s ease'
}
transform={`scale(${
key === current ? '1.08' : '1'
})`}
>
{key === current && (
<Image w="600px" h="400px" src={src} />
)}
</Box>
))}
<FaArrowCircleRight
z="10"
cursor="pointer"
size="35"
style={{
position: 'absolute',
top: '50%',
right: '20%',
zIndex: 10,
}}
onClick={increment}
/>
</Box>
</MediaQuery>
<MediaQuery maxDeviceWidth={1224}>
<Box
my="10"
w="140%"
display="flex"
justifyContent="center"
userSelect="none"
position="relative"
>
<FaArrowCircleLeft
cursor="pointer"
size="35"
style={{
position: 'absolute',
top: '50%',
left: '10%',
zIndex: 10,
}}
onClick={decrement}
/>
{images.map((src, key) => (
<Box
position="relative"
zIndex="1"
key={key}
opacity={key === current ? '1' : '0'}
transitionDuration={
key === current ? '1s' : '1s ease'
}
transform={`scale(${
key === current ? '1.08' : '1'
})`}
>
{key === current && (
<Image w="328px" h="216px" src={src} />
)}
</Box>
))}
<FaArrowCircleRight
z="10"
cursor="pointer"
size="35"
style={{
position: 'absolute',
top: '50%',
right: '10%',
zIndex: 10,
}}
onClick={increment}
/>
</Box>
</MediaQuery>
</>
);
};

export default Carousel;
32 changes: 15 additions & 17 deletions components/Floating.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,23 @@ import MediaQuery from 'react-responsive';
import Link from 'next/link';

const Floating = () => {
const ans = '1';
return (
<>
<MediaQuery minDeviceWidth={1224}>
<Link href="/register">
<Button
size="lg"
_hover={{ textColor: 'whitesmoke' }}
boxShadow="lg"
bgColor="#e94560"
style={{
opacity: ans,
position: 'fixed',
bottom: '30px',
right: '30px',
}}
>
Apply Now
</Button>
</Link>
<Button
size="lg"
_hover={{ textColor: 'whitesmoke' }}
boxShadow="lg"
bgColor="#e94560"
style={{
opacity: 1,
position: 'fixed',
bottom: '30px',
right: '30px',
}}
>
Apply Now
</Button>
</MediaQuery>
<MediaQuery maxDeviceWidth={1224}>
<Link href="/register">
Expand All @@ -38,6 +35,7 @@ const Floating = () => {
bottom: '0',
width: '100%',
height: '80px',
zIndex: 100,
position: 'fixed',
}}
>
Expand Down
6 changes: 3 additions & 3 deletions components/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ const Nav: FC<props> = ({ l1, l2, l3 }) => {
color="whitesmoke"
style={{ fontSize: '20px', fontWeight: 'bold' }}
>
<Link href={String(l1)}>{l1}</Link>
<Link href={l1.toLowerCase()}>{l1}</Link>
</L>
<L
_hover={{ color: '#e94560' }}
color="whitesmoke"
style={{ fontSize: '20px', fontWeight: 'bold' }}
>
<Link href={String(lr)}>{l2}</Link>
<Link href={lr.toLowerCase()}>{l2}</Link>
</L>
<L
_hover={{ color: '#e94560' }}
color="whitesmoke"
style={{ fontSize: '20px', fontWeight: 'bold' }}
>
<Link href={String(l2)}>{l3}</Link>
<Link href={l3=="Contact Us"?"contactus":l3.toLowerCase()}>{l3}</Link>
</L>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions pages/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import MediaQuery from 'react-responsive';

const Calendar = () => {
return (
<ChakraProvider>
<>
<Head>
<title>Calendar</title>
</Head>
Expand Down Expand Up @@ -105,7 +105,7 @@ const Calendar = () => {
</div>
<Footer />
</MediaQuery>
</ChakraProvider>
</>
);
};

Expand Down
6 changes: 4 additions & 2 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { ChakraProvider } from '@chakra-ui/react';
import { AppProps } from 'next/app';
import '../styles/app.css';

function MyApp({ Component, pageProps }) {
function MyApp({ Component, pageProps }: AppProps) {
return (
<ChakraProvider>
<ChakraProvider resetCSS>
<Component {...pageProps} />
</ChakraProvider>
);
Expand Down
17 changes: 17 additions & 0 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import NextDocument, { Html, Head, Main, NextScript } from 'next/document'
import { ColorModeScript } from '@chakra-ui/react'

export default class Document extends NextDocument {
render() {
return (
<Html>
<Head />
<body>
<ColorModeScript />
<Main />
<NextScript />
</body>
</Html>
)
}
}
8 changes: 5 additions & 3 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import { ChakraProvider } from '@chakra-ui/react';
import { Box, ChakraProvider } from '@chakra-ui/react';
import React from 'react';
import AboutUs from '../components/AboutUs';
import Floating from '../components/Floating';
import Footer from '../components/Footer';
import Header from '../components/Header';
import Head from 'next/head';
import Carousel from '../components/Carousel';

const Landing = () => {
return (
<ChakraProvider>
<>
<Head>
<title>The Alcoding Club</title>
</Head>
<Header />
<AboutUs />
<Carousel />
<Footer />
<Floating />
</ChakraProvider>
</>
);
};

Expand Down
7 changes: 7 additions & 0 deletions styles/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
html {
width: 100%;
}

body {
width: 100%;
}

0 comments on commit 25152eb

Please sign in to comment.