Skip to content

Commit

Permalink
Accessible headings; remove isSmallHeading prop
Browse files Browse the repository at this point in the history
  • Loading branch information
yvonnetangsu committed Mar 12, 2024
1 parent 7df2e00 commit 83eb366
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 5 additions & 2 deletions components/DataCard/DataCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import * as styles from './DataCard.styles';
export type DataCardProps = React.HTMLAttributes<HTMLDivElement> & {
heading?: string;
headingLevel?: HeadingType;
isSmallHeading?: boolean;
isDarkTheme?: boolean;
barColor?: AccentBorderColorType;
body?: React.ReactNode;
Expand All @@ -27,7 +26,6 @@ export type DataCardProps = React.HTMLAttributes<HTMLDivElement> & {
export const DataCard = ({
heading,
headingLevel = 'h3',
isSmallHeading,
barColor,
body,
cta,
Expand All @@ -53,13 +51,18 @@ export const DataCard = ({
{...props}
>
<FlexBox direction="col" className={styles.flex}>
{/* If number counter is enabled, aria-hidden the animated heading and add a SR only heading */}
{isCounter && heading && (
<Heading as={headingLevel} srOnly>{heading}</Heading>
)}
{heading && (
<Heading
as={headingLevel}
font="druk"
leading="druk"
color={isDarkTheme ? 'white' : 'black'}
size="f5"
aria-hidden={isCounter}
className={styles.heading}
>
{isCounter ? (
Expand Down
2 changes: 0 additions & 2 deletions components/Storyblok/SbDataCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export const SbDataCard = ({
blok: {
heading,
headingLevel,
isSmallHeading,
body,
cta,
paddingTop,
Expand All @@ -56,7 +55,6 @@ export const SbDataCard = ({
{...storyblokEditable(blok)}
heading={heading}
headingLevel={headingLevel}
isSmallHeading={isSmallHeading}
isDarkTheme={isDarkTheme}
isCounter={isCounter}
counterDuration={counterDuration}
Expand Down

0 comments on commit 83eb366

Please sign in to comment.