-
Notifications
You must be signed in to change notification settings - Fork 30
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
Datawrapper embed styling #12306
Datawrapper embed styling #12306
Conversation
Size Change: +273 B (+0.03%) Total Size: 921 kB
ℹ️ View Unchanged
|
95656b9
to
0053000
Compare
0e55a5b
to
8256c53
Compare
I took some screenshots of a Datawrapper graphic in CODE with these changes, across the different roles and mobile vs. desktop views: |
81b0a98
to
cd2f632
Compare
This is an example of the kind of role-independent styling I would like to do on datawrapper graphics, by matching on the URL of the interactive element.
This is an example of the kind of role-dependent styling I would like to make for datawrapper graphics.
Relative links work well locally in text editors and on github, whereas an absolute link like this can be mildly frustrating when following from a text editor.
This 32px margin collapses with the existing 16px paragraph spacing. What about breakpoints? (Should I be using spacing constants? Probably)
This palette colour both matches the hex colour I had manually used, and seems like the most appropriate “border” colour listed in the file. Hopefully it’s a good choice: I must remember to ask in the PR. Also, looking at this has reminded me that I should check how my styling looks in dark mode!
For roles which move the graphics across the border on the side, we’d like to add a bottom border to avoid the odd reappearance of the side border after the graphic.
These margins were too small: the request from the visuals team is that they be 32px.
I’ve added a story with a Datawrapper embed for each role, to have an easy way to look at the styling. I’ve also tweaked the Wrapper used in the InteractiveBlockComponent stories to match that used in the Figure stories. Since the layouts are similar, I think this should be fine?
I had misunderstood some of the desired padding, and accidentally included the bottom border even at mobile breakpoints. Now the top and bottom margins are the same in the mobile breakpoint for supporting, inline, showcase, and immersive roles, for datawrapper graphics.
764ad2a
to
9b2cb88
Compare
To make it clearer which CSS is specific to Datawrapper embeds, this commit splits the Datawrapper-specific CSS out from the general Figure CSS, and relies on the ordering of the CSS for having the Datawrapper-specific CSS override the Figure CSS. This does mean that there’s a risk the Figure CSS will be edited in a way that breaks the Datawrapper CSS without the editor realising this. For example, the Datawrapper CSS uses breakpoints that should be the same as the ones the Figure CSS uses. Hopefully this risk is outweighed by the improvement to the clarity of the CSS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌 Looks good
thumbnail: css``, | ||
halfWidth: css``, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ll take a look!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have removed and replaced with null
There’s no Datawrapper-specific css for thumbnail or halfwidth roles, so I had been returning an empty SerializedStyles value. However, it looks like the css prop can take null, so there’s no need for me to do that! This commit replaces thoses empty css`` values with null.
Because we’re currently using Datawrapper’s “update old versions” setting, any updates to the Datawrapper graphic used in the stories cause new UI changes that need to be approved, which is annoying. To mitigate this, I’ve created a new test graphic which can be kept for just this purpose, and not updated unless we want there to be changes in the UI tests.
Ah yes, it was deliberately kept white to handle interactives which don’t support dark mode: #10578 Hmmm, it would be nice if we could change this! Maybe just for datawrapper graphics, or maybe for everything. I don’t want to look at it in this PR though. |
Meant to write this comment on this PR (in between my last two) but accidentally put it on another one:
|
Seen on PROD (merged by @emdash-ie 9 minutes and 47 seconds ago) Please check your changes! |
What does this change?
This PR tweaks the styling of
InteractiveBlockComponents
when they’re used for datawrapper graphics, i.e. when the URL starts withhttps://interactive.guim.co.uk/datawrapper-test/embed
orhttps://interactive.guim.co.uk/datawrapper/embed
.Why?
These styling tweaks have been requested by the visuals team
Screenshots
I have added some before and after screenshots in coments on this PR, and here they are reproduced in a table: