Skip to content

Commit

Permalink
DS-853 | Add id options to 10 storyblok components; update CtaLink (#339
Browse files Browse the repository at this point in the history
)

* add id options to 10 storyblok components

* linter

* If cached_url is "home" set it to ""
  • Loading branch information
yvonnetangsu committed Sep 4, 2024
1 parent bdf5da1 commit 926a1bc
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 1 deletion.
4 changes: 4 additions & 0 deletions components/Cta/CtaLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export const CtaLink = React.forwardRef<HTMLAnchorElement, CtaLinkProps>(
if (isInternal) {
myLink = cachedUrl || href;

if (myLink === 'home') {
myLink = '';
}

if (!myLink?.startsWith('/')) {
myLink = `/${myLink}`;
}
Expand Down
2 changes: 1 addition & 1 deletion components/GAProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use client';
import { GoogleTagManager } from '@next/third-parties/google'
import { GoogleTagManager } from '@next/third-parties/google';
import { useEffect } from 'react';
import useUTMs from '@/hooks/useUTMs';
const GTM_ID = 'GTM-5RGQ5DD';
Expand Down
3 changes: 3 additions & 0 deletions components/Storyblok/SbBasicCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { type SbImageType } from './Storyblok.types';
export type SbBasicCardProps = {
blok: {
_uid: string;
id: string;
superhead?: string;
heading?: string;
headingLevel?: HeadingType;
Expand All @@ -35,6 +36,7 @@ export type SbBasicCardProps = {

export const SbBasicCard = ({
blok: {
id,
superhead,
heading,
headingLevel,
Expand Down Expand Up @@ -66,6 +68,7 @@ export const SbBasicCard = ({
return (
<BasicCard
{...storyblokEditable(blok)}
id={id}
superhead={superhead}
heading={heading}
headingLevel={headingLevel || 'h3'}
Expand Down
3 changes: 3 additions & 0 deletions components/Storyblok/SbEmbedMedia.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { RichText } from '../RichText';
type SbEmbedMediaProps = {
blok: {
_uid: string;
id: string;
mediaUrl: string;
caption?: StoryblokRichtext;
aspectRatio?: MediaAspectRatioType;
Expand All @@ -27,6 +28,7 @@ type SbEmbedMediaProps = {

export const SbEmbedMedia = ({
blok: {
id,
mediaUrl,
caption,
aspectRatio,
Expand All @@ -51,6 +53,7 @@ export const SbEmbedMedia = ({
return (
<EmbedMedia
{...storyblokEditable(blok)}
id={id}
mediaUrl={mediaUrl}
caption={Caption}
aspectRatio={aspectRatio}
Expand Down
3 changes: 3 additions & 0 deletions components/Storyblok/SbEventBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { type GradientFromType, type GradientToType, type GradientViaType } from
type SbEventBannerProps = {
blok: {
_uid: string;
id: string;
heading?: string;
body: StoryblokRichtext;
startDate?: string;
Expand All @@ -34,6 +35,7 @@ type SbEventBannerProps = {

export const SbEventBanner = ({
blok: {
id,
heading,
body,
startDate,
Expand Down Expand Up @@ -65,6 +67,7 @@ export const SbEventBanner = ({
return (
<EventBanner
{...storyblokEditable(blok)}
id={id}
heading={heading}
body={Body}
startDate={startDate}
Expand Down
3 changes: 3 additions & 0 deletions components/Storyblok/SbGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { type PaddingType, type MarginType } from '@/utilities/datasource';
type SbGridProps = {
blok: {
_uid: string;
id: string;
// Turn grid into <ul> and items into <li>
isList?: boolean;
gap?: GridGapType;
Expand Down Expand Up @@ -35,6 +36,7 @@ type SbGridProps = {

export const SbGrid = ({
blok: {
id,
isList,
gap,
boundingWidth = 'full',
Expand Down Expand Up @@ -63,6 +65,7 @@ export const SbGrid = ({
return (
<WidthBox
{...storyblokEditable(blok)}
id={id}
boundingWidth={boundingWidth}
width={width}
align={align}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { getNumBloks } from '@/utilities/getNumBloks';
type SbHomepageThemeSectionProps = {
blok: {
_uid: string;
id: string;
superhead?: string;
heading?: string;
intro?: StoryblokRichtext;
Expand All @@ -43,6 +44,7 @@ type SbHomepageThemeSectionProps = {

export const SbHomepageThemeSection = ({
blok: {
id,
superhead,
heading,
intro,
Expand All @@ -66,6 +68,7 @@ export const SbHomepageThemeSection = ({

return (
<Container
id={id}
as="section"
bgColor={isDarkTheme ? 'black' : 'white'}
py={10}
Expand Down
3 changes: 3 additions & 0 deletions components/Storyblok/SbScrollytelling.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { type MarginType } from '@/utilities/datasource';
type SbScrollytellingProps = {
blok: {
_uid: string;
id: string;
heading?: string;
headingLevel?: HeadingType;
subheading?: string;
Expand All @@ -34,6 +35,7 @@ type SbScrollytellingProps = {

export const SbScrollytelling = ({
blok: {
id,
heading,
headingLevel,
subheading,
Expand All @@ -59,6 +61,7 @@ export const SbScrollytelling = ({
return (
<Scrollytelling
{...storyblokEditable(blok)}
id={id}
heading={heading}
headingLevel={headingLevel}
subheading={subheading}
Expand Down
3 changes: 3 additions & 0 deletions components/Storyblok/SbSection/SbSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import * as styles from './SbSection.styles';
type SbSectionProps = {
blok: {
_uid: string;
id?: string;
content?: SbBlokData[];
superhead?: string;
heading?: string;
Expand Down Expand Up @@ -71,6 +72,7 @@ type SbSectionProps = {

export const SbSection = ({
blok: {
id,
content,
superhead,
heading,
Expand Down Expand Up @@ -139,6 +141,7 @@ export const SbSection = ({

return (
<Container
id={id}
as={!!heading ? 'section' : 'div'}
width="full"
mt={marginTop}
Expand Down
3 changes: 3 additions & 0 deletions components/Storyblok/SbSidebarCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { getNumBloks } from '@/utilities/getNumBloks';
export type SbSidebarCardProps = {
blok: {
_uid: string;
id: string;
heading?: string;
headingLevel?: HeadingType;
isSmallHeading?: boolean;
Expand All @@ -30,6 +31,7 @@ export type SbSidebarCardProps = {

export const SbSidebarCard = ({
blok: {
id,
heading,
headingLevel,
isSmallHeading,
Expand All @@ -51,6 +53,7 @@ export const SbSidebarCard = ({
return (
<SidebarCard
{...storyblokEditable(blok)}
id={id}
heading={heading}
headingLevel={headingLevel}
isSmallHeading={isSmallHeading}
Expand Down
3 changes: 3 additions & 0 deletions components/Storyblok/SbText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
export type SbTextProps = {
blok: {
_uid: string;
id: string;
text: string;
color?: TextColorType;
headingLevel?: HeadingType;
Expand All @@ -42,6 +43,7 @@ export type SbTextProps = {

export const SbText = ({
blok: {
id,
text,
color,
headingLevel,
Expand All @@ -67,6 +69,7 @@ export const SbText = ({
}: SbTextProps) => (
<AnimateInView {...storyblokEditable(blok)} animation={animation} delay={delay}>
<WidthBox
id={id}
boundingWidth={boundingWidth}
width={width}
mt={marginTop}
Expand Down
3 changes: 3 additions & 0 deletions components/Storyblok/SbWysiwyg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { type PaddingType } from '@/utilities/datasource';
type SbWysiwygProps = {
blok: {
_uid: string;
id: string;
content: StoryblokRichtext;
// TODO: I might remove this option and just pass down the color from the parent
isLightText?: boolean;
Expand All @@ -25,6 +26,7 @@ type SbWysiwygProps = {

export const SbWysiwyg = ({
blok: {
id,
content,
isLightText,
textAlign,
Expand All @@ -46,6 +48,7 @@ export const SbWysiwyg = ({
return (
<WidthBox
{...storyblokEditable(blok)}
id={id}
boundingWidth={boundingWidth}
width={width}
pt={spacingTop}
Expand Down

0 comments on commit 926a1bc

Please sign in to comment.