Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add id to CTA links and buttons #688

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
8 changes: 8 additions & 0 deletions shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,11 @@ export interface Vendor {
export type DeploymentOption = keyof typeof features;

export const activeUsersAmount = '5500+';

export const getSlugifiedText = (text?: string) =>
text?.replaceAll(' ', '-').toLowerCase();

const getVendorLinkId = (vendorName?: string) => getSlugifiedText(vendorName);

export const getVendorsLinkId = (vendorName1?: string, vendorName2?: string) =>
`${getVendorLinkId(vendorName1)}-vs-${getVendorLinkId(vendorName2)}`;
4 changes: 3 additions & 1 deletion src/components/ArticleSidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ interface ArticleSidebarProps {
};
tableOfContents: any;
shareArticleSectionTitle?: string;
ctaButtonid: string;
}

const ArticleSidebar = ({
article,
tableOfContents,
shareArticleSectionTitle,
ctaButtonid,
}: ArticleSidebarProps) => {
return (
<div className={container}>
Expand All @@ -34,7 +36,7 @@ const ArticleSidebar = ({
<RenderToc items={tableOfContents} />
</div>
) : null}
<SidebarCta />
<SidebarCta ctaButtonid={ctaButtonid} />
</div>
);
};
Expand Down
3 changes: 2 additions & 1 deletion src/components/Bio/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getImage } from 'gatsby-plugin-image';
import { Link } from 'gatsby';
import { Fragment } from 'react';
import Avatar from '../Avatar';
import { getAuthorPathBySlug } from '../../../shared';
import { getAuthorPathBySlug, getSlugifiedText } from '../../../shared';
import { container, avatarWrapper, authorName } from './styles.module.less';

