-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
made EventCardDisplay on front page responsive, added hover effect an…
…d other improvments (#770) * finished making eventCardDisplay resposnive and cleaned up last code * removed code smells * removed code smells * removed code smells * removed code smells --------- Co-authored-by: endre2112 <[email protected]>
- Loading branch information
Showing
5 changed files
with
155 additions
and
102 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
@import "../../../styles/variables.css"; | ||
|
||
.cardsContainer { | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
} | ||
|
||
|
||
.card { | ||
display: flex; | ||
width: calc(100%); | ||
box-shadow: var(--box-shadow-1); | ||
position: relative; | ||
|
||
} | ||
|
||
|
||
.card::before { | ||
transition: width ease-in-out 0.1s; | ||
content: ''; | ||
position: absolute; | ||
top: 0; | ||
bottom: 0; | ||
right: 0; | ||
width: 0.2rem; | ||
|
||
background-color: var(--hilfling-color-red); | ||
} | ||
|
||
|
||
.card:hover::before { | ||
width: 0.6rem; | ||
} | ||
|
||
.cardImg { | ||
width: 40%; | ||
box-shadow: var(--box-shadow-1); | ||
aspect-ratio: 4 / 3; | ||
} | ||
|
||
.cardText { | ||
width: fit-content; | ||
gap: 0.2rem; | ||
padding: 0.5rem 1rem; | ||
} | ||
|
||
.cardTextTitle { | ||
font-size: 2rem; | ||
border-bottom: 0.2rem solid var(--hilfling-color-red); | ||
} | ||
|
||
.cardText>* { | ||
min-width: fit-content; | ||
} | ||
|
||
.cardText b { | ||
margin-right: 0.2rem; | ||
} | ||
|
||
@media only screen and (max-width: 600px) { | ||
.card { | ||
border: none; | ||
flex-direction: column; | ||
} | ||
|
||
.cardImg { | ||
width: 100%; | ||
} | ||
|
||
} |
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,61 @@ | ||
import React, { FC } from "react"; | ||
import { Link } from "react-router-dom"; | ||
|
||
import styles from "./EventCards.module.css"; | ||
import { MotiveDto } from "../../../../generated"; | ||
|
||
interface Props { | ||
event: string; | ||
motiveResponse: MotiveDto[]; | ||
} | ||
|
||
const EventCards: FC<Props> = ({ event, motiveResponse }) => { | ||
const motiveEventResponse = motiveResponse | ||
.filter((motiveObject) => { | ||
return motiveObject.eventOwnerDto.name === event; | ||
}) | ||
.sort((a, b) => { | ||
const dateA = new Date(a.dateCreated); | ||
const dateB = new Date(b.dateCreated); | ||
return dateB.getTime() - dateA.getTime(); | ||
}); | ||
|
||
return ( | ||
<div className={styles.cardsContainer}> | ||
{motiveEventResponse.map((motiveObject) => { | ||
const id = motiveObject.motiveId.id || "default"; | ||
return ( | ||
<Link | ||
className={styles.card} | ||
key={`motive-card-${id}`} | ||
to={`/motive/${id}`} | ||
> | ||
<img | ||
className={styles.cardImg} | ||
src="https://www.w3schools.com/css/img_lights.jpg" | ||
alt="img" | ||
/> | ||
|
||
<div className={styles.cardText}> | ||
<div className={styles.cardTextTitle}>{motiveObject.title}</div> | ||
<div> | ||
<b>Date:</b> | ||
{motiveObject.dateCreated.toString()} | ||
</div> | ||
<div> | ||
<b>Location:</b> | ||
{"Blåfjell"} | ||
</div> | ||
<div> | ||
<b>Images:</b> | ||
{"367"} | ||
</div> | ||
</div> | ||
</Link> | ||
); | ||
})} | ||
</div> | ||
); | ||
}; | ||
|
||
export default EventCards; |
13 changes: 12 additions & 1 deletion
13
src/components/Frontpage/EventCardsDisplayer/EventCardsDisplayer.module.css
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 |
---|---|---|
@@ -1,4 +1,15 @@ | ||
|
||
|
||
.container { | ||
background-color: white; | ||
padding: 1.2rem; | ||
padding: 1rem; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
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