Include ItemGrid component on Content widget
This commit is contained in:
@ -1,23 +1,18 @@
|
|||||||
---
|
---
|
||||||
import { Icon } from "astro-icon/components";
|
import { twMerge } from 'tailwind-merge';
|
||||||
import { twMerge } from "tailwind-merge";
|
import type { ItemGrid } from '~/types';
|
||||||
import type { ItemGrid } from "~/types";
|
import CTA from './CTA.astro';
|
||||||
import CTA from "./CTA.astro";
|
import { Icon } from 'astro-icon/components';
|
||||||
|
|
||||||
|
const { items = [], columns, defaultIcon = '', classes = {} } = Astro.props as ItemGrid;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
items = [],
|
container: containerClass = '',
|
||||||
columns,
|
panel: panelClass = '',
|
||||||
defaultIcon = "",
|
title: titleClass = '',
|
||||||
classes = {},
|
description: descriptionClass = '',
|
||||||
} = Astro.props as ItemGrid;
|
icon: defaultIconClass = 'text-primary',
|
||||||
|
action: actionClass = '',
|
||||||
const {
|
|
||||||
container: containerClass = "",
|
|
||||||
// container: containerClass = "md:grid-cols-2",
|
|
||||||
panel: panelClass = "",
|
|
||||||
title: titleClass = "",
|
|
||||||
description: descriptionClass = "",
|
|
||||||
icon: defaultIconClass = "text-primary",
|
|
||||||
} = classes;
|
} = classes;
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -27,74 +22,50 @@ const {
|
|||||||
class={twMerge(
|
class={twMerge(
|
||||||
`grid mx-auto gap-8 md:gap-y-12 ${
|
`grid mx-auto gap-8 md:gap-y-12 ${
|
||||||
columns === 4
|
columns === 4
|
||||||
? "lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2"
|
? 'lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2'
|
||||||
: columns === 3
|
: columns === 3
|
||||||
? "lg:grid-cols-3 sm:grid-cols-2"
|
? 'lg:grid-cols-3 sm:grid-cols-2'
|
||||||
: columns === 2
|
: columns === 2
|
||||||
? "sm:grid-cols-2 "
|
? 'sm:grid-cols-2 '
|
||||||
: ""
|
: ''
|
||||||
}`,
|
}`,
|
||||||
containerClass
|
containerClass
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{items.map(
|
{items.map(({ title, description, icon, callToAction, classes: itemClasses = {} }) => (
|
||||||
({
|
|
||||||
title,
|
|
||||||
description,
|
|
||||||
icon,
|
|
||||||
callToAction,
|
|
||||||
classes: itemClasses = {},
|
|
||||||
}) => (
|
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div class={twMerge('flex flex-row max-w-md', panelClass, itemClasses?.panel)}>
|
||||||
class={twMerge(
|
|
||||||
"flex flex-row max-w-md",
|
|
||||||
panelClass,
|
|
||||||
itemClasses?.panel
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
{(icon || defaultIcon) && (
|
{(icon || defaultIcon) && (
|
||||||
<Icon
|
<Icon
|
||||||
name={icon || defaultIcon}
|
name={icon || defaultIcon}
|
||||||
class={twMerge(
|
class={twMerge('w-7 h-7 mr-2 rtl:mr-0 rtl:ml-2', defaultIconClass, itemClasses?.icon)}
|
||||||
"w-7 h-7 mr-2 rtl:mr-0 rtl:ml-2",
|
|
||||||
defaultIconClass,
|
|
||||||
itemClasses?.icon
|
|
||||||
)}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="mt-0.5">
|
||||||
<h3
|
{title && <h3 class={twMerge('text-xl font-bold', titleClass, itemClasses?.title)}>{title}</h3>}
|
||||||
class={twMerge(
|
|
||||||
"text-xl font-bold",
|
|
||||||
titleClass,
|
|
||||||
itemClasses?.title
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{title}
|
|
||||||
</h3>
|
|
||||||
{description && (
|
{description && (
|
||||||
<p
|
<p
|
||||||
class={twMerge(
|
class={twMerge(`${title ? 'mt-3' : ''} text-muted`, descriptionClass, itemClasses?.description)}
|
||||||
`${title ? "mt-3" : ""} text-muted`,
|
|
||||||
descriptionClass,
|
|
||||||
itemClasses?.description
|
|
||||||
)}
|
|
||||||
set:html={description}
|
set:html={description}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{callToAction && (
|
{callToAction && (
|
||||||
<div class="mt-2 text-primary cursor-pointer">
|
<div
|
||||||
|
class={twMerge(
|
||||||
|
`${title || description ? 'mt-3' : ''} text-primary cursor-pointer`,
|
||||||
|
actionClass,
|
||||||
|
itemClasses?.actionClass
|
||||||
|
)}
|
||||||
|
>
|
||||||
<CTA callToAction={callToAction} />
|
<CTA callToAction={callToAction} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
))}
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
import { Icon } from 'astro-icon/components';
|
|
||||||
import type { Content } from '~/types';
|
import type { Content } from '~/types';
|
||||||
import Headline from '../ui/Headline.astro';
|
import Headline from '../ui/Headline.astro';
|
||||||
import WidgetWrapper from '../ui/WidgetWrapper.astro';
|
import WidgetWrapper from '../ui/WidgetWrapper.astro';
|
||||||
import Image from '~/components/common/Image.astro';
|
import Image from '~/components/common/Image.astro';
|
||||||
import CTA from '../ui/CTA.astro';
|
import CTA from '../ui/CTA.astro';
|
||||||
|
import ItemGrid from '../ui/ItemGrid.astro';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
title = await Astro.slots.render('title'),
|
title = await Astro.slots.render('title'),
|
||||||
@ -13,6 +13,7 @@ const {
|
|||||||
content = await Astro.slots.render('content'),
|
content = await Astro.slots.render('content'),
|
||||||
callToAction,
|
callToAction,
|
||||||
items = [],
|
items = [],
|
||||||
|
columns,
|
||||||
image = await Astro.slots.render('image'),
|
image = await Astro.slots.render('image'),
|
||||||
isReversed = false,
|
isReversed = false,
|
||||||
isAfterContent = false,
|
isAfterContent = false,
|
||||||
@ -53,25 +54,19 @@ const {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
<ItemGrid
|
||||||
items && (
|
items={items}
|
||||||
<div class="space-y-8">
|
columns={columns}
|
||||||
{items.map(({ title: title2, description, icon }) => (
|
defaultIcon="tabler:check"
|
||||||
<div class="flex">
|
classes={{
|
||||||
<div class="flex-shrink-0">
|
container: `gap-y-4 md:gap-y-8`,
|
||||||
<div class="flex h-7 w-7 items-center justify-center rounded-full bg-green-600 dark:bg-green-700 text-gray-50">
|
panel: 'max-w-none',
|
||||||
<Icon name={icon ? icon : 'tabler:check'} class="w-5 h-5" />
|
title: 'text-lg font-medium leading-6 dark:text-white ml-2 rtl:ml-0 rtl:mr-2',
|
||||||
</div>
|
description: 'text-muted dark:text-slate-400 ml-2 rtl:ml-0 rtl:mr-2',
|
||||||
</div>
|
icon: 'flex h-7 w-7 items-center justify-center rounded-full bg-green-600 dark:bg-green-700 text-gray-50 p-1',
|
||||||
<div class="ml-4 rtl:ml-0 rtl:mr-4">
|
action: 'text-lg font-medium leading-6 dark:text-white ml-2 rtl:ml-0 rtl:mr-2',
|
||||||
{title2 && <h3 class="text-lg font-medium leading-6 dark:text-white">{title2}</h3>}
|
}}
|
||||||
{description && <p class="mt-2 text-muted dark:text-slate-400" set:html={description} />}
|
/>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
<div aria-hidden="true" class="mt-10 md:mt-0 md:basis-1/2">
|
<div aria-hidden="true" class="mt-10 md:mt-0 md:basis-1/2">
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,8 @@ const {
|
|||||||
container: 'mt-12',
|
container: 'mt-12',
|
||||||
panel: 'max-w-full sm:max-w-md',
|
panel: 'max-w-full sm:max-w-md',
|
||||||
title: 'text-lg font-semibold',
|
title: 'text-lg font-semibold',
|
||||||
icon: 'flex-shrink-0 mt-0.5 text-primary w-6 h-6',
|
description: 'mt-0.5',
|
||||||
|
icon: 'flex-shrink-0 mt-1 text-primary w-6 h-6',
|
||||||
...((classes?.items as {}) ?? {}),
|
...((classes?.items as {}) ?? {}),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -52,18 +52,31 @@ const metadata = {
|
|||||||
|
|
||||||
<Content
|
<Content
|
||||||
id="about"
|
id="about"
|
||||||
|
columns={3}
|
||||||
items={[
|
items={[
|
||||||
{
|
{
|
||||||
title: 'Dribbble',
|
|
||||||
icon: 'tabler:brand-dribbble',
|
icon: 'tabler:brand-dribbble',
|
||||||
|
callToAction: {
|
||||||
|
targetBlank: true,
|
||||||
|
text: 'Dribbble',
|
||||||
|
href: '#',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Behance',
|
|
||||||
icon: 'tabler:brand-behance',
|
icon: 'tabler:brand-behance',
|
||||||
|
callToAction: {
|
||||||
|
targetBlank: true,
|
||||||
|
text: 'Behance',
|
||||||
|
href: '#',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Pinterest',
|
|
||||||
icon: 'tabler:brand-pinterest',
|
icon: 'tabler:brand-pinterest',
|
||||||
|
callToAction: {
|
||||||
|
targetBlank: true,
|
||||||
|
text: 'Pinterest',
|
||||||
|
href: '#',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
image={{
|
image={{
|
||||||
|
Reference in New Issue
Block a user