export interface BioProps {
Expand Down Expand Up @@ -35,6 +35,7 @@ const Bio = ({ authors }: BioProps) => {

const combined = (
<Link
id={`${getSlugifiedText(name)}-blog-post-author-hero-section`}
to={getAuthorPathBySlug(slug)}
className={avatarWrapper}
>
Expand Down
7 changes: 6 additions & 1 deletion src/components/BlogBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { background, container, banner } from './styles.module.less';
interface BlogBanner {
title: ReactNode;
button: {
id: string;
title: string;
href: string;
};
Expand All @@ -17,7 +18,11 @@ const BlogBanner = ({ title, button }: BlogBanner) => {
<StraightLinesBackground className={container}>
<div className={banner}>
{title}
<OutboundLinkFilled href={button.href} target="_blank">
<OutboundLinkFilled
id={button.id}
href={button.href}
target="_blank"
>
{button.title}
</OutboundLinkFilled>
</div>
Expand Down
8 changes: 7 additions & 1 deletion src/components/BlogPopularArticles/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { graphql, useStaticQuery } from 'gatsby';
import Card from '../Grid/Card';
import Grid from '../Grid';
import { getSlugifiedText } from '../../../shared';

export const PopularArticles = () => {
const { popularArticles } = useStaticQuery(graphql`
Expand Down Expand Up @@ -68,7 +69,12 @@ export const PopularArticles = () => {
return (
<Grid>
{popularArticles?.nodes?.map((article: any) => (
<Card key={article.id} data={article} footerTag="Article" />
<Card
key={article.id}
data={article}
footerTag="Article"
linkId={`${getSlugifiedText(article.title)}-popular-article/blog-post-page`}
/>
))}
</Grid>
);
Expand Down
15 changes: 13 additions & 2 deletions src/components/BlogPost/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import ShareArticle from '../ShareArticle';
import { ProcessedPost } from '../BlogPostProcessor';
import BlogBanner from '../BlogBanner';
import ArticleSidebar from '../ArticleSidebar';
import { dashboardRegisterUrl, getAuthorPathBySlug } from '../../../shared';
import {
dashboardRegisterUrl,
getAuthorPathBySlug,
getSlugifiedText,
} from '../../../shared';
import Avatar from '../../components/Avatar';
import SocialLinks from '../../components/SocialLinks';
import OutboundLinkFilled from '../../components/LinksAndButtons/OutboundLinkFilled';
Expand Down Expand Up @@ -172,13 +176,15 @@ const BlogPost = ({
</h3>
}
button={{
id: 'build-a-pipeline-button/banner/blog-post-page',
title: 'Build a Pipeline',
href: dashboardRegisterUrl,
}}
/>
) : null}
</div>
<ArticleSidebar
ctaButtonid="build-a-pipeline-button/sidebar/blog-post-page"
article={{
title: post.title,
slug: post.slug,
Expand Down Expand Up @@ -226,6 +232,7 @@ const BlogPost = ({
<>
<div key={index} className={authorInfo}>
<Link
id={`${getSlugifiedText(author.name)}/about-section/blog-post-page`}
to={getAuthorPathBySlug(
author?.slug
)}
Expand Down Expand Up @@ -352,10 +359,14 @@ const BlogPost = ({
</div>
</div>
<div className={buildPipelineAndPricingButtons}>
<OutboundLinkFilled href={dashboardRegisterUrl}>
<OutboundLinkFilled
id="build-a-pipeline-button/streaming-pipelines-section/blog-post-page"
href={dashboardRegisterUrl}
>
Build a Pipeline
</OutboundLinkFilled>
<OutboundLinkOutlined
id="see-pricing-button/streaming-pipelines-section/blog-post-page"
href="https://estuary.dev/pricing/"
className={pricingLink}
>
Expand Down
6 changes: 5 additions & 1 deletion src/components/BlogPostCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ export const BlogPostCard = ({
publishedAt,
updatedAt,
}: BlogPostCardProps) => (
<Link to={`/${slug}`} className={blogsPostCard}>
<Link
id={`${slug}/blog-post-card`}
to={`/${slug}`}
className={blogsPostCard}
>
{hero ? (
<GatsbyImage
alt={title}
Expand Down
7 changes: 4 additions & 3 deletions src/components/Card/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ import ChevronRightIcon from '../../svgs/chevron-right.svg';
import OutboundLink from '../LinksAndButtons/OutboundLink';

interface LinkProps {
id?: string;
children: string;
href: string;
isExternal?: boolean;
}

const Link = ({ children, href, isExternal = false }: LinkProps) =>
const Link = ({ id, children, href, isExternal = false }: LinkProps) =>
isExternal ? (
<OutboundLink target="_blank" href={href}>
<OutboundLink id={id} target="_blank" href={href}>
{children}
<ChevronRightIcon color="var(--blue)" />
</OutboundLink>
) : (
<InternalLink href={href}>
<InternalLink id={id} href={href}>
{children}
<ChevronRightIcon color="var(--blue)" />
</InternalLink>
Expand Down
4 changes: 3 additions & 1 deletion src/components/CompanyUpdatesPage/Hero/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ const Hero = () => {
<HeroSectionDetails
title={<span>STAY CURRENT WITH ESTUARY FLOW</span>}
description="Stay informed and make the most of Flow's powerful capabilities."
ctaButtons={<HeroSectionActions />}
ctaButtons={
<HeroSectionActions pageId="company-updates-page" />
}
/>
<FlowDiagram
DiagramCardsClassName={diagramCardPositions}
Expand Down
5 changes: 4 additions & 1 deletion src/components/CompanyUpdatesPage/ListOfUpdates/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ const ListOfUpdates = () => {
<section className={defaultWrapperGrey}>
<Container isVertical className={container}>
<h2>THE LATEST PRODUCT UPDATES</h2>
<VerticalList items={companyUpdatePostsWithPrefixedSlugs} />
<VerticalList
items={companyUpdatePostsWithPrefixedSlugs}
pageId="company-updates-page"
/>
</Container>
</section>
);
Expand Down
1 change: 1 addition & 0 deletions src/components/CompanyUpdatesPage/StayUpdated/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const StayUpdated = () => {
<div className={linkedinCta}>
<p>Follow us on LinkedIn for frequent updates.</p>
<OutboundLinkOutlined
id="linkedin-follow-button/stay-updated-section/company-updates-page"
target="_blank"
href={estuaryLinkedinUrl}
aria-label="Estuary Linkedin Link"
Expand Down
4 changes: 2 additions & 2 deletions src/components/Connectors/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { GatsbyImage, StaticImage } from 'gatsby-plugin-image';
import { useMemo, useState } from 'react';
import { useLunr } from 'react-lunr';
import clsx from 'clsx';
import { ConnectorType } from '../../../shared';
import { ConnectorType, getSlugifiedText } from '../../../shared';
import FlowLogo from '../../svgs/flow-logo.svg';
import { normalizeConnector } from '../../utils';
import BigImageBackground from '../BackgroundImages/BigImageBackground';
Expand Down Expand Up @@ -66,7 +66,7 @@ const ConnectorCard = ({
type,
showType = false,
}: ReturnType<typeof normalizeConnector> & { showType?: boolean }) => (
<Link to={`${slug}`}>
<Link id={`${getSlugifiedText(title)}-link/connectors-page`} to={`${slug}`}>
<div className={connectorCard}>
<div className={connectorCardTop}>
<GatsbyImage
Expand Down
7 changes: 6 additions & 1 deletion src/components/DeploymentOptions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ interface DeploymentOptionsProps {
private: string[];
byoc: string[];
};
pageId: string;
}

const DeploymentOptions = ({
title,
buttonTitle,
optionsDescription,
keyFeatures,
pageId,
}: DeploymentOptionsProps) => {
const [selectedTab, setSelectedTab] = useState<DeploymentOption>('public');

Expand Down Expand Up @@ -64,7 +66,10 @@ const DeploymentOptions = ({
keyFeatures={keyFeatures?.byoc}
/>
</TabContext>
<LinkFilled href="/deployment-options/">
<LinkFilled
id={`button/deployment-options-section/${pageId}`}
href="/deployment-options/"
>
{buttonTitle}
</LinkFilled>
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/components/DeploymentOptionsPage/Hero/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const Hero = () => {
requirements. This section provides a high-level
overview and comparison of Public Deployment, Private
Deployment, and BYOC options."
ctaButtons={<HeroSectionActions />}
ctaButtons={
<HeroSectionActions pageId="deployment-options-page" />
}
/>
<div className={rightColumn}>
<StaticImage
Expand Down
30 changes: 30 additions & 0 deletions src/components/DiagramConnectors/ConnectorLink/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Link } from 'gatsby';
import { ReactNode } from 'react';
import { connector, logoWrapper } from '../styles.module.less';

interface ConnectorLinkProps {
connectorId: string;
to: string;
image: ReactNode;
connectorName: string;
}

const ConnectorLink = ({
connectorId,
to,
image,
connectorName,
}: ConnectorLinkProps) => {
return (
<Link
id={`${connectorId}-connector-button/how-it-works-section/product-page`}
className={connector}
to={to}
>
<div className={logoWrapper}>{image}</div>
<span>{connectorName}</span>
</Link>
);
};

export default ConnectorLink;
Loading
Loading