Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hover animation to eventList #4996

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions app/components/EventItem/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Flex, Icon, Image } from '@webkom/lego-bricks';
import { Button, Flex, Icon, Image, LinkButton } from '@webkom/lego-bricks';
import cx from 'classnames';
import {
AlarmClock,
Calendar,
Expand All @@ -18,6 +19,7 @@ import { eventAttendanceAbsolute } from 'app/utils/eventStatus';
import styles from './styles.css';
import type { ListEvent } from 'app/store/models/Event';
import type { ReactNode } from 'react';
import { useState } from 'react';

export type EventStyle = 'default' | 'extra-compact' | 'compact';

Expand Down Expand Up @@ -127,6 +129,7 @@ const EventItem = ({
showTags = true,
eventStyle,
}: EventItemProps): ReactNode => {
const [hover, setHover] = useState(false);
switch (eventStyle) {
case 'extra-compact':
return (
Expand Down Expand Up @@ -201,17 +204,18 @@ const EventItem = ({
case 'default':
default:
return (
<div
<Link
to={`/events/${event.slug}`}
onMouseEnter={() => setHover(true)}
onMouseLeave={() => setHover(false)}
style={{
borderColor: colorForEventType(event.eventType),
}}
className={styles.eventItem}
className={cx(styles.eventItem, hover && styles.eventItemHover)}
>
<div>
<Link to={`/events/${event.slug}`}>
<h3 className={styles.eventItemTitle}>{event.title}</h3>
{event.totalCapacity > 0 && <Attendance event={event} />}
</Link>
<h3 className={styles.eventItemTitle}>{event.title}</h3>
{event.totalCapacity > 0 && <Attendance event={event} />}
<TimeStartAndRegistration event={event} />
{showTags && (
<Flex wrap>
Expand All @@ -222,7 +226,9 @@ const EventItem = ({
)}
</div>

<Flex className={styles.companyLogo}>
<Flex
className={cx(styles.companyLogo, hover && styles.companyLogoHover)}
>
{event.cover && (
<Image
alt="Forsidebilde"
Expand All @@ -231,7 +237,7 @@ const EventItem = ({
/>
)}
</Flex>
</div>
</Link>
);
}
};
Expand Down
13 changes: 13 additions & 0 deletions app/components/EventItem/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
display: flex;
justify-content: space-between;
line-height: 1.3;
transition: var(--easing-fast);
}

.eventItemHover {
background-color: var(--additive-background);
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}

.eventItemCompact {
Expand Down Expand Up @@ -48,6 +55,12 @@
max-height: 80px;
object-fit: contain;
background: white;
margin: 5px 10px 5px 0;
transition: var(--easing-fast);
}

.companyLogoHover img {
border-radius: 10px;
}

.companyLogoCompact img {
Expand Down
Loading