Skip to content

Commit

Permalink
Merge pull request #6 from pes-alcoding-club/calendar
Browse files Browse the repository at this point in the history
Added carousel and calendar
  • Loading branch information
prithvianilk authored Jan 30, 2021
2 parents 0a28adf + 25152eb commit d05b7b3
Show file tree
Hide file tree
Showing 12 changed files with 403 additions and 46 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;
9 changes: 5 additions & 4 deletions components/Floating.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Box, Button, Link, Text } from '@chakra-ui/react';
import { Box, Button, Text } from '@chakra-ui/react';
import React from 'react';
import MediaQuery from 'react-responsive';
import Link from 'next/link';

const Floating = () => {
const ans = '1';
return (
<>
<MediaQuery minDeviceWidth={1224}>
Expand All @@ -13,7 +13,7 @@ const Floating = () => {
boxShadow="lg"
bgColor="#e94560"
style={{
opacity: ans,
opacity: 1,
position: 'fixed',
bottom: '30px',
right: '30px',
Expand All @@ -23,7 +23,7 @@ const Floating = () => {
</Button>
</MediaQuery>
<MediaQuery maxDeviceWidth={1224}>
<Link>
<Link href="/register">
<Box
_hover={{
color: 'whitesmoke',
Expand All @@ -35,6 +35,7 @@ const Floating = () => {
bottom: '0',
width: '100%',
height: '80px',
zIndex: 100,
position: 'fixed',
}}
>
Expand Down
4 changes: 2 additions & 2 deletions components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import MediaQuery from 'react-responsive';

const Footer = () => {
return (
<>
<div style={{bottom:0}}>
<MediaQuery minDeviceWidth={1224}>
<footer
style={{
Expand Down Expand Up @@ -159,7 +159,7 @@ const Footer = () => {
</div>
</footer>
</MediaQuery>
</>
</div>
);
};
export default Footer;
52 changes: 32 additions & 20 deletions components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import React from 'react';
import MediaQuery from 'react-responsive';
import Logo from '../assets/Logo.svg';
import Nav from './Nav';
import Link from 'next/link';

const Header = () => {
return (
<>
<div>
<MediaQuery minDeviceWidth={1224}>
<div
style={{
Expand Down Expand Up @@ -34,15 +35,20 @@ const Header = () => {
>
The Alcoding Club
</Heading>
<Button
size="lg"
_hover={{ bg: '#0f3460', textColor: 'whitesmoke' }}
bgColor="#e94560"
style={{ margin: '30px auto 90px', display: 'block' }}
>
Apply To Our Monthly Challenge
</Button>
<Nav />
<Link href="/register">
<Button
size="lg"
_hover={{ bg: '#0f3460', textColor: 'whitesmoke' }}
bgColor="#e94560"
style={{
margin: '30px auto 90px',
display: 'block',
}}
>
Apply To Our Monthly Challenge
</Button>
</Link>
<Nav l1="Calendar" l2="Editorial" l3="Contact Us" />
<Divider />
</div>
</MediaQuery>
Expand Down Expand Up @@ -75,19 +81,25 @@ const Header = () => {
>
The Alcoding Club
</Heading>
<Button
size="lg"
_hover={{ bg: '#0f3460', textColor: 'whitesmoke' }}
bgColor="#e94560"
style={{ margin: '30px auto 90px', display: 'block' }}
>
Apply To Our Monthly Challenge
</Button>
<Nav />
<Link href="/register">
<Button
size="lg"
_hover={{ bg: '#0f3460', textColor: 'whitesmoke' }}
bgColor="#e94560"
style={{
margin: '30px auto 90px',
display: 'block',
}}
href="/about"
>
Apply To Our Monthly Challenge
</Button>
</Link>
<Nav l1="Calendar" l2="Editorials" l3="Contact Us" />
<Divider />
</div>
</MediaQuery>
</>
</div>
);
};
export default Header;
35 changes: 23 additions & 12 deletions components/Nav.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import { Link } from '@chakra-ui/react';
import React from 'react';
import { Link as L } from '@chakra-ui/react';
import React, { FC } from 'react';
import Link from 'next/link';

const Nav = () => {
interface props {
l1: String;
l2: String;
l3: String;
}

const Nav: FC<props> = ({ l1, l2, l3 }) => {
var lr = l2;
if (l2 == 'Home') {
lr = '/';
}
return (
<div
style={{
Expand All @@ -11,27 +22,27 @@ const Nav = () => {
justifyContent: 'space-around',
}}
>
<Link
<L
_hover={{ color: '#e94560' }}
color="whitesmoke"
style={{ fontSize: '20px', fontWeight: 'bold' }}
>
Register
</Link>
<Link
<Link href={l1.toLowerCase()}>{l1}</Link>
</L>
<L
_hover={{ color: '#e94560' }}
color="whitesmoke"
style={{ fontSize: '20px', fontWeight: 'bold' }}
>
Editorials
</Link>
<Link
<Link href={lr.toLowerCase()}>{l2}</Link>
</L>
<L
_hover={{ color: '#e94560' }}
color="whitesmoke"
style={{ fontSize: '20px', fontWeight: 'bold' }}
>
Contact Us
</Link>
<Link href={l3=="Contact Us"?"contactus":l3.toLowerCase()}>{l3}</Link>
</L>
</div>
);
};
Expand Down
Loading

1 comment on commit d05b7b3

@vercel
Copy link

@vercel vercel bot commented on d05b7b3 Jan 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.