Skip to content

Commit 8cab17c

Browse files
author
Kubit
committed
Include titleComponent prop to Drawer component
1 parent 7181b4f commit 8cab17c

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/components/drawer/drawerStandAlone.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,18 @@ import {
1414
DrawerTitleContentFooterContainerStyled,
1515
DrawerTitleStyled,
1616
} from './drawer.styled';
17-
import { DrawerTitleComponentType, IDrawerStandAlone } from './types';
17+
import { IDrawerStandAlone } from './types';
1818

1919
const DrawerStandAloneComponent = (
20-
{ blocked = false, scrollableRef, shadowRef, footerRef, contentRef, ...props }: IDrawerStandAlone,
20+
{
21+
blocked = false,
22+
scrollableRef,
23+
shadowRef,
24+
footerRef,
25+
contentRef,
26+
titleComponent = TextComponentType.H3,
27+
...props
28+
}: IDrawerStandAlone,
2129
ref: React.ForwardedRef<HTMLDivElement> | undefined | null
2230
): JSX.Element => {
2331
const uniqueTitleId = useId('drawer-title');
@@ -59,7 +67,7 @@ const DrawerStandAloneComponent = (
5967
<DrawerTitleStyled
6068
ref={shadowRef}
6169
as={Text as unknown as React.ElementType}
62-
component={DrawerTitleComponentType.H3 as unknown as TextComponentType}
70+
component={titleComponent as unknown as TextComponentType}
6371
customTypography={props.styles.title}
6472
dataTestId={`${titleIdFinal}Title`}
6573
id={titleIdFinal}

src/components/drawer/types/drawer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ReactNode } from 'react';
33
import { IElementOrIcon } from '@/components/elementOrIcon';
44
import { IFooter } from '@/components/footer';
55
import { IPopoverControlled } from '@/components/popover';
6-
import { IText } from '@/components/text';
6+
import { IText, TextComponentType } from '@/components/text';
77
import { CustomTokenTypes } from '@/types';
88
import { DeviceBreakpointsType } from '@/types/breakpoints';
99

@@ -27,6 +27,7 @@ export interface IDrawerStandAlone {
2727
footer?: DrawerFooterType;
2828
closeIcon?: IElementOrIcon;
2929
title?: DrawerTextType;
30+
titleComponent?: TextComponentType | string;
3031
open: boolean;
3132
level: DrawerLevelPositionTypes;
3233
dataTestId?: string;

0 commit comments

Comments
 (0)