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

feat: removed reserved space for empty titles in vega_card #1923 #2146

Merged
merged 3 commits into from
Oct 3, 2023

Conversation

MattiasOz
Copy link
Contributor

The PR fulfills these requirements: (check all the apply)

  • It's submitted to the main branch.
  • When resolving a specific issue, it's referenced in the PR's title (e.g. feat: Add a button #xxx, where "xxx" is the issue number).
  • When resolving a specific issue, the PR description includes Closes #xxx, where "xxx" is the issue number.
  • If changes were made to ui folder, unit tests (make test) still pass.
  • New/updated tests are included

Closes #1923

Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

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

Thanks for the valuable contribution @MattiasOz! Just need to resolve 1 comment and it's good to be merged.

ui/src/vega.tsx Outdated
Comment on lines 155 to 158
{!title &&
<div className={css.body} style={{marginTop: 0}}>
<XVegaVisualization model={{ specification, data, grammar }} />
</div>}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's try to avoid unnecessary duplication. Do you think we could move the margin from body to title instead? That would remove the need for hacky conditional logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright. Noticed an easier way of doing it. Updated now. Still passes all tests.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Does the vega_card with a title look the same as before? A quick look at the code suggests the margin is missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The margin is gone. We assumed it was a mistake since the other cards in the dashboard don't seem to have one. We assumed this is what the issuer was complaining about since the title doesn't actually have a reserved height if the string is empty. Our fix removes the margin altogether as well as the title div if it's empty.

We could add marginBottom to the title div if the extra spacing was necessary.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be better to keep the original behavior untouched - if the title is specified, it should render as before. If not specified, there should be no extra whitespace.

Please check the rest of the components that may suffer from similar problem as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We added a margin when the title isn't blank. There will be no margin when the title is absent.

Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @MattiasOz!

@mturoci mturoci merged commit f8fb86f into h2oai:main Oct 3, 2023
2 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.

Do not render reserved title whitespace in vega_card if the title is empty
2 participants