This commit is contained in:
Chris Kruining 2025-05-18 18:12:42 +02:00
parent 873677ea04
commit d683b051b6
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
17 changed files with 244 additions and 273 deletions

View file

@ -1,17 +1,38 @@
import { Index } from "solid-js";
import { Entry } from "~/features/content";
import { Component, createEffect, createMemo, For, Index } from "solid-js";
import { createSlug, Entry } from "~/features/content";
import css from "./hero.module.css";
type HeroProps = {
entry: Entry;
entries: Entry[];
class?: string;
};
export function Hero(props: HeroProps) {
const entry = createMemo(() => props.entries.at(0)!);
const slug = createMemo(() => createSlug(entry()));
return (
<div class={`${css.container} ${props.class ?? ''}`}>
<For each={props.entries}>{
entry => <Page entry={entry} />
}</For>
</div>
);
}
const Page: Component<{ entry: Entry }> = (props) => {
const slug = createMemo(() => createSlug(props.entry));
createEffect(() => {
console.log(props.entry);
});
return (
<div class={`${css.page}`} style={{ '--thumb-image': `url(${props.entry.thumbnail})` }}>
<h2 class={css.title}>{props.entry.title}</h2>
<a class={css.cta} href={`/watch/${slug()}`}>Continue</a>
<img src={props.entry.thumbnail} class={css.thumbnail} />
<img src={props.entry.image} class={css.background} />
@ -31,7 +52,7 @@ export function Hero(props: HeroProps) {
</Index>
</span>
<p class={css.summary}>{props.entry.summary}</p>
<p class={css.summary}>{props.entry.synopsis}</p>
</div>
);
}
};