Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #340 from deriv-com/Jia/update-block-wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
prince-deriv authored Mar 7, 2024
2 parents e5fc9d3 + e99ec02 commit 9a67efe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion libs/blocks/src/lib/block-wrapper/block-wrapper.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ describe('ContentText', () => {
const { container, queryByText } = render(
<BlockWrapper
title="Title goes here"
color="light"
description="Description goes here"
className="py-general-4xl"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const Default: Story = {
},
};

export const BloclWrapperWithContent: Story = {
export const BlockWrapperWithContent: Story = {
args: {
title: 'Title goes here',
description: 'Description goes here',
Expand Down
8 changes: 6 additions & 2 deletions libs/blocks/src/lib/block-wrapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const bgColorVariantClass: { [key in BgVariant]: string } = {
gray: 'bg-background-primary-base',
};
export interface BlockWrapperProps {
heading?: 'H2' | 'H1';
title?: ReactNode;
description?: ReactNode;
className?: string;
Expand All @@ -22,12 +23,15 @@ export interface BlockWrapperProps {
}

export const BlockWrapper = ({
heading = 'H2',
title,
description,
className,
background = 'light',
children,
}: BlockWrapperProps) => {
const HeaderComponent = Heading[heading];

return (
<Section
className={qtMerge(
Expand All @@ -39,9 +43,9 @@ export const BlockWrapper = ({
>
<FluidContainer className="flex flex-col items-center gap-gap-lg">
{title && (
<Heading.H2 className="text-center lg:max-w-[816px]">
<HeaderComponent className="text-center lg:max-w-[816px]">
{title}
</Heading.H2>
</HeaderComponent>
)}
{description && <Text className="text-center">{description}</Text>}
</FluidContainer>
Expand Down

0 comments on commit 9a67efe

Please sign in to comment.