Skip to content

Commit

Permalink
chore: add page header title wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyend-nam committed Dec 20, 2023
1 parent e6d422d commit 2a742e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/components/page-header/src/page-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,19 @@ const PageHeaderBackButton = forwardRef(({ className, ...props }, ref) => {

PageHeaderBackButton.displayName = 'PageHeaderBackButton'

const PageHeaderTitle = ({ children, className }: PageHeaderTitleProps) => {
const PageHeaderTitle = ({
children,
className,
wrapperClassName,
}: PageHeaderTitleProps) => {
const childNodes = Children.toArray(children)

const [title, ...restChild] = childNodes

return (
<div className={pageHeaderTitleWrapperClsx()}>
<div
className={pageHeaderTitleWrapperClsx({ className: wrapperClassName })}
>
{typeof title === 'string' ? (
<Typography
level="h5"
Expand Down
1 change: 1 addition & 0 deletions packages/components/page-header/src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type PolymorphicPageHeaderBackButton = Polymorphic.ForwardRefComponent<
export type PageHeaderTitleProps = {
children: ReactNode
className?: string
wrapperClassName?: string
}

export type PageHeaderTitleExtraProps = {
Expand Down

0 comments on commit 2a742e2

Please sign in to comment.