diff options
Diffstat (limited to 'src/components/widgets/Steps2.astro')
| -rw-r--r-- | src/components/widgets/Steps2.astro | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/components/widgets/Steps2.astro b/src/components/widgets/Steps2.astro index 8f7afb5..b37fbc0 100644 --- a/src/components/widgets/Steps2.astro +++ b/src/components/widgets/Steps2.astro @@ -18,6 +18,14 @@ const { classes = {}, bg = await Astro.slots.render('bg'), } = Astro.props; + +// Function to detect and wrap email addresses in mailto links +function processEmailLinks(text: string): string { + const emailRegex = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g; + return text.replace(emailRegex, (email) => { + return `<a href="mailto:${email}" class="text-primary hover:text-secondary transition-colors">${email}</a>`; + }); +} --- <WidgetWrapper id={id} isDark={isDark} containerClass={`max-w-6xl mx-auto ${classes?.container ?? ''}`} bg={bg}> @@ -60,7 +68,7 @@ const { </div> <div class="pl-4 rtl:pl-0 rtl:pr-4"> <h3 class="mb-4 text-xl font-semibold font-heading" set:html={title2} /> - <p class="text-muted dark:text-gray-400" set:html={description} /> + <p class="text-muted dark:text-gray-400" set:html={description ? processEmailLinks(description) : ''} /> </div> </li> )) |
