Include CTA component in Hero widgets

This commit is contained in:
widgeter
2023-08-28 23:13:35 +02:00
parent 2276a910b2
commit 34707c15ef
8 changed files with 58 additions and 54 deletions

View File

@ -1,6 +1,6 @@
--- ---
import { Icon } from 'astro-icon/components';
import Image from '~/components/common/Image.astro'; import Image from '~/components/common/Image.astro';
import CTA from '../ui/CTA.astro';
const { const {
title = await Astro.slots.render('title'), title = await Astro.slots.render('title'),
@ -19,12 +19,14 @@ const {
<div class="pt-0 md:pt-[76px] pointer-events-none"></div> <div class="pt-0 md:pt-[76px] pointer-events-none"></div>
<div class="py-12 md:py-20"> <div class="py-12 md:py-20">
<div class="text-center pb-10 md:pb-16 max-w-screen-lg mx-auto"> <div class="text-center pb-10 md:pb-16 max-w-screen-lg mx-auto">
{tagline && ( {
tagline && (
<p <p
class="text-base text-secondary dark:text-blue-200 font-bold tracking-wide uppercase" class="text-base text-secondary dark:text-blue-200 font-bold tracking-wide uppercase"
set:html={tagline} set:html={tagline}
/> />
)} )
}
{ {
title && ( title && (
<h1 <h1
@ -42,14 +44,9 @@ const {
{typeof callToAction === 'string' ? ( {typeof callToAction === 'string' ? (
<Fragment set:html={callToAction} /> <Fragment set:html={callToAction} />
) : ( ) : (
<a class="btn btn-primary sm:mb-0 w-full" href={callToAction?.href} target="_blank" rel="noopener"> <div class="btn btn-primary sm:mb-0 w-full">
{callToAction?.icon && ( <CTA callToAction={callToAction} />
<> </div>
<Icon name={callToAction.icon} class="w-5 h-5 mr-1 -ml-1.5 rtl:-mr-1.5 rtl:ml-1" />
</>
)}
{callToAction?.text}
</a>
)} )}
</div> </div>
) )
@ -60,15 +57,9 @@ const {
{typeof callToAction2 === 'string' ? ( {typeof callToAction2 === 'string' ? (
<Fragment set:html={callToAction2} /> <Fragment set:html={callToAction2} />
) : ( ) : (
<a class="btn w-full" href={callToAction2?.href}> <div class="btn w-full">
{callToAction2?.icon && ( <CTA callToAction={callToAction2} />
<> </div>
<Icon name={callToAction2.icon} class="w-5 h-5 mr-1 -ml-1.5" />
&nbsp;
</>
)}
{callToAction2.text}
</a>
)} )}
</div> </div>
) )

View File

@ -1,7 +1,7 @@
--- ---
import { Icon } from 'astro-icon/components';
import Image from '~/components/common/Image.astro'; import Image from '~/components/common/Image.astro';
import type { CallToAction } from '~/types'; import type { CallToAction } from '~/types';
import CTA from '../ui/CTA.astro';
export interface Props { export interface Props {
title?: string; title?: string;
@ -30,12 +30,14 @@ const {
<div class="pt-0 md:pt-[76px] pointer-events-none"></div> <div class="pt-0 md:pt-[76px] pointer-events-none"></div>
<div class="py-12 md:py-20 lg:py-0 lg:flex lg:items-center lg:h-screen lg:gap-8"> <div class="py-12 md:py-20 lg:py-0 lg:flex lg:items-center lg:h-screen lg:gap-8">
<div class="basis-1/2 text-center lg:text-left pb-10 md:pb-16 mx-auto"> <div class="basis-1/2 text-center lg:text-left pb-10 md:pb-16 mx-auto">
{tagline && ( {
tagline && (
<p <p
class="text-base text-secondary dark:text-blue-200 font-bold tracking-wide uppercase" class="text-base text-secondary dark:text-blue-200 font-bold tracking-wide uppercase"
set:html={tagline} set:html={tagline}
/> />
)} )
}
{ {
title && ( title && (
<h1 <h1
@ -55,14 +57,9 @@ const {
{typeof callToAction === 'string' ? ( {typeof callToAction === 'string' ? (
<Fragment set:html={callToAction} /> <Fragment set:html={callToAction} />
) : ( ) : (
<a class="btn btn-primary sm:mb-0 w-full" href={callToAction?.href} target="_blank" rel="noopener"> <div class="btn btn-primary sm:mb-0 w-full">
{callToAction?.icon && ( <CTA callToAction={callToAction} />
<> </div>
<Icon name={callToAction.icon} class="w-5 h-5 mr-1 -ml-1.5 rtl:-mr-1.5 rtl:ml-1" />{' '}
</>
)}
{callToAction?.text}
</a>
)} )}
</div> </div>
) )
@ -73,14 +70,9 @@ const {
{typeof callToAction2 === 'string' ? ( {typeof callToAction2 === 'string' ? (
<Fragment set:html={callToAction2} /> <Fragment set:html={callToAction2} />
) : ( ) : (
<a class="btn w-full" href={callToAction2?.href}> <div class="btn w-full">
{callToAction2?.icon && ( <CTA callToAction={callToAction2} />
<> </div>
<Icon name={callToAction2.icon} class="w-5 h-5 mr-1 -ml-1.5" />{' '}
</>
)}
{callToAction2.text}
</a>
)} )}
</div> </div>
) )

View File

@ -19,7 +19,12 @@ const metadata = {
<Hero2 <Hero2
tagline="Mobile App Web Demo" tagline="Mobile App Web Demo"
callToAction={{ text: 'Download App', href: 'https://github.com/onwidget/astrowind', icon: 'tabler:download' }} callToAction={{
targetBlank: true,
text: 'Download App',
href: 'https://github.com/onwidget/astrowind',
icon: 'tabler:download',
}}
callToAction2={{ text: 'Learn more', href: '#features' }} callToAction2={{ text: 'Learn more', href: '#features' }}
image={{ image={{
src: 'https://images.unsplash.com/photo-1535303311164-664fc9ec6532?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=987&q=80', src: 'https://images.unsplash.com/photo-1535303311164-664fc9ec6532?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=987&q=80',
@ -42,6 +47,7 @@ const metadata = {
<!-- Features3 Widget ************** --> <!-- Features3 Widget ************** -->
<Features3 <Features3
id="features"
title="How to use our app?" title="How to use our app?"
subtitle="Tired of spending hours crafting documents from scratch? Our app offers an innovative solution. With a wide array of professionally designed templates, you can now create stunning documents in minutes. Explore our templates now and experience the difference." subtitle="Tired of spending hours crafting documents from scratch? Our app offers an innovative solution. With a wide array of professionally designed templates, you can now create stunning documents in minutes. Explore our templates now and experience the difference."
tagline="Step-by-step guide" tagline="Step-by-step guide"

View File

@ -40,7 +40,12 @@ const metadata = {
<!-- Hero2 Widget ******************* --> <!-- Hero2 Widget ******************* -->
<Hero id="hero" title="Sarah Johnson" tagline="Personal Web Demo" callToAction={{ text: 'Hire me', href: '/' }}> <Hero
id="hero"
title="Sarah Johnson"
tagline="Personal Web Demo"
callToAction={{ targetBlank: true, text: 'Hire me', href: '/' }}
>
<Fragment slot="subtitle"> <Fragment slot="subtitle">
I'm a Graphic Designer passionate about crafting visual stories. <br /> With 5 years of experience and a degree I'm a Graphic Designer passionate about crafting visual stories. <br /> With 5 years of experience and a degree
from New York University's School of Design. I infuse vitality into brands and designs, transforming concepts into from New York University's School of Design. I infuse vitality into brands and designs, transforming concepts into

View File

@ -41,7 +41,7 @@ const metadata = {
<Hero2 <Hero2
tagline="SaaS Web Demo" tagline="SaaS Web Demo"
callToAction={{ text: 'Get Started', href: 'https://github.com/onwidget/astrowind' }} callToAction={{ targetBlank: true, text: 'Get Started', href: 'https://github.com/onwidget/astrowind' }}
callToAction2={{ text: 'Learn more', href: '#features' }} callToAction2={{ text: 'Learn more', href: '#features' }}
image={{ image={{
src: 'https://images.unsplash.com/photo-1580481072645-022f9a6dbf27?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2070&q=80', src: 'https://images.unsplash.com/photo-1580481072645-022f9a6dbf27?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2070&q=80',

View File

@ -21,7 +21,12 @@ const metadata = {
<Hero <Hero
tagline="Startup Web Demo" tagline="Startup Web Demo"
callToAction={{ text: 'Get templates', href: 'https://github.com/onwidget/astrowind', icon: 'tabler:download' }} callToAction={{
targetBlank: true,
text: 'Get templates',
href: 'https://github.com/onwidget/astrowind',
icon: 'tabler:download',
}}
callToAction2={{ text: 'Learn more', href: '#features' }} callToAction2={{ text: 'Learn more', href: '#features' }}
> >
<Fragment slot="title"> <Fragment slot="title">

View File

@ -22,7 +22,12 @@ const metadata = {
<!-- Hero Widget ******************* --> <!-- Hero Widget ******************* -->
<Hero <Hero
callToAction={{ text: 'Get template', href: 'https://github.com/onwidget/astrowind', icon: 'tabler:download' }} callToAction={{
targetBlank: true,
text: 'Get template',
href: 'https://github.com/onwidget/astrowind',
icon: 'tabler:download',
}}
callToAction2={{ text: 'Learn more', href: '#features' }} callToAction2={{ text: 'Learn more', href: '#features' }}
image={{ src: '~/assets/images/hero.png', alt: 'AstroWind Hero Image' }} image={{ src: '~/assets/images/hero.png', alt: 'AstroWind Hero Image' }}
> >

View File

@ -18,7 +18,7 @@ const metadata = {
tagline="Services" tagline="Services"
title="Elevate your projects with our stunning templates" title="Elevate your projects with our stunning templates"
subtitle="Explore our meticulously crafted templates tailored to various industries and purposes. From captivating presentations to functional website designs, we offer the tools you need to succeed." subtitle="Explore our meticulously crafted templates tailored to various industries and purposes. From captivating presentations to functional website designs, we offer the tools you need to succeed."
callToAction={{ text: 'Start exploring', href: '/' }} callToAction={{ targetBlank: true, text: 'Start exploring', href: '/' }}
image={{ image={{
src: 'https://images.unsplash.com/photo-1519389950473-47ba0277781c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1740&q=80', src: 'https://images.unsplash.com/photo-1519389950473-47ba0277781c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1740&q=80',
alt: 'AstroWind Hero Image', alt: 'AstroWind Hero Image',