Repository navigation
Refactor DialogHeader in Dialog component - Release notes - #7188
Conversation
There was a problem hiding this comment.
Hi @alejandronanez, thanks so much for working on this!
Your changes are an excellent step in the right direction, I just have a few changes I'd like you to make before we can merge this.
First, what we're aiming to do with issues such as #7093 is to get rid of all places where we use the DialogHeader component outside of the Dialog component itself. The reason for this being that the Dialog component needs to create it in order to give it an id which can then be referred to by the aria-labelledby attribute on the rendered <dialog> element such that screenreaders and other assistive technologies are able to accurately represent the dialog's intention.
As such I think we should keep the dialog.tsx file as-is and not change it to allow passing a DialogHeader directly.
Instead we should change your dialogHeader variable to only contain the <div className="release-notes-header" element. We should also remove the renderCloseButton method and have the dialog take care of that.
Once that's done we're gonna have to make some changes to the CSS to make this look pretty again.
First, we'll make the release notes dialog header relative so that we can absolutely position the release-notes-header inside of it. (All snippets in here are referring to the _release-notes.scss file)
.dialog-header {
position: relative;After that we'll make the release-notes-header element absolutely positioned inside of the header such that it doesn't interfere with the close button.
.release-notes-header {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
padding: 0 var(--spacing-double);After that we'll have to tweak the title element a bit to make it sit centered in the dialog header
.title {
display: flex;
flex-direction: column;
justify-content: center;While not specified in the original issue I'd also really appreciate it if you could remove the existing margins for the <p> tags inside of the title to tighten it all up a little.
.title {
p { margin: 0; }
}And finally we'll address @shiftkey's comment about positioning the close button.
a.close {
align-self: flex-start;
}We'd be delighted if you'd be willing to take a stab at applying these changes, feel free to reach out with any questions you might have and I'll do my best to answer them.
|
Hey @niik! Thanks again! |
7b5d93c to
606d908
Compare
|
Heads up, I'm back from vacations and will be able to work on this in the next couple of days! Thanks for your patience! |
606d908 to
4c6f220
Compare
926987d to
9752085
Compare
There was a problem hiding this comment.
This is gone for good now!
|
|
||
| a.close { | ||
| align-self: flex-start; | ||
| z-index: 1; |
There was a problem hiding this comment.
This was needed b/c the close button was not clickable.
|
Hey @niik, this is ready for another review! Thanks for your patience with this issue 🙏 |
niik
left a comment
There was a problem hiding this comment.
This looks great @alejandronanez! Thank you so much for your patience, I apologize for taking so long to get to a final review here. We really appreciate your contribution.
|
@alejandronanez Congrats on getting your first PR merged into GitHub Desktop! It should go out in our next beta release, and then hopefully to production in a few weeks. Thanks so much! ❤️ 🎉 |
Overview
Closes #7093
Description
Add a new validation in
renderHeader, check ifthis.props.titleis a string.If it is a string, it should render the default
DialogHeadercomponent.If it is not a string (assume it is a React Element), render such element.
Release notes
Notes: