Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Create a new attribute named: showComplementaryCta as optional, typed as boolean on HeroProps interface:

    • path: ctg-components-library/src/components/hero/types.ts

      Code Block
      languagetypescript
      showComplementaryCta?: boolean;

  • We will change the complementaryCtaText attribute from required to optional:

    • path: ctg-components-library/src/components/hero/types.ts

      Code Block
      languagetypescript
      complementaryCtaText?: string;

  • On Hero component, we will:

    • add a new attribute on the destructuring of Hero attributes from default value true

      Code Block
      languagetypescript
      showComplementaryCta = true,
  • Now, we will do a validation of HeroComplementaryCta button:

    • before:

      Code Block
      languagetypescript
      <HeroComplementaryCta
          aria-describedby={ctaDescribedByIds}
          fullWidth={isMobile}
          reversed={isButtonReversed}
          children={complementaryCtaText}
          onClick={onClickComplementaryCta}
          href={complementaryCtaHref}
          as={complementaryCtaAs}
        />
    • after:

    Code Block
    languagetypescript
    {showComplementaryCta && complementaryCtaText && (
      <HeroComplementaryCta
        aria-describedby={ctaDescribedByIds}
        fullWidth={isMobile}
        reversed={isButtonReversed}
        children={complementaryCtaText}
        onClick={onClickComplementaryCta}
        href={complementaryCtaHref}
        as={complementaryCtaAs}
      />
    )}
  • We will need to do a change on hero.stories.tsx (storybook)

    • path: ctg-components-library/src/components/hero/hero.stories.tsx

...