Replace props in CallToAction widget: 'callToAction' to 'actions'

This commit is contained in:
prototypa
2023-09-02 20:39:46 -04:00
parent 47ab6f02a5
commit 4c917f5133
12 changed files with 137 additions and 84 deletions

View File

@ -9,13 +9,14 @@ interface Props extends Widget {
subtitle?: string; subtitle?: string;
tagline?: string; tagline?: string;
callToAction?: CallToAction; callToAction?: CallToAction;
actions?: string | CallToAction[];
} }
const { const {
title = await Astro.slots.render('title'), title = await Astro.slots.render('title'),
subtitle = await Astro.slots.render('subtitle'), subtitle = await Astro.slots.render('subtitle'),
tagline = await Astro.slots.render('tagline'), tagline = await Astro.slots.render('tagline'),
callToAction = await Astro.slots.render('callToAction'), actions = await Astro.slots.render('actions'),
id, id,
isDark = false, isDark = false,
@ -39,15 +40,18 @@ const {
}} }}
/> />
{ {
typeof callToAction === 'string' ? ( actions && (
<Fragment set:html={callToAction} /> <div class="max-w-xs sm:max-w-md m-auto flex flex-nowrap flex-col sm:flex-row sm:justify-center gap-4 mt-6">
) : ( {Array.isArray(actions) ? (
callToAction && actions.map((action) => (
callToAction.text && ( <div class="flex w-full sm:w-auto">
<div class="mt-6 max-w-xs mx-auto"> <Button {...(action || {})} class="w-full sm:mb-0" />
<Button variant="primary" {...callToAction} class="w-full sm:w-auto" /> </div>
))
) : (
<Fragment set:html={actions} />
)}
</div> </div>
)
) )
} }
</div> </div>

View File

