Skip to content

Refactor DialogHeader in Dialog component - Release notes - #7188

Merged
niik merged 6 commits into
desktop:developmentfrom
alejandronanez:DialogHeader__cleanup
May 14, 2019
Merged

niik merged 6 commits into
desktop:developmentfrom
alejandronanez:DialogHeader__cleanup

Conversation

@alejandronanez

Copy link
Copy Markdown
Contributor

Overview

Closes #7093

Description

Add a new validation in renderHeader, check if this.props.title is a string.

If it is a string, it should render the default DialogHeader component.

If it is not a string (assume it is a React Element), render such element.

Release notes

Notes:

@niik niik self-assigned this Apr 1, 2019

@niik niik left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@alejandronanez

Copy link
Copy Markdown
Contributor Author

Hey @niik!
First of all, thanks for the thoughtful review, I really appreciate it!
I'll be more than happy to keep working on this during this week, your comments make sense but I'll probably have a couple of questions once I get to implement them!

Thanks again!

@alejandronanez
alejandronanez force-pushed the DialogHeader__cleanup branch 3 times, most recently from 7b5d93c to 606d908 Compare April 17, 2019 09:25
@alejandronanez

Copy link
Copy Markdown
Contributor Author

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!

@alejandronanez
alejandronanez force-pushed the DialogHeader__cleanup branch from 606d908 to 4c6f220 Compare April 20, 2019 20:32
@alejandronanez
alejandronanez force-pushed the DialogHeader__cleanup branch from 926987d to 9752085 Compare April 20, 2019 21:21

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is gone for good now!


a.close {
align-self: flex-start;
z-index: 1;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was needed b/c the close button was not clickable.

@alejandronanez

Copy link
Copy Markdown
Contributor Author

Hey @niik, this is ready for another review!

Thanks for your patience with this issue 🙏

@billygriffin
billygriffin requested a review from niik April 23, 2019 16:14

@niik niik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@niik
niik merged commit 44ff80c into desktop:development May 14, 2019
@billygriffin

Copy link
Copy Markdown
Contributor

@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! ❤️ 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cleanup custom DialogHeader inside Release Notes

3 participants