Skip to content

Commit

Permalink
add cta
Browse files Browse the repository at this point in the history
  • Loading branch information
jsladerman committed Oct 21, 2024
1 parent 9ad55e5 commit 8ea0a47
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 11 deletions.
5 changes: 0 additions & 5 deletions src/components/custom-page/CTA.tsx

This file was deleted.

38 changes: 38 additions & 0 deletions src/components/custom-page/CallToAction.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Button } from '@pluralsh/design-system'
import Link from 'next/link'

import { type CtaComponentFragment } from '@src/generated/graphqlDirectus'

import { cn } from '../cn'
import { Body1, Hero2 } from '../Typography'

import { getSpacingClassName } from './common'

export function CallToAction({
spacing,
heading,
body_text: bodyText,
cta_text: ctaText,
cta_url: ctaUrl,
}: CtaComponentFragment) {
return (
<section
className={cn(
getSpacingClassName(spacing),
'm-auto flex w-1/2 flex-col items-center gap-medium text-center'
)}
>
<Hero2>{heading}</Hero2>
<Body1 $color="text-light">{bodyText}</Body1>
<Button
className="mt-medium"
as={Link}
target="_blank"
rel="noopener noreferrer"
href={ctaUrl}
>
{ctaText}
</Button>
</section>
)
}
2 changes: 1 addition & 1 deletion src/components/custom-page/SectionHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function SectionHeader({
<section
className={cn(
getSpacingClassName(spacing),
'm-auto flex w-1/2 flex-col items-center gap-medium'
'm-auto flex w-1/2 flex-col items-center gap-medium text-center'
)}
>
{overline && <OverlineLabel>{overline}</OverlineLabel>}
Expand Down
4 changes: 2 additions & 2 deletions src/components/custom-page/common.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type CustomPageFragment } from '@src/generated/graphqlDirectus'

import { BlogCards } from './BlogCards'
import { CallToAction } from './CallToAction'
import { Cards } from './Cards'
import { CTA } from './CTA'
import { CustomerQuote } from './CustomerQuote'
import { Hero } from './Hero'
import { LargeImage } from './LargeImage'
Expand Down Expand Up @@ -42,7 +42,7 @@ export function renderComponent(
case 'customer_quote':
return <CustomerQuote {...component} />
case 'cta':
return <CTA {...component} />
return <CallToAction {...component} />
default:
return null
}
Expand Down
30 changes: 27 additions & 3 deletions src/generated/graphqlDirectus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5369,8 +5369,12 @@ export type Create_Company_Logos_Input = {
};

export type Create_Cta_Input = {
body_text?: InputMaybe<Scalars['String']['input']>;
cta_text?: InputMaybe<Scalars['String']['input']>;
cta_url?: InputMaybe<Scalars['String']['input']>;
date_created?: InputMaybe<Scalars['Date']['input']>;
date_updated?: InputMaybe<Scalars['Date']['input']>;
heading?: InputMaybe<Scalars['String']['input']>;
id?: InputMaybe<Scalars['ID']['input']>;
spacing?: InputMaybe<Scalars['String']['input']>;
user_created?: InputMaybe<Create_Directus_Users_Input>;
Expand Down Expand Up @@ -5852,10 +5856,14 @@ export type Create_Team_Members_Input = {

export type Cta = {
__typename?: 'cta';
body_text?: Maybe<Scalars['String']['output']>;
cta_text?: Maybe<Scalars['String']['output']>;
cta_url?: Maybe<Scalars['String']['output']>;
date_created?: Maybe<Scalars['Date']['output']>;
date_created_func?: Maybe<Datetime_Functions>;
date_updated?: Maybe<Scalars['Date']['output']>;
date_updated_func?: Maybe<Datetime_Functions>;
heading?: Maybe<Scalars['String']['output']>;
id: Scalars['ID']['output'];
spacing?: Maybe<Scalars['String']['output']>;
user_created?: Maybe<Directus_Users>;
Expand Down Expand Up @@ -5898,8 +5906,12 @@ export type Cta_Aggregated = {

export type Cta_Aggregated_Count = {
__typename?: 'cta_aggregated_count';
body_text?: Maybe<Scalars['Int']['output']>;
cta_text?: Maybe<Scalars['Int']['output']>;
cta_url?: Maybe<Scalars['Int']['output']>;
date_created?: Maybe<Scalars['Int']['output']>;
date_updated?: Maybe<Scalars['Int']['output']>;
heading?: Maybe<Scalars['Int']['output']>;
id?: Maybe<Scalars['Int']['output']>;
spacing?: Maybe<Scalars['Int']['output']>;
user_created?: Maybe<Scalars['Int']['output']>;
Expand All @@ -5914,10 +5926,14 @@ export type Cta_Aggregated_Fields = {
export type Cta_Filter = {
_and?: InputMaybe<Array<InputMaybe<Cta_Filter>>>;
_or?: InputMaybe<Array<InputMaybe<Cta_Filter>>>;
body_text?: InputMaybe<String_Filter_Operators>;
cta_text?: InputMaybe<String_Filter_Operators>;
cta_url?: InputMaybe<String_Filter_Operators>;
date_created?: InputMaybe<Date_Filter_Operators>;
date_created_func?: InputMaybe<Datetime_Function_Filter_Operators>;
date_updated?: InputMaybe<Date_Filter_Operators>;
date_updated_func?: InputMaybe<Datetime_Function_Filter_Operators>;
heading?: InputMaybe<String_Filter_Operators>;
id?: InputMaybe<Number_Filter_Operators>;
spacing?: InputMaybe<String_Filter_Operators>;
user_created?: InputMaybe<Directus_Users_Filter>;
Expand Down Expand Up @@ -9385,8 +9401,12 @@ export type Update_Company_Logos_Input = {
};

export type Update_Cta_Input = {
body_text?: InputMaybe<Scalars['String']['input']>;
cta_text?: InputMaybe<Scalars['String']['input']>;
cta_url?: InputMaybe<Scalars['String']['input']>;
date_created?: InputMaybe<Scalars['Date']['input']>;
date_updated?: InputMaybe<Scalars['Date']['input']>;
heading?: InputMaybe<Scalars['String']['input']>;
id?: InputMaybe<Scalars['ID']['input']>;
spacing?: InputMaybe<Scalars['String']['input']>;
user_created?: InputMaybe<Update_Directus_Users_Input>;
Expand Down Expand Up @@ -9968,7 +9988,7 @@ export type SolutionsQueryVariables = Exact<{

export type SolutionsQuery = { __typename?: 'Query', solutions_pages: Array<{ __typename?: 'solutions_pages', id: string, slug: string, title?: string | null, description?: string | null, upper_features_title?: string | null, lower_features_title?: string | null, download_section_title?: string | null, download_section_description?: string | null, upper_features?: Array<{ __typename?: 'solution_features', id: string, title?: string | null, description?: string | null, icon?: string | null, link_title?: string | null, link_url?: string | null } | null> | null, lower_features?: Array<{ __typename?: 'solution_features', id: string, title?: string | null, description?: string | null, icon?: string | null, link_title?: string | null, link_url?: string | null } | null> | null, problems?: Array<{ __typename?: 'solution_problems', id: string, title?: string | null, subtitle?: string | null, problem?: string | null, solution?: string | null } | null> | null, featured_quote?: { __typename?: 'quotes', id: string, quote?: string | null, author_text?: string | null } | null }> };

export type CustomPageFragment = { __typename?: 'custom_pages', id: string, slug: string, components?: Array<{ __typename?: 'custom_pages_components', collection?: string | null, item?: { __typename?: 'blog_cards', spacing?: string | null } | { __typename?: 'cards', spacing?: string | null } | { __typename?: 'cta', spacing?: string | null } | { __typename?: 'customer_quote', spacing?: string | null } | { __typename?: 'hero', spacing?: string | null, heading?: string | null, body_text?: string | null, media_type?: string | null, video_url?: string | null, form?: string | null, cta_text?: string | null, cta_url?: string | null, image?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null } | { __typename?: 'large_image', spacing?: string | null, overline?: string | null, heading?: string | null, body_text?: string | null, media_type?: string | null, video_url?: string | null, form?: string | null, cta_text?: string | null, cta_url?: string | null, image?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null } | { __typename?: 'logo_strip', spacing?: string | null, logo_list?: { __typename?: 'company_logo_lists', slug?: string | null, logos?: Array<{ __typename?: 'company_logo_lists_company_logos', company_logos_id?: { __typename?: 'company_logos', slug?: string | null, name: string, url?: string | null, logo_light?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null, logo_dark?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null } | null } | null> | null } | null } | { __typename?: 'rich_text_columns', spacing?: string | null } | { __typename?: 'section_header', spacing?: string | null, overline?: string | null, title?: string | null, description?: string | null } | null } | null> | null };
export type CustomPageFragment = { __typename?: 'custom_pages', id: string, slug: string, components?: Array<{ __typename?: 'custom_pages_components', collection?: string | null, item?: { __typename?: 'blog_cards', spacing?: string | null } | { __typename?: 'cards', spacing?: string | null } | { __typename?: 'cta', spacing?: string | null, heading?: string | null, body_text?: string | null, cta_text?: string | null, cta_url?: string | null } | { __typename?: 'customer_quote', spacing?: string | null } | { __typename?: 'hero', spacing?: string | null, heading?: string | null, body_text?: string | null, media_type?: string | null, video_url?: string | null, form?: string | null, cta_text?: string | null, cta_url?: string | null, image?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null } | { __typename?: 'large_image', spacing?: string | null, overline?: string | null, heading?: string | null, body_text?: string | null, media_type?: string | null, video_url?: string | null, form?: string | null, cta_text?: string | null, cta_url?: string | null, image?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null } | { __typename?: 'logo_strip', spacing?: string | null, logo_list?: { __typename?: 'company_logo_lists', slug?: string | null, logos?: Array<{ __typename?: 'company_logo_lists_company_logos', company_logos_id?: { __typename?: 'company_logos', slug?: string | null, name: string, url?: string | null, logo_light?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null, logo_dark?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null } | null } | null> | null } | null } | { __typename?: 'rich_text_columns', spacing?: string | null } | { __typename?: 'section_header', spacing?: string | null, overline?: string | null, title?: string | null, description?: string | null } | null } | null> | null };

export type CustomPageTinyFragment = { __typename?: 'custom_pages', id: string, slug: string };

Expand All @@ -9982,7 +10002,7 @@ export type CustomPageQueryVariables = Exact<{
}>;


export type CustomPageQuery = { __typename?: 'Query', custom_pages: Array<{ __typename?: 'custom_pages', id: string, slug: string, components?: Array<{ __typename?: 'custom_pages_components', collection?: string | null, item?: { __typename?: 'blog_cards', spacing?: string | null } | { __typename?: 'cards', spacing?: string | null } | { __typename?: 'cta', spacing?: string | null } | { __typename?: 'customer_quote', spacing?: string | null } | { __typename?: 'hero', spacing?: string | null, heading?: string | null, body_text?: string | null, media_type?: string | null, video_url?: string | null, form?: string | null, cta_text?: string | null, cta_url?: string | null, image?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null } | { __typename?: 'large_image', spacing?: string | null, overline?: string | null, heading?: string | null, body_text?: string | null, media_type?: string | null, video_url?: string | null, form?: string | null, cta_text?: string | null, cta_url?: string | null, image?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null } | { __typename?: 'logo_strip', spacing?: string | null, logo_list?: { __typename?: 'company_logo_lists', slug?: string | null, logos?: Array<{ __typename?: 'company_logo_lists_company_logos', company_logos_id?: { __typename?: 'company_logos', slug?: string | null, name: string, url?: string | null, logo_light?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null, logo_dark?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null } | null } | null> | null } | null } | { __typename?: 'rich_text_columns', spacing?: string | null } | { __typename?: 'section_header', spacing?: string | null, overline?: string | null, title?: string | null, description?: string | null } | null } | null> | null }> };
export type CustomPageQuery = { __typename?: 'Query', custom_pages: Array<{ __typename?: 'custom_pages', id: string, slug: string, components?: Array<{ __typename?: 'custom_pages_components', collection?: string | null, item?: { __typename?: 'blog_cards', spacing?: string | null } | { __typename?: 'cards', spacing?: string | null } | { __typename?: 'cta', spacing?: string | null, heading?: string | null, body_text?: string | null, cta_text?: string | null, cta_url?: string | null } | { __typename?: 'customer_quote', spacing?: string | null } | { __typename?: 'hero', spacing?: string | null, heading?: string | null, body_text?: string | null, media_type?: string | null, video_url?: string | null, form?: string | null, cta_text?: string | null, cta_url?: string | null, image?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null } | { __typename?: 'large_image', spacing?: string | null, overline?: string | null, heading?: string | null, body_text?: string | null, media_type?: string | null, video_url?: string | null, form?: string | null, cta_text?: string | null, cta_url?: string | null, image?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null } | { __typename?: 'logo_strip', spacing?: string | null, logo_list?: { __typename?: 'company_logo_lists', slug?: string | null, logos?: Array<{ __typename?: 'company_logo_lists_company_logos', company_logos_id?: { __typename?: 'company_logos', slug?: string | null, name: string, url?: string | null, logo_light?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null, logo_dark?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null } | null } | null> | null } | null } | { __typename?: 'rich_text_columns', spacing?: string | null } | { __typename?: 'section_header', spacing?: string | null, overline?: string | null, title?: string | null, description?: string | null } | null } | null> | null }> };

export type HeroComponentFragment = { __typename?: 'hero', spacing?: string | null, heading?: string | null, body_text?: string | null, media_type?: string | null, video_url?: string | null, form?: string | null, cta_text?: string | null, cta_url?: string | null, image?: { __typename?: 'directus_files', id: string, title?: string | null, description?: string | null, tags?: any | null, filename_disk?: string | null, filename_download: string, metadata?: any | null, type?: string | null, filesize?: any | null } | null };

Expand All @@ -10000,7 +10020,7 @@ export type RichTextColumnsComponentFragment = { __typename?: 'rich_text_columns

export type CustomerQuoteComponentFragment = { __typename?: 'customer_quote', spacing?: string | null };

export type CtaComponentFragment = { __typename?: 'cta', spacing?: string | null };
export type CtaComponentFragment = { __typename?: 'cta', spacing?: string | null, heading?: string | null, body_text?: string | null, cta_text?: string | null, cta_url?: string | null };

export type MinJobListingFragment = { __typename?: 'job_listings', id: string, slug: string, job_title?: string | null, department?: string | null, tags?: any | null, location?: string | null, status?: string | null };

Expand Down Expand Up @@ -10390,6 +10410,10 @@ export const CustomerQuoteComponentFragmentDoc = gql`
export const CtaComponentFragmentDoc = gql`
fragment CTAComponent on cta {
spacing
heading
body_text
cta_text
cta_url
}
`;
export const CustomPageFragmentDoc = gql`
Expand Down
4 changes: 4 additions & 0 deletions src/graph/directus/customPages.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,8 @@ fragment CustomerQuoteComponent on customer_quote {

fragment CTAComponent on cta {
spacing
heading
body_text
cta_text
cta_url
}

0 comments on commit 8ea0a47

Please sign in to comment.