Skip to content

Commit 4cdc95f

Browse files
mattobeeCopilot
andcommitted
Restore Header + Pane, add ViewHeader for in-content title
- Header (top-of-page) wraps PageLayout.Header again - Pane (sidebar) renamed back from Sidebar to match PageLayout vocab - ViewHeader is the in-content title + actions row (was Header) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 82e5705 commit 4cdc95f

4 files changed

Lines changed: 59 additions & 32 deletions

File tree

packages/react/src/FilteredListLayout/FilteredListLayout.docs.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,25 @@
1616
],
1717
"subcomponents": [
1818
{
19-
"name": "FilteredListLayout.Sidebar",
19+
"name": "FilteredListLayout.Header",
20+
"props": []
21+
},
22+
{
23+
"name": "FilteredListLayout.Pane",
2024
"props": []
2125
},
2226
{
2327
"name": "FilteredListLayout.Content",
2428
"props": []
2529
},
2630
{
27-
"name": "FilteredListLayout.Header",
31+
"name": "FilteredListLayout.ViewHeader",
2832
"props": [
2933
{
3034
"name": "title",
3135
"type": "React.ReactNode",
3236
"required": true,
33-
"description": "The page title rendered as an h2."
37+
"description": "The view title rendered as an h2."
3438
},
3539
{
3640
"name": "actions",

packages/react/src/FilteredListLayout/FilteredListLayout.stories.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ export default {
1414

1515
export const Default: StoryFn = () => (
1616
<FilteredListLayout>
17-
<FilteredListLayout.Sidebar position="start" aria-label="Sidebar">
18-
<Placeholder label="Sidebar" height={400} />
19-
</FilteredListLayout.Sidebar>
17+
<FilteredListLayout.Header>
18+
<Placeholder label="Header" height={64} />
19+
</FilteredListLayout.Header>
20+
<FilteredListLayout.Pane position="start" aria-label="Sidebar">
21+
<Placeholder label="Pane" height={400} />
22+
</FilteredListLayout.Pane>
2023
<FilteredListLayout.Content>
21-
<FilteredListLayout.Header
24+
<FilteredListLayout.ViewHeader
2225
title="Assigned to you"
2326
actions={
2427
<>

packages/react/src/FilteredListLayout/FilteredListLayout.tsx

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import type React from 'react'
22
import Heading from '../Heading'
3-
import type {PageLayoutContentProps, PageLayoutFooterProps, PageLayoutPaneProps} from '../PageLayout'
3+
import type {
4+
PageLayoutContentProps,
5+
PageLayoutFooterProps,
6+
PageLayoutHeaderProps,
7+
PageLayoutPaneProps,
8+
} from '../PageLayout'
49
import {PageLayout} from '../PageLayout'
510

611
// ----------------------------------------------------------------------------
@@ -24,6 +29,7 @@ export const Root: React.FC<React.PropsWithChildren<FilteredListLayoutProps>> =
2429
columnGap="none"
2530
rowGap="none"
2631
_slotsConfig={{
32+
header: Header,
2733
footer: Footer,
2834
}}
2935
{...props}
@@ -34,32 +40,44 @@ export const Root: React.FC<React.PropsWithChildren<FilteredListLayoutProps>> =
3440
Root.displayName = 'FilteredListLayout'
3541

3642
// ----------------------------------------------------------------------------
37-
// FilteredListLayout.Sidebar
43+
// FilteredListLayout.Header
44+
//
45+
// Top-of-page header row. Wraps PageLayout.Header. Use for the global page
46+
// header (e.g. breadcrumbs, page-level title). Optional — not all filtered
47+
// list pages need a top header above the sidebar/content split.
48+
49+
export type FilteredListLayoutHeaderProps = PageLayoutHeaderProps
50+
51+
export const Header: React.FC<React.PropsWithChildren<FilteredListLayoutHeaderProps>> = ({
52+
padding = 'normal',
53+
divider = 'line',
54+
...props
55+
}) => {
56+
// eslint-disable-next-line primer-react/direct-slot-children
57+
return <PageLayout.Header padding={padding} divider={divider} {...props} />
58+
}
59+
60+
Header.displayName = 'FilteredListLayout.Header'
61+
62+
// ----------------------------------------------------------------------------
63+
// FilteredListLayout.Pane
3864
//
3965
// Wraps PageLayout.Pane with defaults appropriate for a filtered-list sidebar.
4066
// Future: hide affordance at the bottom (per epic #2156 DoD).
4167

42-
export type FilteredListLayoutSidebarProps = PageLayoutPaneProps
68+
export type FilteredListLayoutPaneProps = PageLayoutPaneProps
4369

44-
export const Sidebar: React.FC<React.PropsWithChildren<FilteredListLayoutSidebarProps>> = ({
70+
export const Pane: React.FC<React.PropsWithChildren<FilteredListLayoutPaneProps>> = ({
4571
position = 'start',
4672
sticky = true,
4773
padding = 'normal',
4874
divider = 'line',
4975
...props
5076
}) => {
51-
return (
52-
<PageLayout.Pane
53-
position={position}
54-
sticky={sticky}
55-
padding={padding}
56-
divider={divider}
57-
{...props}
58-
/>
59-
)
77+
return <PageLayout.Pane position={position} sticky={sticky} padding={padding} divider={divider} {...props} />
6078
}
6179

62-
Sidebar.displayName = 'FilteredListLayout.Sidebar'
80+
Pane.displayName = 'FilteredListLayout.Pane'
6381

6482
// ----------------------------------------------------------------------------
6583
// FilteredListLayout.Content
@@ -80,20 +98,20 @@ export const Content: React.FC<React.PropsWithChildren<FilteredListLayoutContent
8098
Content.displayName = 'FilteredListLayout.Content'
8199

82100
// ----------------------------------------------------------------------------
83-
// FilteredListLayout.Header
101+
// FilteredListLayout.ViewHeader
84102
//
85-
// Lives inside FilteredListLayout.Content as the top row: page title on the
103+
// Lives inside FilteredListLayout.Content as the top row: view title on the
86104
// left, primary action(s) on the right. Mirrors the Application template
87-
// pattern from github-ui (title is an h2 inside the content region, not the
88-
// global page title — that's PageLayout.Header territory and not used here).
105+
// pattern from github-ui (title is an h2 inside the content region, distinct
106+
// from the global page header above).
89107

90-
export type FilteredListLayoutHeaderProps = {
108+
export type FilteredListLayoutViewHeaderProps = {
91109
title: React.ReactNode
92110
actions?: React.ReactNode
93111
className?: string
94112
}
95113

96-
export const Header: React.FC<FilteredListLayoutHeaderProps> = ({title, actions, className}) => {
114+
export const ViewHeader: React.FC<FilteredListLayoutViewHeaderProps> = ({title, actions, className}) => {
97115
return (
98116
<div
99117
className={className}
@@ -115,7 +133,7 @@ export const Header: React.FC<FilteredListLayoutHeaderProps> = ({title, actions,
115133
)
116134
}
117135

118-
Header.displayName = 'FilteredListLayout.Header'
136+
ViewHeader.displayName = 'FilteredListLayout.ViewHeader'
119137

120138
// ----------------------------------------------------------------------------
121139
// FilteredListLayout.FilterBar
@@ -182,9 +200,10 @@ Footer.displayName = 'FilteredListLayout.Footer'
182200
// Export
183201

184202
export const FilteredListLayout = Object.assign(Root, {
185-
Sidebar,
186-
Content,
187203
Header,
204+
Pane,
205+
Content,
206+
ViewHeader,
188207
FilterBar,
189208
Results,
190209
Footer,

packages/react/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ export type {
2727
export {FilteredListLayout} from './FilteredListLayout'
2828
export type {
2929
FilteredListLayoutProps,
30-
FilteredListLayoutContentProps,
31-
FilteredListLayoutSidebarProps,
3230
FilteredListLayoutHeaderProps,
31+
FilteredListLayoutPaneProps,
32+
FilteredListLayoutContentProps,
33+
FilteredListLayoutViewHeaderProps,
3334
FilteredListLayoutFilterBarProps,
3435
FilteredListLayoutResultsProps,
3536
FilteredListLayoutFooterProps,

0 commit comments

Comments
 (0)