-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PBNTR-662] Create a "stickyRightcolumn" prop for the Table kit - REA…
…CT ONLY (#4051) **What does this PR do?** A clear and concise description with your runway ticket url. As a Playbook user, I want to create a "stickyRightcolumn" prop for our React Table kit, so that I can select any column on my table to make sticky. **Screenshots:** Screenshots to visualize your addition/change <img width="1099" alt="Screenshot 2024-12-23 at 10 30 08 AM" src="https://github.com/user-attachments/assets/817b3cea-3288-471f-afef-f1a710f6a98f" /> **How to test?** Steps to confirm the desired behavior: 1. Go to [Sticky Right Column](https://pr4051.playbook.beta.px.powerapp.cloud/kits/table/react#sticky-right-column) #### 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.
- Loading branch information
Showing
11 changed files
with
309 additions
and
42 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
88 changes: 88 additions & 0 deletions
88
playbook/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.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,88 @@ | ||
import React from 'react' | ||
import Table from '../_table' | ||
|
||
const TableStickyColumns = () => { | ||
return ( | ||
<Table | ||
responsive="scroll" | ||
size="md" | ||
stickyLeftColumn={["a"]} | ||
stickyRightColumn={["b"]} | ||
> | ||
<thead> | ||
<tr> | ||
<th id="a">{'Column 1'}</th> | ||
<th>{'Column 2'}</th> | ||
<th>{'Column 3'}</th> | ||
<th>{'Column 4'}</th> | ||
<th>{'Column 5'}</th> | ||
<th>{'Column 6'}</th> | ||
<th>{'Column 7'}</th> | ||
<th>{'Column 8'}</th> | ||
<th>{'Column 9'}</th> | ||
<th>{'Column 10'}</th> | ||
<th>{'Column 11'}</th> | ||
<th>{'Column 12'}</th> | ||
<th>{'Column 13'}</th> | ||
<th>{'Column 14'}</th> | ||
<th id="b">{'Column 15'}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td id="a">{'Value 1'}</td> | ||
<td>{'Value 2'}</td> | ||
<td>{'Value 3'}</td> | ||
<td>{'Value 4'}</td> | ||
<td>{'Value 5'}</td> | ||
<td>{'Value 6'}</td> | ||
<td>{'Value 7'}</td> | ||
<td>{'Value 8'}</td> | ||
<td>{'Value 9'}</td> | ||
<td>{'Value 10'}</td> | ||
<td>{'Value 11'}</td> | ||
<td>{'Value 12'}</td> | ||
<td>{'Value 13'}</td> | ||
<td>{'Value 14'}</td> | ||
<td id="b">{'Value 15'}</td> | ||
</tr> | ||
<tr> | ||
<td id="a">{'Value 1'}</td> | ||
<td>{'Value 2'}</td> | ||
<td>{'Value 3'}</td> | ||
<td>{'Value 4'}</td> | ||
<td>{'Value 5'}</td> | ||
<td>{'Value 6'}</td> | ||
<td>{'Value 7'}</td> | ||
<td>{'Value 8'}</td> | ||
<td>{'Value 9'}</td> | ||
<td>{'Value 10'}</td> | ||
<td>{'Value 11'}</td> | ||
<td>{'Value 12'}</td> | ||
<td>{'Value 13'}</td> | ||
<td>{'Value 14'}</td> | ||
<td id="b">{'Value 15'}</td> | ||
</tr> | ||
<tr> | ||
<td id="a">{'Value 1'}</td> | ||
<td>{'Value 2'}</td> | ||
<td>{'Value 3'}</td> | ||
<td>{'Value 4'}</td> | ||
<td>{'Value 5'}</td> | ||
<td>{'Value 6'}</td> | ||
<td>{'Value 7'}</td> | ||
<td>{'Value 8'}</td> | ||
<td>{'Value 9'}</td> | ||
<td>{'Value 10'}</td> | ||
<td>{'Value 11'}</td> | ||
<td>{'Value 12'}</td> | ||
<td>{'Value 13'}</td> | ||
<td>{'Value 14'}</td> | ||
<td id="b">{'Value 15'}</td> | ||
</tr> | ||
</tbody> | ||
</Table> | ||
) | ||
} | ||
|
||
export default TableStickyColumns |
3 changes: 3 additions & 0 deletions
3
playbook/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_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 @@ | ||
The `stickyLeftColumn` and `stickyRightColumn` props can be used together on the same table as needed. | ||
|
||
Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using props. |
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
2 changes: 2 additions & 0 deletions
2
playbook/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.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 @@ | ||
The `stickyLeftColumn` prop expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`. | ||
|
||
Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using the `stickyLeftColumn`. |
5 changes: 4 additions & 1 deletion
5
playbook/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_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,2 +1,5 @@ | ||
The `stickyLeftColumn` prop expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`. | ||
If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>` | ||
|
||
If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>` | ||
|
||
Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using `stickyLeftColumn` prop. |
87 changes: 87 additions & 0 deletions
87
playbook/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.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,87 @@ | ||
import React from 'react' | ||
import Table from '../_table' | ||
|
||
const TableStickyRightColumns = () => { | ||
return ( | ||
<Table | ||
responsive="scroll" | ||
size="md" | ||
stickyRightColumn={["13", "14", "15"]} | ||
> | ||
<thead> | ||
<tr> | ||
<th>{'Column 1'}</th> | ||
<th>{'Column 2'}</th> | ||
<th>{'Column 3'}</th> | ||
<th>{'Column 4'}</th> | ||
<th>{'Column 5'}</th> | ||
<th>{'Column 6'}</th> | ||
<th>{'Column 7'}</th> | ||
<th>{'Column 8'}</th> | ||
<th>{'Column 9'}</th> | ||
<th>{'Column 10'}</th> | ||
<th>{'Column 11'}</th> | ||
<th>{'Column 12'}</th> | ||
<th id="13">{'Column 13'}</th> | ||
<th id="14">{'Column 14'}</th> | ||
<th id="15">{'Column 15'}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>{'Value 1'}</td> | ||
<td>{'Value 2'}</td> | ||
<td>{'Value 3'}</td> | ||
<td>{'Value 4'}</td> | ||
<td>{'Value 5'}</td> | ||
<td>{'Value 6'}</td> | ||
<td>{'Value 7'}</td> | ||
<td>{'Value 8'}</td> | ||
<td>{'Value 9'}</td> | ||
<td>{'Value 10'}</td> | ||
<td>{'Value 11'}</td> | ||
<td>{'Value 12'}</td> | ||
<td id="13">{'Value 13'}</td> | ||
<td id="14">{'Value 14'}</td> | ||
<td id="15">{'Value 15'}</td> | ||
</tr> | ||
<tr> | ||
<td>{'Value 1'}</td> | ||
<td>{'Value 2'}</td> | ||
<td>{'Value 3'}</td> | ||
<td>{'Value 4'}</td> | ||
<td>{'Value 5'}</td> | ||
<td>{'Value 6'}</td> | ||
<td>{'Value 7'}</td> | ||
<td>{'Value 8'}</td> | ||
<td>{'Value 9'}</td> | ||
<td>{'Value 10'}</td> | ||
<td>{'Value 11'}</td> | ||
<td>{'Value 12'}</td> | ||
<td id="13">{'Value 13'}</td> | ||
<td id="14">{'Value 14'}</td> | ||
<td id="15">{'Value 15'}</td> | ||
</tr> | ||
<tr> | ||
<td>{'Value 1'}</td> | ||
<td>{'Value 2'}</td> | ||
<td>{'Value 3'}</td> | ||
<td>{'Value 4'}</td> | ||
<td>{'Value 5'}</td> | ||
<td>{'Value 6'}</td> | ||
<td>{'Value 7'}</td> | ||
<td>{'Value 8'}</td> | ||
<td>{'Value 9'}</td> | ||
<td>{'Value 10'}</td> | ||
<td>{'Value 11'}</td> | ||
<td>{'Value 12'}</td> | ||
<td id="13">{'Value 13'}</td> | ||
<td id="14">{'Value 14'}</td> | ||
<td id="15">{'Value 15'}</td> | ||
</tr> | ||
</tbody> | ||
</Table> | ||
) | ||
} | ||
|
||
export default TableStickyRightColumns |
5 changes: 5 additions & 0 deletions
5
playbook/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_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,5 @@ | ||
The `stickyRightColumn` prop works in the same way as the above `stickyLeftColumn` prop. It expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`. | ||
|
||
If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>` | ||
|
||
Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using the `stickyRightColumn` prop. |
Oops, something went wrong.