-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PBNTR-834] Advanced Table kit: Address scss changes and add maxHeigh…
…t prop (#4191) **What does this PR do?** A clear and concise description with your runway ticket url. [PBNTR-834](https://runway.powerhrg.com/backlog_items/PBNTR-834) enacts the plan set forward from the investigation in [PBNTR-769](https://runway.powerhrg.com/backlog_items/PBNTR-769). There were some unforeseen issues getting the overflow/appearance to work as expected for all possible table variants, and so doc examples have explicit usage/prop instructions. The existing "Table Props" doc example which has a sticky header already has been updated to showcase a sticky header on a nonresponsive table (whose functionality is unchanged with this PR); a new "Table Props Sticky Header" doc example showcases sticky header + responsiveness 1st column sticky working side by side in a smaller screen like the previous investigation desired. The header in large screen mode is sticky within the container - not sticky to the page but if rows are expanded past the given max height it will get an overflow-y scroll bar. **Screenshots:** Screenshots to visualize your addition/change <img width="1326" alt="for PR both doc ex" src="https://github.com/user-attachments/assets/5c16951e-34e3-40ed-9e6d-2ee671886211" /> <img width="1302" alt="nonresponsive table props doc ex" src="https://github.com/user-attachments/assets/980775c3-adaa-4224-9777-d89d6c16c34f" /> <img width="534" alt="responsive small screen doc ex" src="https://github.com/user-attachments/assets/d42f9e38-39a1-4f1f-b07b-1b3bb2b5822d" /> <img width="1313" alt="responsive large screen doc ex" src="https://github.com/user-attachments/assets/acf0754a-f613-4dbc-a4d0-b8594b84deb1" /> **How to test?** Steps to confirm the desired behavior: 1. Go to the [Table Props doc example](https://pr4191.playbook.beta.px.powerapp.cloud/kits/advanced_table/react#table-props) and scroll down the page to see the sticky header in action for a nonresponsive table. Do this on a large window and a smaller one. 2. Go to the [Table Props Sticky Header doc example(https://pr4191.playbook.beta.px.powerapp.cloud/kits/advanced_table/react#table-props-sticky-header). Expand at least 3 rows to activate the overflow-y based on the max height given to the table. On a large window, scroll up and down and see the sticky header for the container in action. Make the window smaller and see the sticky header and responsiveness first sticky column both work within the container of the table. #### Checklist: - [x] **LABELS** Add a label: `enhancement`, `bug`, `improvement`, `new kit`, `deprecated`, or `breaking`. See [Changelog & Labels](https://github.com/powerhome/playbook/wiki/Changelog-&-Labels) for details. - [x] **DEPLOY** I have added the `milano` label to show I'm ready for a review. ~~- [ ] **TESTS** I have added test coverage to my code.~~
- Loading branch information
1 parent
e087920
commit 40bdc6b
Showing
8 changed files
with
120 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...pp/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
This kit uses the [Table kit](https://playbook.powerapp.cloud/kits/table/react) under the hood which comes with it's own set of props. If you want to apply certain Table props to that underlying kit, you can do so by using the optional `tableProps` prop. This prop must be an object that contains valid Table props. For a full list of Table props, see [here](https://playbook.powerapp.cloud/kits/table/react). | ||
This kit uses the [Table kit](https://playbook.powerapp.cloud/kits/table/react) under the hood which comes with it's own set of props. If you want to apply certain Table props to that underlying kit, you can do so by using the optional `tableProps` prop. This prop must be an object that contains valid Table props. For a full list of Table props, see [here](https://playbook.powerapp.cloud/kits/table/react). | ||
|
||
This doc example showcases how to set a sticky header for a nonresponsive table. To achieve sticky header AND responsive functionality, see the ["Table Props Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table/react#table-props-sticky-header) doc example below. |
55 changes: 55 additions & 0 deletions
55
...app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from "react" | ||
import { AdvancedTable } from "playbook-ui" | ||
import MOCK_DATA from "./advanced_table_mock_data.json" | ||
|
||
const AdvancedTableTablePropsStickyHeader = (props) => { | ||
const columnDefinitions = [ | ||
{ | ||
accessor: "year", | ||
label: "Year", | ||
cellAccessors: ["quarter", "month", "day"], | ||
}, | ||
{ | ||
accessor: "newEnrollments", | ||
label: "New Enrollments", | ||
}, | ||
{ | ||
accessor: "scheduledMeetings", | ||
label: "Scheduled Meetings", | ||
}, | ||
{ | ||
accessor: "attendanceRate", | ||
label: "Attendance Rate", | ||
}, | ||
{ | ||
accessor: "completedClasses", | ||
label: "Completed Classes", | ||
}, | ||
{ | ||
accessor: "classCompletionRate", | ||
label: "Class Completion Rate", | ||
}, | ||
{ | ||
accessor: "graduatedStudents", | ||
label: "Graduated Students", | ||
}, | ||
] | ||
|
||
const tableProps = { | ||
sticky: true | ||
} | ||
|
||
return ( | ||
<div> | ||
<AdvancedTable | ||
columnDefinitions={columnDefinitions} | ||
maxHeight="xs" | ||
tableData={MOCK_DATA} | ||
tableProps={tableProps} | ||
{...props} | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
export default AdvancedTableTablePropsStickyHeader |
3 changes: 3 additions & 0 deletions
3
...ybook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and giving the AdvancedTable a `maxHeight` using our [Max Height](https://playbook.powerapp.cloud/visual_guidelines/max_height) global prop. This behavior requires a `maxHeight` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes. | ||
|
||
A sticky header on a nonresponsive table is demonstrated in the ["Table Props"](https://playbook.powerapp.cloud/kits/advanced_table/react#table-props) doc example above. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters