diff --git a/components/Button.tsx b/components/Button.tsx new file mode 100644 index 0000000..28d4ad6 --- /dev/null +++ b/components/Button.tsx @@ -0,0 +1,31 @@ +import { ComponentChildren, JSX } from "preact"; + +type ButtonProps = { + children: ComponentChildren; +} & JSX.HTMLAttributes; + +const className = "p-2 border(gray-100 2) hover:bg-gray-200 bg-blue-200 w-max font-medium"; + +export function Button(props: ButtonProps) { + const { children, className: additionalClass = "", ...buttonProps } = props; + + return ( + + ); +} + +type AnchorProps = { + children: ComponentChildren; +} & JSX.HTMLAttributes; + +export function ButtonLink(props: AnchorProps) { + const { children, className: additionalClass = "", ...linkProps } = props; + + return ( + + {children} + + ); +} diff --git a/components/SeriesCard.tsx b/components/SeriesCard.tsx index 34e7bdf..ea45fbc 100644 --- a/components/SeriesCard.tsx +++ b/components/SeriesCard.tsx @@ -1,5 +1,6 @@ import CopyButton from "../islands/CopyButton.tsx"; import { SearchResult } from "../lib/nrk/nrk.ts"; +import { ButtonLink } from "./Button.tsx"; export default function SeriesCard(props: { serie: SearchResult; origin: string }) { const feedUrl = new URL(`/api/feeds/${props.serie.seriesId}`, props.origin); @@ -10,12 +11,9 @@ export default function SeriesCard(props: { serie: SearchResult; origin: string

{props.serie.title}

{props.serie.description}

- + 📻 Åpne i din podkast-app - +
{feedUrl.toString()} diff --git a/islands/CopyButton.tsx b/islands/CopyButton.tsx index 759c2ef..8ad976c 100644 --- a/islands/CopyButton.tsx +++ b/islands/CopyButton.tsx @@ -1,14 +1,16 @@ -import Preact from "preact"; +import { ComponentChildren, JSX } from "preact"; import { useState } from "preact/hooks"; import { IS_BROWSER } from "$fresh/runtime.ts"; +import { Button } from "../components/Button.tsx"; type Props = { - text: string; - children: Preact.ComponentChildren; + copyText: string; + children: ComponentChildren; disabled?: boolean; -}; +} & JSX.HTMLAttributes; -export default function CopyButton({ text, disabled = false, children }: Props) { +export default function CopyButton(props: Props) { + const { copyText, disabled = false, children, ...buttonProps } = props; const [clicked, setClicked] = useState(false); const startReset = () => { @@ -18,16 +20,16 @@ export default function CopyButton({ text, disabled = false, children }: Props) }; return ( - + ); }