-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54275df
commit 765e801
Showing
7 changed files
with
173 additions
and
78 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,84 @@ | ||
<script lang="ts"> | ||
import { _ } from 'svelte-i18n' | ||
import Icon from '$lib/components/Icon.svelte' | ||
import { formatDate, type GetLocalisationKeysReturn } from '$lib/locale' | ||
import type { Events, EventsTranslations } from '$lib/sdk/types' | ||
import type { DefaultItem } from '@directus/sdk' | ||
export let event: DefaultItem<Events> | ||
export let keys: GetLocalisationKeysReturn<EventsTranslations> | ||
</script> | ||
|
||
<a href={`/events/${event.slug}`}> | ||
<div class="wrapper py-8 flex justify-center items-end"> | ||
<div class="details mono"> | ||
<div><Icon inline name="date" /> {$formatDate(event.date)}</div> | ||
<div><Icon inline name="location" /> {event.location}</div> | ||
<div><Icon inline name="type" /> {$_(`events.types.${event.type}`)}</div> | ||
</div> | ||
<div class="text"> | ||
<h2>{$_(keys.title)}</h2> | ||
</div> | ||
<div class="icon flex"> | ||
<Icon name="arrow_right" /> | ||
</div> | ||
</div> | ||
</a> | ||
|
||
<style> | ||
.wrapper { | ||
box-shadow: 0 var(--line-size) 0 0 currentColor; | ||
transition: var(--transition); | ||
} | ||
a:hover .wrapper { | ||
box-shadow: 0 calc(var(--line-size) * 2) 0 0 currentColor; | ||
transform: translateY(-0.5rem); | ||
} | ||
.details { | ||
width: 16rem; | ||
} | ||
.icon { | ||
font-size: 2rem; | ||
width: 2rem; | ||
} | ||
.text { | ||
padding: 0 1rem; | ||
flex: 1; | ||
} | ||
@media (max-width: 70rem) { | ||
.wrapper { | ||
padding-left: 2rem; | ||
padding-right: 2rem; | ||
} | ||
} | ||
@media (max-width: 50rem) { | ||
.wrapper { | ||
flex-direction: column; | ||
align-items: flex-start; | ||
} | ||
.wrapper > div { | ||
margin: 0; | ||
text-align: left; | ||
} | ||
h2 { | ||
margin-left: -0.075em; | ||
margin-top: 0.75rem; | ||
font-size: max(10vw, 2.5rem) !important; | ||
} | ||
.icon { | ||
display: none; | ||
} | ||
.text { | ||
padding: 0; | ||
} | ||
} | ||
h2 { | ||
font-variation-settings: 'wght' 300; | ||
font-size: min(8vw, 6rem); | ||
} | ||
</style> |
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,47 @@ | ||
<script lang="ts"> | ||
import { _ } from 'svelte-i18n' | ||
import Icon from '$lib/components/Icon.svelte' | ||
import { formatDate, type GetLocalisationKeysReturn } from '$lib/locale' | ||
import type { Events, EventsTranslations } from '$lib/sdk/types' | ||
import type { DefaultItem } from '@directus/sdk' | ||
export let event: DefaultItem<Events> | ||
export let keys: GetLocalisationKeysReturn<EventsTranslations> | ||
</script> | ||
|
||
<a href={`/events/${event.slug}`}> | ||
<div class="wrapper flex flex-col justify-center items-center p-4"> | ||
<div class="mono mb-6"> | ||
<div><Icon inline name="date" /> {$formatDate(event.date)}</div> | ||
<div><Icon inline name="location" /> {event.location}</div> | ||
<div><Icon inline name="type" /> {$_(`events.types.${event.type}`)}</div> | ||
</div> | ||
<h2 class="text-center">{$_(keys.title)}</h2> | ||
</div> | ||
</a> | ||
|
||
<style> | ||
.wrapper { | ||
transition: var(--transition); | ||
border: var(--line-size) solid currentColor; | ||
} | ||
a:hover .wrapper { | ||
transform: translateY(-0.5rem); | ||
border-width: calc(var(--line-size) * 2); | ||
/* box-shadow: 0 calc(var(--line-size) * 2) 0 0 currentColor; */ | ||
} | ||
@media (max-width: 50rem) { | ||
h2 { | ||
margin-left: -0.075em; | ||
margin-top: 0.75rem; | ||
font-size: max(10vw, 2.5rem) !important; | ||
} | ||
} | ||
h2 { | ||
font-variation-settings: 'wght' 300; | ||
font-size: min(8vw, 6rem); | ||
padding-bottom: 0.2em; | ||
} | ||
</style> |
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
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,29 @@ | ||
import { getLocalisationKeys } from '$lib/locale' | ||
import { SDK } from '$lib/sdk' | ||
import { error } from '@sveltejs/kit' | ||
import type { PageLoad } from './[slug]/$types' | ||
|
||
export const load: PageLoad = async () => { | ||
const eventsResponse = await SDK.items('events').readByQuery({ | ||
limit: 1, | ||
filter: { status: 'published', date: { _gt: new Date() } }, | ||
sort: ['date'], | ||
// @ts-ignore | ||
fields: '*.*', | ||
}) | ||
|
||
if (!eventsResponse.data) throw error(500) | ||
|
||
const event = eventsResponse.data[0] | ||
if (!event) | ||
return { | ||
upcoming: null, | ||
} | ||
|
||
if (typeof event.translations === 'string') throw error(500) | ||
const keys = getLocalisationKeys(event.slug, event.translations) | ||
|
||
return { | ||
upcoming: { event, keys }, | ||
} | ||
} |
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