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

Changing embed badge dropdown to a modal. #1066

Merged
merged 42 commits into from
May 2, 2024
Merged

Conversation

sd1p
Copy link
Contributor

@sd1p sd1p commented Mar 27, 2024

@Julian I was experimenting around making the embed badge UI responsive using modal instead of a dropdown, resolving issue #1043. The new layout looks great when the viewport width is greater than 425px.

I was thinking, for mobile displays, can we have a different layout?

modal1.mp4

📚 Documentation preview 📚: https://bowtie-json-schema--1066.org.readthedocs.build/en/1066/

@sd1p
Copy link
Contributor Author

sd1p commented Mar 28, 2024

Created a new layout for mobile ( viewport width <=425px) for making the modal responsive.

modal3.mp4

@sd1p sd1p changed the title WIP: Changing embed badge dropdown to a modal. Changing embed badge dropdown to a modal. Mar 28, 2024
@Julian
Copy link
Member

Julian commented Mar 29, 2024

That seems odd looking to me on mobile. At that width probably it should just be a full-screen modal I think.

@Julian Julian added the waiting for author An issue or PR which is waiting for futher steps from its author label Mar 29, 2024
@sd1p
Copy link
Contributor Author

sd1p commented Mar 29, 2024

Added overflow-x-scroll on card content to maintain viewport width within full screen size

modal4.mp4

@Julian Julian removed the waiting for author An issue or PR which is waiting for futher steps from its author label Mar 29, 2024
@sd1p
Copy link
Contributor Author

sd1p commented Apr 23, 2024

Apologies for the force pushes, my intention was to squash several commits, but it didn't go as planned. I have added an external CSS file to manage the background color of the code block depending on the theme.

@Julian
Copy link
Member

Julian commented Apr 23, 2024

All fine I don't mind either way. Is this ready for review then?

@sd1p
Copy link
Contributor Author

sd1p commented Apr 23, 2024

All fine I don't mind either way. Is this ready for review then?

Yeah. Please go ahead.

@sd1p sd1p requested a review from Julian April 25, 2024 19:49
@Julian
Copy link
Member

Julian commented Apr 26, 2024

It still is narrower than before, and therefore looks awkward to me. It looks like to make the modal wider at this point there is no xxl in react-bootstrap and you'd need to use dialogClassName.

Can you also explain why you're explicitly defining colors (in CSS)? What color is missing from where without that, doing so seems very suspicious as we're using a theme for the code block, so those colors would be wrong with any theme change?

const badgeEmbed = activeFormat.generateEmbed(activeBadge);

const compareBadges = (a: Badge, b: Badge) => {
Copy link
Member

Choose a reason for hiding this comment

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

If you're going to define this (which I previously considered but decided it wasn't really any better than just relying on the name alone for now) I think it belongs in data/Badge, especially if/when we have a badge class rather than just an interface. But feel free also to leave it as it was before, I don't mind either way personally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have removed the comparator function and reverted the changes. Thanks.

@sd1p
Copy link
Contributor Author

sd1p commented Apr 26, 2024

Can you also explain why you're explicitly defining colors (in CSS)? What color is missing from where without that, doing so seems very suspicious as we're using a theme for the code block, so those colors would be wrong with any theme change?

I attempted to increase the size of the code-block, by adding padding to the code block and also added padding to it parent container, which required using explicit background color. I will try to implement it in a better way without explicitly declaring colors in CSS. I will also increase the width of the modal so it doesn't look squarish.

Thanks for the feedback.

@sd1p
Copy link
Contributor Author

sd1p commented Apr 27, 2024

I have made the modal more wider and removed hardcoded CSS colors.

image

@sd1p
Copy link
Contributor Author

sd1p commented Apr 28, 2024

In the previous commit the code block content overflow is not looking good. I tried to use wrapLongLines in syntax-highlighter to center the code content and reduced vertical padding as users don't need to scroll to copy code.

I have checked the wrap code lines for all 5 available formats, everything looks good to me.

image

@Julian
Copy link
Member

Julian commented May 2, 2024

This looks good I think! Going to merge after a minor spacing fix. Really appreciate all your work!

* main:
  Minor jiggering to the current dialect resource.
  build(deps): bump JsonSchema.Net
  build(deps): bump serde in /implementations/rust-jsonschema
  And now ensure we generate the same number of results as tests.
  Hypothesis-generate boolean schemas only for dialects supporting them.
@Julian Julian removed the waiting for author An issue or PR which is waiting for futher steps from its author label May 2, 2024
@Julian Julian merged commit 245adc6 into bowtie-json-schema:main May 2, 2024
25 of 26 checks passed
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.

None yet

2 participants