Start rearranging and simplifying widgets

This commit is contained in:
prototypa
2023-07-27 14:51:46 -04:00
parent b51e3bdebc
commit 15ef9ee3e0
11 changed files with 419 additions and 330 deletions

View File

@ -1,71 +1,43 @@
---
import { Icon } from 'astro-icon/components';
interface Item {
title: string;
description: string;
icon?: string;
}
export interface Props {
title?: string;
subtitle?: string;
highlight?: string;
items: Array<Array<Item>>;
}
import WidgetWrapper from "~/components/ui/WidgetWrapper.astro";
import ItemGrid from "~/components/ui/ItemGrid.astro";
import Headline from "~/components/ui/Headline.astro";
import type { Features } from "~/types";
const {
title = await Astro.slots.render('title'),
subtitle = await Astro.slots.render('subtitle'),
highlight,
title = await Astro.slots.render("title"),
subtitle = await Astro.slots.render("subtitle"),
tagline = await Astro.slots.render("tagline"),
items = [],
} = Astro.props;
columns = 2,
id,
isDark = false,
classes = {},
bg = await Astro.slots.render("bg"),
} = Astro.props as Features;
---
<section class="scroll-mt-16 not-prose" id="features">
<div class="px-4 py-16 mx-auto max-w-6xl lg:px-8 lg:py-20">
{
(title || subtitle || highlight) && (
<div class="mb-10 md:mx-auto text-center md:mb-12 max-w-3xl">
{highlight && (
<p
class="text-base text-primary dark:text-blue-200 font-semibold tracking-wide uppercase"
set:html={highlight}
/>
)}
{title && (
<h2
class="text-4xl md:text-5xl font-bold leading-tighter tracking-tighter mb-4 font-heading"
set:html={title}
/>
)}
{subtitle && (
<p class="max-w-3xl mx-auto sm:text-center text-xl text-muted dark:text-slate-400" set:html={subtitle} />
)}
</div>
)
}
<div class="grid mx-auto space-y-6 md:grid-cols-2 md:space-y-0">
{
items.map((subitems) => (
<div class="space-y-8 sm:px-8">
{subitems.map(({ title, description, icon }) => (
<div class="flex flex-row max-w-md">
<div class="mb-4 mr-4">
<div class="flex items-center justify-center w-12 h-12 rounded-full bg-primary dark:bg-blue-700">
{icon && <Icon name={icon} class="w-6 h-6 text-white icon-light" />}
</div>
</div>
<div>
<h3 class="mb-3 text-xl font-bold">{title}</h3>
<p class="text-muted dark:text-slate-400" set:html={description} />
</div>
</div>
))}
</div>
))
}
</div>
</div>
</section>
<WidgetWrapper
id={id}
isDark={isDark}
containerClass={`max-w-5xl ${classes?.container ?? ""}`}
bg={bg}
>
<Headline
title={title}
subtitle={subtitle}
tagline={tagline}
classes={classes?.headline}
/>
<ItemGrid
items={items}
columns={columns}
classes={{
container: "",
title: "md:text-[1.3rem]",
icon: "text-white bg-primary rounded-full w-10 h-10 p-2 md:w-12 md:h-12 md:p-3 mr-4 rtl:ml-4 rtl:mr-0",
...((classes?.items as {}) ?? {}),
}}
/>
</WidgetWrapper>