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