-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adopt shared header template on the dashboard view #8781
Conversation
Manage this branch in SquashTest this branch here: https://paarthagarwalhome-header-1s55u.squash.io |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PaarthAgarwal great start on the way here, I would like to see the styling get a bit closer to the current state though.
I have put specific code feedback in the review comments, but also some general feedback
- The PR title could be a bit clearer 'use/adopt shared header template on the dashboard view'
- When the shared header template changes are closer, can you also include a storybook (pattern library) variant that has the avatar in it, this will really help for testing later
Great start here!
With the styling - it may need some careful work but it looks like there is a bit of an over use of position absolute here and this relates to I think the styles trying to work around the sidebar. On top of that the existing styles are a mix of tailwind So far I have found that you can change the following in
|
@PaarthAgarwal Can you please do a seperate branch / PR for the dashboard stats design updates. It will.be easier to review in isolation. Plus - we may end up getting the stats thing done much easier due to the discussion about header component stuff that is ongoing. |
Sure |
@PaarthAgarwal a few other things
|
|
good call on the classes @PaarthAgarwal thanks. |
Interestingly there were no styles for .header classes nor any test for them. All the header styles are written for the header element directly. |
{% load i18n %} | ||
{% block branding_welcome %} | ||
{% blocktrans trimmed %}Welcome to the {{ site_name }} Wagtail CMS{% endblocktrans %} | ||
{% endblock %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be good to add a new line here and also configure your editor to add line breaks at the end of your file.
@@ -153,6 +153,12 @@ def page_permissions(context, page): | |||
return _get_user_page_permissions(context).for_page(page) | |||
|
|||
|
|||
@register.simple_tag | |||
def classnames(*classes): | |||
# classes # will be an array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# classes # will be an array | |
""" | |
Returns any args as a space-separated joined string for using in HTML class names. | |
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code is looking pretty solid.
Now need to do a review of the UI changes in a few browsers.
- would be good to add a bit more margin after the avatar or pull the avatar over to the left a bit more.
Update - there may be a refined design for the home (dashboard) view coming in the next week or so so this can probably come in mostly as is. |
|
||
```html+django | ||
{% extends "wagtailadmin/home.html" %} | ||
To replace the welcome message on the admin home page (dashboard), create a template file `dashboard/templates/wagtailadmin/home/branding_welcome_title.html` that overrides the content: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that if we went ahead with an approach like #8802, we wouldn’t need to refactor this as much.
@PaarthAgarwal I have done some tweaks to this branch and will merge in shortly - basically applying what we discussed, but also including Thibaud's template approach #8802 |
client/scss/layouts/_home.scss
Outdated
.homepage { | ||
header { | ||
.header__title { | ||
inset-inline-start: -1.5em; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To simplify things I opted for a shared header styles approach only, see other comment below.
{% block breadcrumb %}{% endblock %} | ||
<div class="row"> | ||
<div class="left"> | ||
<div class="col"> | ||
<h1 class="header__title"> | ||
{% if icon %}{% icon name=icon %}{% endif %} | ||
{% if icon %} | ||
{% icon class_name="w-header__icon" name=icon %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{% icon class_name="w-header__icon" name=icon %} | |
{% icon class_name="w-header__glyph" name=icon %} |
Having a generic class for the icon and avatar - we can make styles a bit easier to follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'll be great!
{% if icon %} | ||
{% icon class_name="w-header__icon" name=icon %} | ||
{% elif avatar %} | ||
<div class="avatar"><img src="{{ avatar }}" alt="" /></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div class="avatar"><img src="{{ avatar }}" alt="" /></div> | |
<div class="w-header__glpyh avatar"><img src="{{ avatar }}" alt="" /></div> |
Similar to above.
- use classnames template tag in shared header template - add classname as documented variable for the shared header template
Addresses #8539.
Applied shared header to dashboard.
Before:
After:
Edit1: Updated Screenshot
Edit2: Updated Screenshot