Skip to content
Merged
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
28 changes: 14 additions & 14 deletions frontend/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,23 +176,23 @@ export default function Home() {
>
<TruncatedText text={event.name} />
</button>
<CalendarButton
event={{
title: event.name,
description: event.summary || '',
location: event.suggestedLocation || '',
startDate: event.startDate,
endDate: event.endDate,
url: event.url,
}}
className="text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"
iconClassName="h-4 w-4"
/>
</div>
<div className="flex flex-wrap items-center text-sm text-gray-600 dark:text-gray-400">
<div className="mr-2 flex items-center">
<FontAwesomeIcon icon={faCalendar} className="mr-2 h-4 w-4" />
<span>{formatDateRange(event.startDate, event.endDate)}</span>
<CalendarButton
className="text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"
event={{
title: event.name,
description: event.summary || '',
location: event.suggestedLocation || '',
startDate: event.startDate,
endDate: event.endDate,
url: event.url,
}}
iconClassName="h-4 w-4 mr-1"
label={formatDateRange(event.startDate, event.endDate)}
showLabel
/>
</div>
{event.suggestedLocation && (
<div className="flex flex-1 items-center overflow-hidden">
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/components/CalendarButton.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { faCalendarPlus } from '@fortawesome/free-solid-svg-icons'
import { faCalendar, faCalendarPlus } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { useState } from 'react'
import type { CalendarButtonProps } from 'types/calendar'
import getGoogleCalendarUrl from 'utils/getGoogleCalendarUrl'

export default function CalendarButton(props: Readonly<CalendarButtonProps>) {
const [isHovered, setIsHovered] = useState(false)
const {
event,
className = '',
Expand All @@ -24,8 +26,12 @@ export default function CalendarButton(props: Readonly<CalendarButtonProps>) {
aria-label={ariaLabel}
title={ariaLabel}
className={className}
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
>
{icon || <FontAwesomeIcon icon={faCalendarPlus} className={iconClassName} />}
{icon || (
<FontAwesomeIcon icon={isHovered ? faCalendarPlus : faCalendar} className={iconClassName} />
)}
{showLabel && <span>{label}</span>}
</a>
)
Expand Down