Move Idea Hub widget footer into Widget.Footer prop
See original GitHub issueFeature Description
In #3723, we made the Idea Hub widget’s height consistent across all of the tabs. As a result, the layout of the widget looks somewhat off compared to other widgets because the footer content is not flush against the bottom of the widget.
The “updated every 2-3 days” line/component should be moved into a new Footer
component that is rendered as a prop to Widget.Footer
. It should still change based on the selected tab as it does today, but rendered in a different place.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The Idea Hub
DashboardIdeasWidget
should be updated to render footer content for the selected tab into itsWidget.Footer
prop rather than as part of the tab-specific tab content component. The passing of the prop should be conditional based on the selected tab – e.g. for no new/saved/draft ideas, the zero state should look the same as today (with no footer)
Implementation Brief
- Using
assets/js/modules/idea-hub/components/dashboard/DashboardIdeasWidget/Pagination.js
- Remove the existing
total
,page
,ideasPerPage
,handlePrev
andhandleNext
props. - Add a new prop
tab
, string havingnew-ideas
as default value. - Query the
core/ui
data store via thegetValue
selector and passing a key which contains thetab
value (for e.gidea-hub-page-${ tab }
) to get the current page the user is on. The value should be assigned to thepage
constant. If the selector returnsundefined
,page
should be1
, meaning we are on the first page by default. - Get the total for each tabs by querying the
MODULES_IDEA_HUB
data store via thegetNewIdeas
,getSavedIdeas
andgetDraftPostIdeas
selectors. - Then based on the value of the
tab
, assign the result of above selector call to thetotal
variable. - Add 2 new functions,
handlePrev
andhandleNext
using the same logic as inNewIdeas
but instead of usingsetPage
, use thesetValue
action fromcore/ui
, passing the unique key, for e.gidea-hub-page-${ tab }
, as key and the appropriate value. - Replace
ideasPerPage
references by theIDEA_HUB_IDEAS_PER_PAGE
constant.
- Remove the existing
- Using
assets/js/modules/idea-hub/components/dashboard/DashboardIdeasWidget/Footer.js
,- Remove the existing
totalIdeas
,page
,handlePrev
andhandleNext
props. - Add a new prop
tab
, string havingnew-ideas
as default value. - Pass on the
tab
prop only to thePagination
component.
- Remove the existing
- Using
assets/js/modules/idea-hub/components/dashboard/DashboardIdeasWidget/NewIdeas.js
,- Remove the
page
state variable. Instead grab the page for the new ideas tab by quering thecore/ui
data store via thegetValue
selector and passing the appropriate key, for e.gidea-hub-page-new-ideas
- Remove the
handlePrev
andhandleNext
functions. - Remove the
Footer
component. - Repeat steps above for the
SavedIdeas
andDraftIdeas
components.
- Remove the
- Using
assets/js/modules/idea-hub/components/dashboard/DashboardIdeasWidget/index.js
,- Add the
Footer
prop to theWidget
component, having theFooter
component as value and passingactiveTab
as value for thetab
prop.
- Add the
- Update the styles for
.googlesitekit-idea-hub__footer
to remove thepadding
andbox-shadow
. - Tweak the styles for
.googlesitekit-widget--ideaHubIdeas .googlesitekit-widget__footer
to that the borders of the footer align with adjacent widgets.
Test Coverage
- No new tests to be added.
Visual Regression Changes
- N/A
QA Brief
- Check the Idea Hub widget on the Site Kit Dashboard
- Tabs should work as before. Specifically
- Changing tabs
- Pagination on all tabs
- Totals
Changelog entry
- Update the Idea Hub widget to display its footer in the
Widget.Footer
prop.
Issue Analytics
- State:
- Created 2 years ago
- Comments:26 (8 by maintainers)
Top Results From Across the Web
How to Manage Footer Widgets? - YouTube
In this video tutorial, we will explain how to manage footer widgets.If you have any issues or questions, please visit our support center ......
Read more >Widgets in footer?
Hi,. is it possible to add some widgets to the footer section in theme author? Something like creating a footer template and add...
Read more >Sample Footer widget
The Sample Footer widget is an example of a footer you can use in your portal. You can use this base system widget...
Read more >How To Edit the Footer in WordPress Using Every Method ...
Click on any of the footer widget locations to reveal an area to Add A Widget. Click on that button to show a...
Read more >How to Edit the Footer in WordPress (4 Ways)
Adding text and images is quite simple. To do this, navigate to Appearance » Widgets and then click the 'Plus' add block icon...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The CSS solution is clever, but the React one seems straightforward as well so I’d rather we do it that way 🙂 . If it were more complicated and this was a shipping bug I’d see the value in the quick-fix solution, but I don’t think either are the case here so let’s do it “properly”. I’ll admit though: that’s a slick CSS-only solution, nice one @asvinb 👍🏻
Let’s go with the React version. IB ✅
(I’ve commented out the CSS-only version as to not confuse anyone else looking at the issue, but it’s still in the issue text as a comment if needed for reference.)
QA Update: Pass ✅
Notes: there is an issue that the footer still displays on tabs with no ideas. This will be picked up by another ticket. Also note that I was unable to test while connected elasticpress.io for the new API because no ideas were appearing.