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

🔨 (grapher) refactor mobile full width mode for embedded graphers #3243

Merged
merged 2 commits into from
Mar 4, 2024

Conversation

sophiamersmann
Copy link
Member

@sophiamersmann sophiamersmann commented Feb 26, 2024

Summary

  • On small screens, we want embedded Graphers to use the full screen width and bleed onto the edges horizontally (see screenshots below)
  • This used to be implemented via a Grapher property shouldOptimizeForHorizontalSpace, which was awfully complicated and also led to the following bug: Grapher's modal backdrop doesn't cover the whole frame when embedded in an article and viewed on a small screen #3010
  • This PR removes the shouldOptimizeForHorizontalSpace property and simply sets negative margins on embedded charts
    • It's not guaranteed that the chart title aligns with the text. It just so happens that both the grid-gap and Grapher's frame padding are set to 16px
    • As Grapher's frame padding and the grid-gap are not likely to be updated frequently, I think it's okay to rely on that for now

Screenshots

Not using the full width Using the full width
Screenshot 2024-02-26 at 13 59 11 Screenshot 2024-02-26 at 13 57 13

Related issue

Copy link
Member Author

sophiamersmann commented Feb 26, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @sophiamersmann and the rest of your teammates on Graphite Graphite

@sophiamersmann sophiamersmann changed the title (grapher) refactor mobile full width mode for embedded graphers 🔨 (grapher) refactor mobile full width mode for embedded graphers Feb 26, 2024
@sophiamersmann sophiamersmann marked this pull request as ready for review February 26, 2024 13:12
Copy link
Member

@ikesau ikesau left a comment

Choose a reason for hiding this comment

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

I didn't spend a ton of time parsing the old code and thinking about potential regressions, but the new stuff looks good (tested on Safari, Chrome and Firefox) 👍

I see this is currently only implemented in Chart and Key Insight components - but are the other places intentionally unchanged?

Explorer pages, datapages, key-indicators, all-charts blocks, etc, I feel like they'd all benefit from the extra horizontal width on mobile.

@sophiamersmann
Copy link
Member Author

sophiamersmann commented Mar 1, 2024

Good point! The all-charts block and key-indicator blocks are intentionally unchanged. I didn't think about explorer pages and data pages, to be honest. It would be a nice touch on data pages, I think. On explorer pages, it would kind of separate the chart from the controls and break the alignment with the other boxes, if you know what I mean.

Looking at data pages in more detail, I'm noticing that data pages are padded by 24px on both sides on mobile, although it should be 16px according to the designs. I guess we'd need to fix that before we could use full-width Graphers on mobile :(

@sophiamersmann sophiamersmann merged commit 4abb020 into master Mar 4, 2024
25 checks passed
@sophiamersmann sophiamersmann deleted the refactor-grapher-width-in-articles branch March 4, 2024 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants