Skip to content

Commit 7d57714

Browse files
authored
feat: added custom title render into header block (#664)
* feat: added custom title block into header block * feat: changed TitleBlock to renderTitle * feat: changed renderTitle type * feat: added title parameter to renderTitle function
1 parent f56cf69 commit 7d57714

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/blocks/Header/Header.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export const HeaderBlock = (props: WithChildren<HeaderBlockFullProps>) => {
7777
className,
7878
breadcrumbs,
7979
status,
80+
renderTitle,
8081
children,
8182
mediaView = 'full',
8283
} = props;
@@ -135,7 +136,7 @@ export const HeaderBlock = (props: WithChildren<HeaderBlockFullProps>) => {
135136
)}
136137
<h1 className={b('title')}>
137138
{status}
138-
<HTML>{title}</HTML>
139+
{renderTitle ? renderTitle(title) : <HTML>{title}</HTML>}
139140
</h1>
140141
{description && (
141142
<div className={b('description')}>

src/models/constructor-items/blocks.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import {ButtonSize} from '@gravity-ui/uikit';
24

35
import {GridColumnSize, GridColumnSizesType} from '../../grid/types';
@@ -154,6 +156,7 @@ export interface HeaderBlockProps {
154156
verticalOffset?: 's' | 'm' | 'l' | 'xl';
155157
breadcrumbs?: HeaderBreadCrumbsProps;
156158
status?: JSX.Element;
159+
renderTitle?: (title: string) => React.ReactNode;
157160
}
158161

159162
export interface ExtendedFeaturesItem

0 commit comments

Comments
 (0)