Skip to content

Commit

Permalink
feat: added custom title render into header block (#664)
Browse files Browse the repository at this point in the history
* feat: added custom title block into header block

* feat: changed TitleBlock to renderTitle

* feat: changed renderTitle type

* feat: added title parameter to renderTitle function
  • Loading branch information
VitaliiDC8 authored Oct 27, 2023
1 parent f56cf69 commit 7d57714
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/blocks/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const HeaderBlock = (props: WithChildren<HeaderBlockFullProps>) => {
className,
breadcrumbs,
status,
renderTitle,
children,
mediaView = 'full',
} = props;
Expand Down Expand Up @@ -135,7 +136,7 @@ export const HeaderBlock = (props: WithChildren<HeaderBlockFullProps>) => {
)}
<h1 className={b('title')}>
{status}
<HTML>{title}</HTML>
{renderTitle ? renderTitle(title) : <HTML>{title}</HTML>}
</h1>
{description && (
<div className={b('description')}>
Expand Down
3 changes: 3 additions & 0 deletions src/models/constructor-items/blocks.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from 'react';

import {ButtonSize} from '@gravity-ui/uikit';

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

export interface ExtendedFeaturesItem
Expand Down

0 comments on commit 7d57714

Please sign in to comment.