|
|
|
@ -1,4 +1,5 @@ |
|
|
|
import { useEffect, useState } from 'preact/hooks' |
|
|
|
import { useEffect, useState } from 'preact/hooks' |
|
|
|
|
|
|
|
import style from './style.js' |
|
|
|
|
|
|
|
|
|
|
|
const endpoint = 'https://kultar.sout.no/events/' |
|
|
|
const endpoint = 'https://kultar.sout.no/events/' |
|
|
|
const fetch_options = {} |
|
|
|
const fetch_options = {} |
|
|
|
@ -75,27 +76,35 @@ function Links({ event_id, ticket_url }) { |
|
|
|
return <Facebook event_id={event_id} /> |
|
|
|
return <Facebook event_id={event_id} /> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function EventImage({ images }) { |
|
|
|
|
|
|
|
const { square = null } = images |
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
|
|
<img style={style.EventImage} src={`https://kultar.sout.no/${square}`} /> |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function EventCard({ event }) { |
|
|
|
function EventCard({ event }) { |
|
|
|
const { name, location, date, ticket_url, event_id } = event |
|
|
|
const { name, location, date, ticket_url, event_id } = event |
|
|
|
const { start: start_date } = date |
|
|
|
const { start: start_date } = date |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div> |
|
|
|
<span style={style.EventCard}> |
|
|
|
<h3>{name}</h3> |
|
|
|
<h3>{name}</h3> |
|
|
|
<Time date={new Date(start_date)} /> |
|
|
|
<Time date={new Date(start_date)} /> |
|
|
|
<Links ticket_url={ticket_url} event_id={event_id} /> |
|
|
|
<Links ticket_url={ticket_url} event_id={event_id} /> |
|
|
|
<Location location={location} /> |
|
|
|
<Location location={location} /> |
|
|
|
</div> |
|
|
|
</span> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function Event({ event, index }) { |
|
|
|
function Event({ event, index }) { |
|
|
|
const isFirstEvent = index === 0 |
|
|
|
const isFirstEvent = index === 0 |
|
|
|
|
|
|
|
const { images } = event |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<div style={style.Event}> |
|
|
|
|
|
|
|
<EventImage images={images} /> |
|
|
|
<EventCard event={event} /> |
|
|
|
<EventCard event={event} /> |
|
|
|
<hr /> |
|
|
|
</div> |
|
|
|
</> |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -117,10 +126,12 @@ export default function Events() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<div style={style.Events}> |
|
|
|
{events.map((event, index) => ( |
|
|
|
{events.map((event, index) => ( |
|
|
|
<Event event={event} index={index} /> |
|
|
|
<> |
|
|
|
|
|
|
|
<Event event={event} index={index} /> |
|
|
|
|
|
|
|
</> |
|
|
|
))} |
|
|
|
))} |
|
|
|
</> |
|
|
|
</div> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|