Skip to content

Commit

Permalink
Merge pull request #11300 from bbc/live-label-primitive
Browse files Browse the repository at this point in the history
Moves live label text and pulse to primitive components
  • Loading branch information
HarveyPeachey authored Jan 13, 2025
2 parents 82706e5 + 98deaef commit f31f9fa
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 17 deletions.
9 changes: 5 additions & 4 deletions src/app/components/Billboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import useViewTracker from '#app/hooks/useViewTracker';
import useClickTrackerHandler from '#app/hooks/useClickTrackerHandler';
import { EventTrackingMetadata } from '#app/models/types/eventTracking';
import Heading from '../Heading';
import LiveLabel from '../LiveLabel';
import MaskedImage from '../MaskedImage';
import styles from './index.styles';
import Text from '../Text';
import LivePulse from '../LivePulse';
import LiveText from '../LiveText';

interface BillboardProps {
heading: string;
Expand Down Expand Up @@ -60,14 +61,14 @@ const Billboard = forwardRef(
>
{showLiveLabel ? (
<div data-testid="billboard-live-label">
<LiveLabel.Pulse
<LivePulse
width="24"
height="24"
css={styles.liveLabelPulse}
/>
<LiveLabel.Text css={styles.liveLabelText}>
<LiveText css={styles.liveLabelText}>
<div>{heading}</div>
</LiveLabel.Text>
</LiveText>
</div>
) : (
heading
Expand Down
7 changes: 2 additions & 5 deletions src/app/components/LiveLabel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import React, { PropsWithChildren } from 'react';
import { jsx } from '@emotion/react';
import { LiveLabelProps } from './types';
import styles from './index.styles';
import Text from './Text';
import Pulse from './Pulse';
import Text from '../LiveText';
import Pulse from '../LivePulse';

const LiveLabel = ({
lang = 'en-GB',
Expand All @@ -29,7 +29,4 @@ const LiveLabel = ({
);
};

LiveLabel.Text = Text;
LiveLabel.Pulse = Pulse;

export default LiveLabel;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { PropsWithChildren } from 'react';
import { jsx } from '@emotion/react';
import styles from './index.styles';
import { PulseProps } from '../types';
import { PulseProps } from '../LiveLabel/types';

const Pulse = ({ className, width, height }: PropsWithChildren<PulseProps>) => {
return (
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/** @jsx jsx */
import { PropsWithChildren, useContext } from 'react';
import { jsx } from '@emotion/react';
import VisuallyHiddenText from '../../VisuallyHiddenText';
import { ServiceContext } from '../../../contexts/ServiceContext';
import VisuallyHiddenText from '../VisuallyHiddenText';
import { ServiceContext } from '../../contexts/ServiceContext';
import styles from './index.styles';
import { TextProps } from '../types';
import { TextProps } from '../LiveLabel/types';

const Text = ({
lang = 'en-GB',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { PropsWithChildren } from 'react';
import { jsx } from '@emotion/react';
import { LiveLabelProps } from '#app/components/LiveLabel/types';
import LiveLabel from '#app/components/LiveLabel';
import LivePulse from '#app/components/LivePulse';
import LiveText from '#app/components/LiveText';
import styles from './index.styles';

interface LiveLabelPromoProps extends LiveLabelProps {
Expand All @@ -19,13 +20,13 @@ const LiveLabelHeader = ({
}: PropsWithChildren<LiveLabelPromoProps>) => {
return (
<div data-testid="live-label">
<LiveLabel.Pulse
<LivePulse
className={className}
width="24"
height="24"
css={styles.liveLabelPulse}
/>
<LiveLabel.Text
<LiveText
lang={lang}
id={id}
offScreenText={offScreenText}
Expand All @@ -36,7 +37,7 @@ const LiveLabelHeader = ({
}
>
{children}
</LiveLabel.Text>
</LiveText>
</div>
);
};
Expand Down

0 comments on commit f31f9fa

Please sign in to comment.