Skip to content

Commit 4a48cea

Browse files
committed
Remove unnecessary components from widgets that cause confusion.
1 parent 0fd80aa commit 4a48cea

14 files changed

Lines changed: 221 additions & 283 deletions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Expose Astro dependencies for `pnpm` users
2-
shamefully-hoist=true
2+
shamefully-hoist=true

package-lock.json

Lines changed: 2 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/ui/Background.astro

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/components/ui/DListItem.astro

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/components/ui/ItemGrid.astro

Lines changed: 0 additions & 65 deletions
This file was deleted.

src/components/ui/ItemGrid2.astro

Lines changed: 0 additions & 59 deletions
This file was deleted.

src/components/ui/WidgetWrapper.astro

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import type { HTMLTag } from 'astro/types';
33
import type { Widget } from '~/types';
44
import { twMerge } from 'tailwind-merge';
5-
import Background from './Background.astro';
65
76
export interface Props extends Widget {
87
containerClass?: string;
@@ -17,7 +16,13 @@ const WrapperTag = as;
1716
<WrapperTag class="relative not-prose scroll-mt-[72px]" {...id ? { id } : {}}>
1817
<div class="absolute inset-0 pointer-events-none -z-[1]" aria-hidden="true">
1918
<slot name="bg">
20-
{bg ? <Fragment set:html={bg} /> : <Background isDark={isDark} />}
19+
{
20+
bg ? (
21+
<Fragment set:html={bg} />
22+
) : (
23+
<div class:list={['absolute inset-0', { 'bg-dark dark:bg-transparent': isDark }]} />
24+
)
25+
}
2126
</slot>
2227
</div>
2328
<div

src/components/widgets/Content.astro

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
import type { Content as Props } from '~/types';
2+
import { Icon } from 'astro-icon/components';
3+
import Button from '~/components/ui/Button.astro';
34
import Headline from '~/components/ui/Headline.astro';
45
import WidgetWrapper from '~/components/ui/WidgetWrapper.astro';
56
import Image from '~/components/common/Image.astro';
6-
import Button from '~/components/ui/Button.astro';
7-
import ItemGrid from '~/components/ui/ItemGrid.astro';
7+
import type { Content as Props } from '~/types';
88
99
const {
1010
title = await Astro.slots.render('title'),
@@ -23,6 +23,15 @@ const {
2323
classes = {},
2424
bg = await Astro.slots.render('bg'),
2525
} = Astro.props;
26+
27+
const columnsClass =
28+
columns === 4
29+
? 'lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2'
30+
: columns === 3
31+
? 'lg:grid-cols-3 sm:grid-cols-2'
32+
: columns === 2
33+
? 'sm:grid-cols-2'
34+
: '';
2635
---
2736

2837
<WidgetWrapper
@@ -54,19 +63,47 @@ const {
5463
)
5564
}
5665

57-
<ItemGrid
58-
items={items}
59-
columns={columns}
60-
defaultIcon="tabler:check"
61-
classes={{
62-
container: `gap-y-4 md:gap-y-8`,
63-
panel: 'max-w-none',
64-
title: 'text-lg font-medium leading-6 dark:text-white ml-2 rtl:ml-0 rtl:mr-2',
65-
description: 'text-muted dark:text-slate-400 ml-2 rtl:ml-0 rtl:mr-2',
66-
icon: 'flex h-7 w-7 items-center justify-center rounded-full bg-green-600 dark:bg-green-700 text-gray-50 p-1',
67-
action: 'text-lg font-medium leading-6 dark:text-white ml-2 rtl:ml-0 rtl:mr-2',
68-
}}
69-
/>
66+
{
67+
items.length > 0 && (
68+
<div class:list={['grid mx-auto gap-y-4 md:gap-y-8 gap-8', columnsClass]}>
69+
{items.map(({ title: itemTitle, description, icon, callToAction }) => (
70+
<div class="intersect-once motion-safe:md:opacity-0 motion-safe:md:intersect:animate-fade">
71+
<div class="flex flex-row max-w-none">
72+
<div class="flex justify-center">
73+
<Icon
74+
name={icon || 'tabler:check'}
75+
class="flex h-7 w-7 items-center justify-center rounded-full bg-green-600 dark:bg-green-700 text-gray-50 p-1 mr-2 rtl:mr-0 rtl:ml-2"
76+
/>
77+
</div>
78+
<div class="mt-0.5">
79+
{itemTitle && (
80+
<h3 class="text-lg font-medium leading-6 dark:text-white ml-2 rtl:ml-0 rtl:mr-2">
81+
{itemTitle}
82+
</h3>
83+
)}
84+
{description && (
85+
<p
86+
class:list={[{ 'mt-3': itemTitle }, 'text-muted dark:text-slate-400 ml-2 rtl:ml-0 rtl:mr-2']}
87+
set:html={description}
88+
/>
89+
)}
90+
{callToAction && (
91+
<div
92+
class:list={[
93+
{ 'mt-3': itemTitle || description },
94+
'text-lg font-medium leading-6 dark:text-white ml-2 rtl:ml-0 rtl:mr-2',
95+
]}
96+
>
97+
<Button variant="link" {...callToAction} />
98+
</div>
99+
)}
100+
</div>
101+
</div>
102+
</div>
103+
))}
104+
</div>
105+
)
106+
}
70107
</div>
71108
<div aria-hidden="true" class="mt-10 md:mt-0 md:basis-1/2">
72109
{

0 commit comments

Comments
 (0)