@@ -9,41 +9,33 @@ import {
99} from 'react' ;
1010
1111import { SlashIcon } from '../../../icons/SlashIcon' ;
12- import {
13- BaseProps ,
14- CONTAINER_STYLES ,
15- ContainerStyleProps ,
16- extractStyles ,
17- filterBaseProps ,
18- tasty ,
19- } from '../../../tasty' ;
12+ import { tasty } from '../../../tasty' ;
2013import { Link } from '../../actions/Link/Link' ;
2114import { Text } from '../Text' ;
2215import { useAutoTooltip } from '../use-auto-tooltip' ;
2316
24- import { LayoutContextReset } from './LayoutContext ' ;
17+ import { CubeLayoutContentProps , LayoutContent } from './LayoutContent ' ;
2518
26- const HeaderElement = tasty ( {
19+ const HeaderElement = tasty ( LayoutContent , {
2720 as : 'header' ,
2821 qa : 'LayoutHeader' ,
2922 styles : {
30- display : 'grid' ,
31- gridTemplate : `
32- "breadcrumbs breadcrumbs breadcrumbs" auto
33- "title suffix extra" 1fr
34- "subtitle subtitle extra" auto
35- / max-content 1fr minmax(0, auto)
36- ` ,
37- gap : 0 ,
38- padding : '($content-padding, 1x)' ,
3923 border : 'bottom' ,
40- width : '100%' ,
41- overflow : 'hidden' ,
42- boxSizing : 'border-box' ,
43- placeContent : 'stretch' ,
44- placeItems : 'center stretch' ,
4524 flexShrink : 0 ,
4625
26+ Inner : {
27+ display : 'grid' ,
28+ gridTemplate : `
29+ "breadcrumbs breadcrumbs breadcrumbs" auto
30+ "title suffix extra" 1fr
31+ "subtitle subtitle extra" auto
32+ / max-content 1fr minmax(0, auto)
33+ ` ,
34+ gap : 0 ,
35+ placeContent : 'stretch' ,
36+ placeItems : 'center stretch' ,
37+ } ,
38+
4739 Breadcrumbs : {
4840 gridArea : 'breadcrumbs' ,
4941 display : 'flex' ,
@@ -95,7 +87,7 @@ const HeaderElement = tasty({
9587 } ,
9688} ) ;
9789
98- export interface CubeLayoutHeaderProps extends BaseProps , ContainerStyleProps {
90+ export interface CubeLayoutHeaderProps extends CubeLayoutContentProps {
9991 /** Page/section title */
10092 title ?: ReactNode ;
10193 /** Title heading level (1-6) */
@@ -111,12 +103,11 @@ export interface CubeLayoutHeaderProps extends BaseProps, ContainerStyleProps {
111103 * Uses Link component which integrates with the navigation provider.
112104 */
113105 breadcrumbs ?: Array < [ label : string , href : string ] > ;
114- children ?: ReactNode ;
115106}
116107
117108function LayoutHeader (
118109 props : CubeLayoutHeaderProps ,
119- ref : ForwardedRef < HTMLElement > ,
110+ ref : ForwardedRef < HTMLDivElement > ,
120111) {
121112 const {
122113 title,
@@ -125,13 +116,12 @@ function LayoutHeader(
125116 extra,
126117 subtitle,
127118 breadcrumbs,
119+ scrollbar = 'tiny' ,
128120 children,
129121 mods,
130122 ...otherProps
131123 } = props ;
132124
133- const styles = extractStyles ( otherProps , CONTAINER_STYLES ) ;
134-
135125 // Use auto tooltip for title overflow detection
136126 const { labelRef, renderWithTooltip } = useAutoTooltip ( {
137127 tooltip : true ,
@@ -178,19 +168,17 @@ function LayoutHeader(
178168
179169 return (
180170 < HeaderElement
171+ { ...otherProps }
181172 ref = { ref }
182- { ...filterBaseProps ( otherProps , { eventProps : true } ) }
183173 mods = { { ...mods , level } }
184- styles = { styles }
174+ scrollbar = { scrollbar }
185175 >
186- < LayoutContextReset >
187- { renderBreadcrumbs ( ) }
188- { renderWithTooltip ( renderTitle , 'bottom' ) }
189- { suffix && < div data-element = "Suffix" > { suffix } </ div > }
190- { extra && < div data-element = "Extra" > { extra } </ div > }
191- { subtitle && < div data-element = "Subtitle" > { subtitle } </ div > }
192- { children }
193- </ LayoutContextReset >
176+ { renderBreadcrumbs ( ) }
177+ { renderWithTooltip ( renderTitle , 'bottom' ) }
178+ { suffix && < div data-element = "Suffix" > { suffix } </ div > }
179+ { extra && < div data-element = "Extra" > { extra } </ div > }
180+ { subtitle && < div data-element = "Subtitle" > { subtitle } </ div > }
181+ { children }
194182 </ HeaderElement >
195183 ) ;
196184}
0 commit comments