-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add event card * feat: integrate real event * fix: add dummy event * fix: Update styles.js * fix: Update playground.js * fix: Update Card.jsx * fix: prettier issues * fix: Update Card.jsx * fix:minor changes * fix:minor changes --------- Co-authored-by: Ashish Padhy <100484401+Shurtu-gal@users.noreply.github.com>
- Loading branch information
1 parent
353d54d
commit 0f0f846
Showing
10 changed files
with
297 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* eslint-disable max-len */ | ||
import React, { useState } from 'react'; | ||
import { | ||
Back, | ||
BackDescription, | ||
Card, | ||
CardButtonContainer, | ||
CardContainer, | ||
CardImage, | ||
CardTextContainer, | ||
CardTitleContainer, | ||
Circle, | ||
EventClub, | ||
EventName, | ||
EventRegisterButton, | ||
EventTimeVenue, | ||
Front, | ||
KnowButton, | ||
} from './styles'; | ||
import { Body2 } from '../shared'; | ||
|
||
const CardComponent = ({ | ||
title, | ||
club, | ||
venue, | ||
time, | ||
date, | ||
month, | ||
prizes, | ||
description, | ||
contact, | ||
poster, | ||
}) => { | ||
const [isFlipped, setIsFlipped] = useState(false); | ||
|
||
const flipCard = () => { | ||
setIsFlipped(!isFlipped); | ||
}; | ||
|
||
const bringToFront = () => { | ||
setIsFlipped(false); | ||
}; | ||
|
||
return ( | ||
<CardContainer> | ||
<Card style={{ transform: isFlipped ? 'rotateY(180deg)' : 'rotateY(0)' }}> | ||
<Front> | ||
<CardImage src={poster} alt={club} /> | ||
<CardTextContainer> | ||
<CardTitleContainer> | ||
<EventTimeVenue> | ||
{date} {month} | ||
<Circle /> | ||
{time} | ||
<Circle /> | ||
{venue} | ||
</EventTimeVenue> | ||
</CardTitleContainer> | ||
<CardTitleContainer> | ||
<EventName>{title}</EventName> | ||
<EventClub>{club}</EventClub> | ||
</CardTitleContainer> | ||
</CardTextContainer> | ||
<CardButtonContainer> | ||
<KnowButton text='Know More' onClick={flipCard} /> | ||
<EventRegisterButton variant='outline' text='Register For Event' /> | ||
</CardButtonContainer> | ||
</Front> | ||
<Back> | ||
<CardTitleContainer> | ||
<EventName style={{ marginTop: 0 }}>{title}</EventName> | ||
<EventClub>{club}</EventClub> | ||
</CardTitleContainer> | ||
<CardTitleContainer style={{ paddingTop: '1.2rem' }}> | ||
Prize - {prizes} | ||
<EventTimeVenue style={{ paddingTop: '0.1rem' }}> | ||
{date} {month} | ||
<Circle /> | ||
{venue} | ||
</EventTimeVenue> | ||
</CardTitleContainer> | ||
<BackDescription>{description}</BackDescription> | ||
<Body2>Contact: {contact?.join(', ')}</Body2> | ||
<CardButtonContainer> | ||
<KnowButton text='Back' onClick={bringToFront} /> | ||
<EventRegisterButton variant='outline' text='Register For Event' /> | ||
</CardButtonContainer> | ||
</Back> | ||
</Card> | ||
</CardContainer> | ||
); | ||
}; | ||
|
||
export default CardComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
import styled from 'styled-components'; | ||
import tw from 'twin.macro'; | ||
import { Heading4, Body2, CaptionText } from '../shared'; | ||
import Button from '../shared/Button'; | ||
|
||
export const CardImage = styled.img` | ||
${tw` | ||
rounded-lg | ||
`}; | ||
width: 21.25rem; | ||
aspect-ratio: 1/1; | ||
object-fit: cover; | ||
@media (max-width: 768px) { | ||
width: 16.25; | ||
} | ||
`; | ||
|
||
export const CardTextContainer = styled.div` | ||
${tw` | ||
mt-4 | ||
md:mt-3 | ||
`} | ||
`; | ||
|
||
export const CardTitleContainer = styled.div` | ||
${tw` | ||
flex-col | ||
items-center | ||
justify-between | ||
`} | ||
`; | ||
|
||
export const EventTimeVenue = styled(Body2)` | ||
${tw` flex items-center`} | ||
`; | ||
|
||
export const Circle = styled.div` | ||
${tw` | ||
w-[5px] | ||
h-[5px] | ||
mx-2 | ||
inline-block | ||
bg-color-secondary | ||
rounded-full | ||
`} | ||
`; | ||
export const EventName = styled(Heading4)` | ||
text-transform: none; | ||
${tw` | ||
mt-4 | ||
truncate | ||
`} | ||
.dot { | ||
width: 50px; | ||
height: 50px; | ||
border-radius: 50%; | ||
} | ||
`; | ||
|
||
export const EventClub = styled(CaptionText)` | ||
${tw``} | ||
`; | ||
|
||
export const CardButtonContainer = styled.div` | ||
${tw` | ||
flex | ||
mt-4 | ||
justify-between | ||
`}; | ||
`; | ||
|
||
export const KnowButton = styled(Button)` | ||
${tw` | ||
px-0 | ||
py-1.5 | ||
`} | ||
`; | ||
|
||
export const EventRegisterButton = styled(Button)` | ||
${tw` | ||
px-4 | ||
py-1.5 | ||
`} | ||
`; | ||
export const CardContainer = styled.div` | ||
margin: auto; | ||
width: 380px; | ||
max-width: 400px; | ||
`; | ||
|
||
export const Card = styled.div` | ||
width: min-content; | ||
position: relative; | ||
transform-style: preserve-3d; | ||
transition: transform 0.6s; | ||
`; | ||
|
||
export const Front = styled.div` | ||
position: absolute; | ||
background-color: #2c2c2c; | ||
width: 400px; | ||
max-width: 328px; | ||
backface-visibility: hidden; | ||
${tw` | ||
h-auto | ||
px-4 | ||
mx-auto | ||
pt-4 | ||
pb-6 | ||
gap-4 | ||
rounded-2xl | ||
text-color-secondary | ||
`}; | ||
`; | ||
|
||
export const Back = styled.div` | ||
width: 400px; | ||
max-width: 328px; | ||
background-color: #2c2c2c; | ||
${tw` | ||
h-auto | ||
px-4 | ||
mx-auto | ||
pt-4 | ||
pb-6 | ||
gap-4 | ||
rounded-2xl | ||
text-color-secondary | ||
`}; | ||
backface-visibility: hidden; | ||
transform: rotateY(180deg); | ||
`; | ||
export const BackDescription = styled(Body2)` | ||
color: #b9b9b9; | ||
display: -webkit-box; | ||
-webkit-line-clamp: 8; | ||
-webkit-box-orient: vertical; | ||
overflow: hidden; | ||
margin: 1rem 0 2rem 0; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import useEvents from '../utils/useEvents'; | ||
|
||
const EventPage = () => { | ||
const { events } = useEvents('Technical'); | ||
console.log(events); | ||
|
||
return ( | ||
<div> | ||
<h1>Events</h1> | ||
</div> | ||
); | ||
}; | ||
|
||
export default EventPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.