question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cleanup custom DialogHeader inside Release Notes

See original GitHub issue

This is some cleanup to avoid the workarounds that we’ve used in some dialogs to support complex headers. #6032 talked about being able to provide support for passing in a JSX element rather than a plain string, which means we can clean up this custom element:

https://github.com/desktop/desktop/blob/b5529325ae629a52b02cb3e07699f1ccbcfb2cfa/app/src/ui/release-notes/release-notes-dialog.tsx#L158-L175

Version: development aka b5529325ae629a52b02cb3e07699f1ccbcfb2cfa

Testing:

To see this dialog for yourself, build the app in development mode and run it up:

$ yarn
$ yarn build:dev
$ yarn start

With it running, find the Help -> Show Popup -> Release notes menu item:

Screen Shot 2019-03-15 at 10 59 15 AM

This will then show the dialog - make a note of how things look to ensure that the cleanup in here doesn’t affect the styles.

Screen Shot 2019-03-15 at 10 59 27 AM

With that change in place, check out the contents of render() inside app/src/ui/release-notes/release-notes-dialog.tsx. We should be able to remove the <DialogHeader> element and only use props on <Dialog> now to achieve the functionality:

    return (
      <Dialog
        id="release-notes"
        title={header} // TODO
        onDismissed={this.props.onDismissed}
      >
        <DialogContent>{contents}</DialogContent>

One thing to check while you’re in here is that the close icon is positioned in the top-right (like in the original screenshot) - it looks like having a tall header now causes the default dialog styles to change:

Screen Shot 2019-03-15 at 11 08 43 AM

These are the header-specific styles for this dialog that you might need to tweak:

https://github.com/desktop/desktop/blob/b5529325ae629a52b02cb3e07699f1ccbcfb2cfa/app/styles/ui/dialogs/_release-notes.scss#L11-L42

But I think you’ll need to look at the base styles for the dialog to get this working correctly again.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
tierninhocommented, Mar 27, 2019

@alejandronanez go for it and big thanks for contributing ✨

0reactions
shiftkeycommented, Mar 29, 2019

@alejandronanez you’re on the right track, but let me see if I can clarify things:

If I understand this correctly, what we want to achieve here is to avoid the usage of DialogHeader inside a Dialog component, to get to something like this:

Because we added support for using JSX in the header of a Dialog, we should be able to just pass in dialogHeaderContents (or a tweaked version) and avoid the need to import and wrap it in a <DialogHeader>. Does that clarify things?

Also, I want to make sure that you’re aware that this would affect other dialogs, are you aware of this? -

This is fine - the work to make changes to Merge Conflict and Merge Branch is tracked in #7043, and we have an open PR #7151 to go with it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

File header style | JetBrains Rider Documentation
Insert file header into existing files with Code Cleanup ; Press Ctrl+Alt+S or choose File | Settings ; Go to the cleanup profiles...
Read more >
Code style options and code cleanup - Visual Studio (Windows)
Learn how to configure Visual Studio to apply code style preferences using the Code Cleanup (Visual Studio 2019) and Format Document (Visual ...
Read more >
DialogFragment - Android Developers
Bundle) to create an entirely custom dialog, such as an AlertDialog, ... Note that in this case DialogFragment will take care of popping...
Read more >
Releases - GitLab Docs
In the list, select Custom. Select the New release checkbox. Close the dialog box to save. Prevent unintentional releases by setting a deploy...
Read more >
Primo VE 2021 Release Notes - Ex Libris Knowledge Center
The following table lists the configurations needed to enable custom sorting in Primo VE. Configuration Option, Description. Locations Ordering ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found