From a730e05645128224be7b49b36bd15f4f81303caa Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Tue, 22 Jul 2025 18:52:54 +0300 Subject: Buttons fix --- src/components/ui/HeroButton.astro | 52 +++++++++++++++++++++++++++++ src/components/widgets/HeroBackground.astro | 4 +-- 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 src/components/ui/HeroButton.astro (limited to 'src/components') diff --git a/src/components/ui/HeroButton.astro b/src/components/ui/HeroButton.astro new file mode 100644 index 0000000..f7a07c6 --- /dev/null +++ b/src/components/ui/HeroButton.astro @@ -0,0 +1,52 @@ +--- +import { Icon } from 'astro-icon/components'; +import { twMerge } from 'tailwind-merge'; +import type { CallToAction as Props } from '~/types'; + +const { + variant = 'secondary', + target, + text = Astro.slots.render('default'), + icon = '', + class: className = '', + type, + ...rest +} = Astro.props; + +const variants = { + primary: 'btn-primary', + secondary: 'btn-secondary', + tertiary: 'btn btn-tertiary', + link: 'cursor-pointer hover:text-primary', +}; +--- + +{ + type === 'button' || type === 'submit' || type === 'reset' ? ( + + ) : ( + + + + {icon && } + + + + ) +} diff --git a/src/components/widgets/HeroBackground.astro b/src/components/widgets/HeroBackground.astro index b5ea748..904bc23 100644 --- a/src/components/widgets/HeroBackground.astro +++ b/src/components/widgets/HeroBackground.astro @@ -1,6 +1,6 @@ --- import Image from '~/components/common/Image.astro'; -import Button from '~/components/ui/Button.astro'; +import HeroButton from '~/components/ui/HeroButton.astro'; import type { Hero as Props } from '~/types'; @@ -105,7 +105,7 @@ const { {Array.isArray(actions) ? ( actions.map((action) => (
-
)) ) : ( -- cgit v1.2.3