Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion src/community/__stories__/blocks-story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,10 @@ type HighlightedValueBlockArgs = {

secondaryValue: string;

pretitle: string;
title: string;
description: string;
strikedValue: string;
};

export const BlockHighlightedValue: StoryComponent<HighlightedValueBlockArgs> = ({
Expand All @@ -143,16 +145,20 @@ export const BlockHighlightedValue: StoryComponent<HighlightedValueBlockArgs> =
value,
text,
secondaryValue,
pretitle,
title,
description,
strikedValue,
}) => {
return (
<ResponsiveLayout>
<Box paddingY={24} dataAttributes={{testid: 'highlighted-value-block'}}>
<HighlightedValueBlock
headline={<Tag type={headlineType}>{headline}</Tag>}
pretitle={pretitle}
title={title}
description={description}
strikedValue={strikedValue}
headings={[
{value, text},
{value: secondaryValue, valueColor: vars.colors.textSecondary},
Expand All @@ -167,8 +173,10 @@ BlockHighlightedValue.storyName = 'HighlightedValueBlock';
BlockHighlightedValue.args = {
headline: 'Priority',
headlineType: 'promo',
text: 'text',
pretitle: 'Pretitle',
strikedValue: 'striked Value',
value: '20',
text: 'text',
secondaryValue: '20',
title: 'title',
description: 'description',
Expand Down
13 changes: 12 additions & 1 deletion src/community/blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,21 +160,32 @@ interface HighlightedValueBlockProps {
headline?: RendersNullableElement<typeof Tag>;
headings?: ReadonlyArray<Heading>;
title?: string;
pretitle?: string;
description?: ReadonlyArray<string> | string;
strikedValue?: string;
'aria-label'?: string;
}

export const HighlightedValueBlock = ({
headline,
headings,
title,
pretitle,
description,
strikedValue,
'aria-label': ariaLabel,
}: HighlightedValueBlockProps): JSX.Element => {
return (
<div aria-label={ariaLabel}>
{headline && <Box paddingBottom={24}>{headline}</Box>}

<Stack space={2}>
{pretitle && <Text2 regular>{pretitle}</Text2>}
{strikedValue && (
<Text2 regular color={vars.colors.textSecondary} decoration="line-through">
{strikedValue}
</Text2>
)}
</Stack>
{headings && (
<Stack space={2}>
{headings.map((heading, index) => (
Expand Down
Loading