@ -1,6 +1,8 @@
--- ---
import Layout from '~/layouts/PageLayout.astro'; import Layout from '~/layouts/PageLayout.astro';
import Header from '~/components/widgets/Header.astro';
import Hero2 from '~/components/widgets/Hero2.astro'; import Hero2 from '~/components/widgets/Hero2.astro';
import CallToAction from '~/components/widgets/CallToAction.astro'; import CallToAction from '~/components/widgets/CallToAction.astro';
import Features3 from '~/components/widgets/Features3.astro'; import Features3 from '~/components/widgets/Features3.astro';
@ -9,34 +11,54 @@ import Testimonials from '~/components/widgets/Testimonials.astro';
import FAQs from '~/components/widgets/FAQs.astro'; import FAQs from '~/components/widgets/FAQs.astro';
import Stats from '~/components/widgets/Stats.astro'; import Stats from '~/components/widgets/Stats.astro';
import Button from '~/components/ui/Button.astro';
import Image from '~/components/common/Image.astro';
import appStoreImg from '~/assets/images/app-store.png';
import googlePlayImg from '~/assets/images/google-play.png';
const appStoreDownloadLink = 'https://github.com/onwidget/astrowind';
const googlePlayDownloadLink = 'https://github.com/onwidget/astrowind';
const metadata = { const metadata = {
title: 'Mobile App Homepage', title: 'Mobile App Homepage',
}; };
--- ---
<Layout metadata={metadata}> <Layout metadata={metadata}>
<Fragment slot="announcement"></Fragment>
<Fragment slot="header">
<Header
position="left"
links={[
{ text: 'Services', href: '#' },
{ text: 'Features', href: '#' },
{ text: 'About', href: '#' },
]}
actions={[
{
text: 'Download',
href: '#download',
},
]}
isSticky
showToggleTheme
/>
</Fragment>
<!-- Hero2 Widget ******************* --> <!-- Hero2 Widget ******************* -->
<Hero2 <Hero2
tagline="Mobile App Web Demo" tagline="Mobile App Web Demo"
actions={[
{
variant:"primary",
target: '_blank',
text: 'Download App',
href: 'https://github.com/onwidget/astrowind',
icon: 'tabler:download',
},
{ 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',
alt: 'AstroWind Hero Image', alt: 'AstroWind Hero Image',
}} }}
> >
<Fragment slot="title"> <Fragment slot="title">
AstroWind <span class="text-accent dark:text-white highlight">App</span>: <br /> building professional websites <span class="text-accent dark:text-white highlight">AstroWind App</span>: <br /> professional websites <span
made easy class="hidden xl:inline">made easy</span
>
</Fragment> </Fragment>
<Fragment slot="subtitle"> <Fragment slot="subtitle">
@ -45,6 +67,16 @@ const metadata = {
</span> </span>
Download now and embark on a journey to elevate your projects like never before. Download now and embark on a journey to elevate your projects like never before.
</Fragment> </Fragment>
<div slot="actions" class="flex max-w-sm gap-4">
<Button variant="link" href={appStoreDownloadLink}>
<Image src={appStoreImg} alt="App Store Image" width={200} />
</Button>
<Button variant="link" href={googlePlayDownloadLink}>
<Image src={googlePlayImg} alt="Google Play Image" width={200} />
</Button>
</div>
</Hero2> </Hero2>
<!-- Features3 Widget ************** --> <!-- Features3 Widget ************** -->
@ -248,12 +280,18 @@ const metadata = {
<!-- CallToAction Widget *********** --> <!-- CallToAction Widget *********** -->
<CallToAction <CallToAction
title="Instant access to beautiful templates" id="download"
title="Download our app now!"
subtitle="Access a variety of stunning templates, simplify your creative process, and elevate your online presence." subtitle="Access a variety of stunning templates, simplify your creative process, and elevate your online presence."
callToAction={{ >
text: 'Download App', <div slot="actions" class="flex max-w-sm gap-4">
href: 'https://github.com/onwidget/astrowind', <Button variant="link" href={appStoreDownloadLink}>
icon: 'tabler:download', <Image src={appStoreImg} alt="App Store Image" width={200} />
}} </Button>
/>
<Button variant="link" href={googlePlayDownloadLink}>
<Image src={googlePlayImg} alt="Google Play Image" width={200} />
</Button>
</div>
</CallToAction>
</Layout> </Layout>

View File

@ -380,10 +380,10 @@ const metadata = {
<CallToAction <CallToAction
title="Let's create together" title="Let's create together"
subtitle="Ready to transform your vision into captivating designs?" subtitle="Ready to transform your vision into captivating designs?"
callToAction={{ actions={[{
text: 'Hire me', text: 'Hire me',
href: '/', href: '/',
}} }]}
/> />
<!-- BlogLatestPost Widget **************** --> <!-- BlogLatestPost Widget **************** -->

View File

@ -300,12 +300,12 @@ const metadata = {
<!-- CallToAction Widget *********** --> <!-- CallToAction Widget *********** -->
<CallToAction <CallToAction
callToAction={{ actions={[{
target: '_blank', target: '_blank',
text: 'Get templates', text: 'Get templates',
href: 'https://github.com/onwidget/astrowind', href: 'https://github.com/onwidget/astrowind',
icon: 'tabler:download', icon: 'tabler:download',
}} }]}
> >
<Fragment slot="title">Be a part of our vision</Fragment> <Fragment slot="title">Be a part of our vision</Fragment>

View File

@ -377,11 +377,11 @@ const metadata = {
<!-- CallToAction Widget *********** --> <!-- CallToAction Widget *********** -->
<CallToAction <CallToAction
callToAction={{ actions={[{
text: 'Get template', text: 'Get template',
href: 'https://github.com/onwidget/astrowind', href: 'https://github.com/onwidget/astrowind',
icon: 'tabler:download', icon: 'tabler:download',
}} }]}
> >
<Fragment slot="title"> <Fragment slot="title">
Astro&nbsp;+&nbsp;<br class="block sm:hidden" /><span class="sm:whitespace-nowrap">Tailwind CSS</span> Astro&nbsp;+&nbsp;<br class="block sm:hidden" /><span class="sm:whitespace-nowrap">Tailwind CSS</span>

View File

@ -2,7 +2,7 @@
import Layout from '~/layouts/LandingLayout.astro'; import Layout from '~/layouts/LandingLayout.astro';
import Hero2 from '~/components/widgets/Hero2.astro'; import Hero2 from '~/components/widgets/Hero2.astro';
import CallToAction from "~/components/widgets/CallToAction.astro" import CallToAction from '~/components/widgets/CallToAction.astro';
const metadata = { const metadata = {
title: 'Click-through Landing Page Demo', title: 'Click-through Landing Page Demo',
@ -16,7 +16,10 @@ const metadata = {
tagline="Click-through Demo" tagline="Click-through Demo"
title="Click-through Landing Page: The Perfect Bridge to Conversion!" title="Click-through Landing Page: The Perfect Bridge to Conversion!"
subtitle="Learn how to design a Click-Through Landing Page that seamlessly guides visitors to your main offer." subtitle="Learn how to design a Click-Through Landing Page that seamlessly guides visitors to your main offer."
actions={[{ variant:"primary", text: 'Call to Action', href: '#', icon: 'tabler:square-rounded-arrow-right' }, { text: 'Learn more', href: '#' }]} actions={[
{ variant: 'primary', text: 'Call to Action', href: '#', icon: 'tabler:square-rounded-arrow-right' },
{ text: 'Learn more', href: '#' },
]}
image={{ image={{
src: 'https://images.unsplash.com/photo-1516321497487-e288fb19713f?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2070&q=80', src: 'https://images.unsplash.com/photo-1516321497487-e288fb19713f?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2070&q=80',
alt: 'Click-through Landing Page Hero Image', alt: 'Click-through Landing Page Hero Image',
@ -26,10 +29,13 @@ const metadata = {
<CallToAction <CallToAction
title="Coming soon" title="Coming soon"
subtitle="We are working on the content of these demo pages. You will see them very soon. Stay tuned Stay tuned!" subtitle="We are working on the content of these demo pages. You will see them very soon. Stay tuned Stay tuned!"
callToAction={{ actions={[
text: 'Get template', {
variant: 'primary',
text: 'Download Template',
href: 'https://github.com/onwidget/astrowind', href: 'https://github.com/onwidget/astrowind',
icon: 'tabler:download', icon: 'tabler:download',
}} },
]}
/> />
</Layout> </Layout>

View File

@ -26,10 +26,11 @@ const metadata = {
<CallToAction <CallToAction
title="Coming soon" title="Coming soon"
subtitle="We are working on the content of these demo pages. You will see them very soon. Stay tuned Stay tuned!" subtitle="We are working on the content of these demo pages. You will see them very soon. Stay tuned Stay tuned!"
callToAction={{ actions={[{
text: 'Get template', variant: "primary",
text: 'Download Template',
href: 'https://github.com/onwidget/astrowind', href: 'https://github.com/onwidget/astrowind',
icon: 'tabler:download', icon: 'tabler:download',
}} }]}
/> />
</Layout> </Layout>

View File

@ -29,10 +29,11 @@ const metadata = {
<CallToAction <CallToAction
title="Coming soon" title="Coming soon"
subtitle="We are working on the content of these demo pages. You will see them very soon. Stay tuned Stay tuned!" subtitle="We are working on the content of these demo pages. You will see them very soon. Stay tuned Stay tuned!"
callToAction={{ actions={[{
text: 'Get template', variant: "primary",
text: 'Download Template',
href: 'https://github.com/onwidget/astrowind', href: 'https://github.com/onwidget/astrowind',
icon: 'tabler:download', icon: 'tabler:download',
}} }]}
/> />
</Layout> </Layout>

View File

@ -29,10 +29,11 @@ const metadata = {
<CallToAction <CallToAction
title="Coming soon" title="Coming soon"
subtitle="We are working on the content of these demo pages. You will see them very soon. Stay tuned Stay tuned!" subtitle="We are working on the content of these demo pages. You will see them very soon. Stay tuned Stay tuned!"
callToAction={{ actions={[{
text: 'Get template', variant: "primary",
text: 'Download Template',
href: 'https://github.com/onwidget/astrowind', href: 'https://github.com/onwidget/astrowind',
icon: 'tabler:download', icon: 'tabler:download',
}} }]}
/> />
</Layout> </Layout>

View File

@ -26,10 +26,11 @@ const metadata = {
<CallToAction <CallToAction
title="Coming soon" title="Coming soon"
subtitle="We are working on the content of these demo pages. You will see them very soon. Stay tuned Stay tuned!" subtitle="We are working on the content of these demo pages. You will see them very soon. Stay tuned Stay tuned!"
callToAction={{ actions={[{
text: 'Get template', variant: "primary",
text: 'Download Template',
href: 'https://github.com/onwidget/astrowind', href: 'https://github.com/onwidget/astrowind',
icon: 'tabler:download', icon: 'tabler:download',
}} }]}
/> />
</Layout> </Layout>

View File

@ -26,10 +26,11 @@ const metadata = {
<CallToAction <CallToAction
title="Coming soon" title="Coming soon"
subtitle="We are working on the content of these demo pages. You will see them very soon. Stay tuned Stay tuned!" subtitle="We are working on the content of these demo pages. You will see them very soon. Stay tuned Stay tuned!"
callToAction={{ actions={[{
text: 'Get template', variant: "primary",
text: 'Download Template',
href: 'https://github.com/onwidget/astrowind', href: 'https://github.com/onwidget/astrowind',
icon: 'tabler:download', icon: 'tabler:download',
}} }]}
/> />
</Layout> </Layout>

View File

@ -211,10 +211,10 @@ const metadata = {
<!-- CallToAction Widget *********** --> <!-- CallToAction Widget *********** -->
<CallToAction <CallToAction
callToAction={{ actions={[{
text: 'Start exploring', text: 'Start exploring',
href: '/', href: '/',
}} }]}
title="Dive into our template collection" title="Dive into our template collection"
subtitle="Whether you're in business, design, or education, our templates are here to elevate your projects." subtitle="Whether you're in business, design, or education, our templates are here to elevate your projects."
/> />