Skip to content
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

SG's Little Fixes #242

Merged
merged 14 commits into from
Jul 29, 2021
Merged

SG's Little Fixes #242

merged 14 commits into from
Jul 29, 2021

Conversation

manodrum
Copy link
Contributor

@manodrum manodrum commented Jul 27, 2021

  • Adds username to Report Error GitHub issue body payload if logged in, resolves GTCMT/earsketch#2584
  • Move dark class back up to <body> tag to capture modals which get moved outside of the main <div> by headless
  • Reorganizes Freesound search results selection and adds highlighting, fixes GTCMT/earsketch#2566
    Current layout
    Screen Shot 2021-07-27 at 3 19 56 PM
    New Layout
    Screen Shot 2021-07-27 at 1 30 44 PMScreen Shot 2021-07-27 at 1 32 37 PM
  • Increases contrast of notification text in light mode to be more accessible:
Before After
old_notifications new_notifications

manodrum added 5 commits July 27, 2021 11:29
unfortunately, we need to add this to the `<body>` tag because modals (and perhaps script menus eventually) get moved outside of the main div by headless ui, so they don't take on the dark mode classes without this being at a higher level. Tailwind recommends this being at the body or html tag level, so I think this little dom manipulation is ok.
@manodrum manodrum requested a review from ijc8 July 27, 2021 19:48
} else {
document.body.classList.remove(("dark"))
}
}, [theme])
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, I see why this is necessary.

At some point, we might want to add a bit of JS to do this in public/index.html (though I think this is moot for now because our tailwind CSS isn't loaded yet), and perhaps respect the OS/browser theme setting by default.
(See https://tailwindcss.com/docs/dark-mode#toggling-dark-mode-manually)

<input type="radio" style={{ marginRight: "0.75rem" }} checked={index === selected}
<div className="overflow-y-auto border px-3 border-gray-300 dark:border-gray-500" style={{ maxHeight: "300px" }}>
{results.map((result, index) => <div key={index} className={index === selected ? "bg-blue-200 dark:bg-blue-900" : ""}>
<div className="grid grid-flow-col items-center pt-3">
Copy link
Contributor

Choose a reason for hiding this comment

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

ooh, grid layout

{results.map((result, index) => <div key={index}>
<label>
<input type="radio" style={{ marginRight: "0.75rem" }} checked={index === selected}
<div className="overflow-y-auto border px-3 border-gray-300 dark:border-gray-500" style={{ maxHeight: "300px" }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice job on the UI here. Two requests:

  1. It'd be nice if there were a little left padding for the radio button. You could just move the padding from this element (px-3) down to the children, so that the rows go all the way across.
  2. This looks fine in Chrome, but there's a lot of extra vertical space in Firefox:
    image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why Firefox, why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, this is fixed, and back as children of the <label>

<div className="overflow-y-auto border px-3 border-gray-300 dark:border-gray-500" style={{ maxHeight: "300px" }}>
{results.map((result, index) => <div key={index} className={index === selected ? "bg-blue-200 dark:bg-blue-900" : ""}>
<div className="grid grid-flow-col items-center pt-3">
<input id={"fs" + index} type="radio" style={{ marginRight: "0.75rem" }} checked={index === selected}
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that the dynamic IDs here are for the benefit of the <label>s.
Could we make these elements children of the <label> and scrap the IDs, or does that mess up the layout?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could probably be done with enough non-tailwind css. Would need to push the label back out to the right, because this would put it on the left. Not sure we could use grid either, as these would be children instead of siblings.

I don't think it's worth it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done now

failure2: "#d73636",
success: "#065f46",
failure1: "#b91c1c",
failure2: "#b91c1c",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is good; per our discussion, I'm guessing this will either grow to include background colors or get moved to its own PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, and let's replace failure1 and failure2 with just failure, and get rid of fallback.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done now

@ijc8 ijc8 merged commit edd92bf into main Jul 29, 2021
@ijc8 ijc8 deleted the sg-little-fixes branch July 29, 2021 20:51
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.

2 participants