-
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-737] Add Loading State to Rails Advanced Table (#4162)
[PBNTR-737](https://runway.powerhrg.com/backlog_items/PBNTR-737) This PR adds a `loading` prop on the rails side. This prop applied the loading styles! <img width="1438" alt="Screenshot 2025-01-23 at 2 23 40 PM" src="https://github.com/user-attachments/assets/17a3160a-0525-4daa-b1dc-a0366b48ecc5" /> **How to test?** Steps to confirm the desired behavior: 1. Go to the Advanced Table Kit page #### 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. - [ ] **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
5b6e950
commit 979a900
Showing
13 changed files
with
70 additions
and
23 deletions.
There are no files selected for viewing
21 changes: 8 additions & 13 deletions
21
playbook/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb
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,15 +1,10 @@ | ||
<%= pb_content_tag do %> | ||
<%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive: "none", dark: dark }.merge(object.table_props)) do %> | ||
<% if content.present? %> | ||
<% content.presence %> | ||
<% else %> | ||
<%= pb_rails("advanced_table/table_header", props: { column_definitions: object.column_definitions, | ||
enable_toggle_expansion: object.enable_toggle_expansion, | ||
responsive: object.responsive }) %> | ||
<%= pb_rails("advanced_table/table_body", props: { id: object.id, | ||
table_data: object.table_data, | ||
column_definitions: object.column_definitions, | ||
responsive: object.responsive }) %> | ||
<% end %> | ||
<% end %> | ||
<%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark, classname: object.loading ? "content-loading" : "" }.merge(object.table_props)) do %> | ||
<% if content.present? %> | ||
<% content.presence %> | ||
<% else %> | ||
<%= pb_rails("advanced_table/table_header", props: { column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion, responsive: object.responsive, loading: object.loading }) %> | ||
<%= pb_rails("advanced_table/table_body", props: { id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading }) %> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
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
33 changes: 33 additions & 0 deletions
33
playbook/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.html.erb
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,33 @@ | ||
<% column_definitions = [ | ||
{ | ||
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", | ||
} | ||
] %> | ||
|
||
<%= pb_rails("advanced_table", props: { id: "beta_table", table_data: @table_data, column_definitions: column_definitions, loading: true }) %> |
1 change: 1 addition & 0 deletions
1
...ok/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading_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 |
---|---|---|
@@ -0,0 +1 @@ | ||
The optional `loading` prop takes a boolean value that can be managed using state. If loading is true, the table will display the loading skeleton and once loading is false, the table will render with the data provided. |
4 changes: 2 additions & 2 deletions
4
...ced_table/docs/_advanced_table_loading.md → ...ble/docs/_advanced_table_loading_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,3 +1,3 @@ | ||
the optional `loading` prop takes a boolean value that can be managed using state. If loading is true, the table will display the loading skeleton and once loading is false, the table will render with the data provided. | ||
The optional `loading` prop takes a boolean value that can be managed using state. If loading is true, the table will display the loading skeleton and once loading is false, the table will render with the data provided. | ||
|
||
By default, the inital row count of the loading skeleton is set to 10. If you want more control over this initial row count, the optional `initialLoadingRowCount` prop can be used to pass in a number. __NOTE__: This is only for the first render of the table, subsequent loading skeleton row count logic is handled within the kit itself. | ||
By default, the inital row count of the loading skeleton is set to 10. If you want more control over this initial row count, the optional `initialLoadingRowsCount` prop can be used to pass in a number. __NOTE__: This is only for the first render of the table, subsequent loading skeleton row count logic is handled within the kit itself. |
1 change: 1 addition & 0 deletions
1
playbook/app/pb_kits/playbook/pb_advanced_table/docs/example.yml
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
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
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 |
---|---|---|
|
@@ -78,4 +78,9 @@ $avatar-sizes: ( | |
} | ||
} | ||
} | ||
&.dark { | ||
[class^=pb_card_kit] { | ||
position: absolute; | ||
} | ||
} | ||
} |