Skip to content

Commit

Permalink
Newsletter signup section (#228)
Browse files Browse the repository at this point in the history
* add button to EmailSignup component and edit Button to use external link if passed in

* isExternal improved code
  • Loading branch information
adriencyberspace authored Oct 18, 2024
1 parent 0b05a78 commit 104b18f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
15 changes: 14 additions & 1 deletion app/components/EmailSignup/EmailSignup.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@
.emailSignupContainer {
display: flex;
width: 100%;
padding: $spacing-16 $spacing-32;
padding: $spacing-16 $general-spacing-md;
flex-direction: column;
align-items: center;
gap: $general-spacing-lg;
background: $color-secondary;

h2 {
text-align: center;
}

@include r_max($break-tablet-s) {
padding: $general-spacing-xl $general-spacing-md;

h2 {
font-size: 26px;
}
}
}
11 changes: 10 additions & 1 deletion app/components/EmailSignup/Emailsignup.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import React from "react";
import styles from "./EmailSignup.module.scss";
import { Button } from "components/ui/inline/Button/Button";

export const EmailSignup = () => (
<div className={styles.emailSignupContainer} />
<div className={styles.emailSignupContainer}>
<h2>Join our mailing list to get updates</h2>
<Button
isExternalLink={false}
href="javascript:void( window.open( 'https://dcyf.jotform.com/242708128943966', 'blank', 'scrollbars=yes, toolbar=no, width=700, height=500' ) ) "
>
Sign up today
</Button>
</div>
);
7 changes: 5 additions & 2 deletions app/components/ui/inline/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const Button = ({
href,
mobileFullWidth = true,
isVisualOnly = false,
isExternalLink,
}: {
children: string | JSX.Element;
onClick?: React.MouseEventHandler<HTMLButtonElement>;
Expand All @@ -50,6 +51,7 @@ export const Button = ({
href?: string;
mobileFullWidth?: boolean;
isVisualOnly?: boolean; // Maintains button styling as visual cue clickable cards but hidden to screen readers
isExternalLink?: boolean;
}) => {
const buttonClass = classNames(
styles.button,
Expand Down Expand Up @@ -86,9 +88,10 @@ export const Button = ({

// Links that follow same visual guidelines as buttons
if (href) {
const isExternalLink = !href.startsWith("/");
const isExternal = isExternalLink ?? !href?.startsWith("/");

const linkProps = isExternal && { target: "_blank", rel: "noreferrer" };

const linkProps = isExternalLink && { target: "_blank", rel: "noreferrer" };
return (
<a href={href} className={buttonClass} {...linkProps}>
{content}
Expand Down

0 comments on commit 104b18f

Please sign in to comment.