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

Lift ImageDetails To common-rendering #3520

Merged
merged 5 commits into from
Oct 14, 2021

Conversation

JamieB-gu
Copy link
Contributor

@JamieB-gu JamieB-gu commented Oct 12, 2021

Why?

AR uses a combination of a camera icon and summary/details (see screenshots) to handle image captions. Design would like to start using this on dotcom too, starting with the liveblogs. This PR lifts up and refactors the component that manages this.

FYI @HarryFischer

Changes

  • Lifted HeaderImageCaption to common and renamed to ImageDetails
  • Simplified the API (some props seemed to be unused - I think they were for Editions originally, but then Editions separated this functionality into their own component)
  • Refactored the CSS
  • Added some type definitions to common
  • Lifted pipe and maybeRender to common (will need a follow-up at some point to update all the imports, I've just re-exported for now to keep this PR small)
  • Added stories

Screenshots

Closed Open
closed open

- Renamed `HeaderImageCaption` to `ImageDetails`
- Simplified component API
- Broke up component CSS
- Added type definitions to common
- Lifted `pipe` and `maybeRender` to common
@github-actions
Copy link

github-actions bot commented Oct 12, 2021

Size Change: +438 B (0%)

Total Size: 959 kB

Filename Size Change
dist/frontend.server.js 325 kB +244 B (0%)
dist/react.js 137 kB +87 B (0%)
dist/react.legacy.js 143 kB +107 B (0%)
ℹ️ View Unchanged
Filename Size
dist/359.js 21.5 kB
dist/359.legacy.js 21.5 kB
dist/554.js 3.58 kB
dist/554.legacy.js 3.68 kB
dist/atomIframe.js 1.87 kB
dist/atomIframe.legacy.js 2.13 kB
dist/braze-web-sdk-core.js 36.1 kB
dist/braze-web-sdk-core.legacy.js 36.1 kB
dist/coreVitals.js 3.74 kB
dist/coreVitals.legacy.js 6.43 kB
dist/dynamicImport.js 2.99 kB
dist/dynamicImport.legacy.js 3.27 kB
dist/EditionDropdown.js 693 B
dist/EditionDropdown.legacy.js 701 B
dist/elements-CalloutBlockComponent.js 5.9 kB
dist/elements-CalloutBlockComponent.legacy.js 6.25 kB
dist/elements-DocumentBlockComponent.js 570 B
dist/elements-DocumentBlockComponent.legacy.js 600 B
dist/elements-InstagramBlockComponent.js 434 B
dist/elements-InstagramBlockComponent.legacy.js 452 B
dist/elements-InteractiveBlockComponent.js 2.61 kB
dist/elements-InteractiveBlockComponent.legacy.js 2.74 kB
dist/elements-InteractiveContentsBlockElement.js 1.87 kB
dist/elements-InteractiveContentsBlockElement.legacy.js 1.94 kB
dist/elements-MapEmbedBlockComponent.js 1.52 kB
dist/elements-MapEmbedBlockComponent.legacy.js 1.58 kB
dist/elements-RichLinkComponent.js 3.27 kB
dist/elements-RichLinkComponent.legacy.js 3.31 kB
dist/elements-SpotifyBlockComponent.js 1.45 kB
dist/elements-SpotifyBlockComponent.legacy.js 1.51 kB
dist/elements-VideoFacebookBlockComponent.js 1.53 kB
dist/elements-VideoFacebookBlockComponent.legacy.js 1.58 kB
dist/elements-VineBlockComponent.js 579 B
dist/elements-VineBlockComponent.legacy.js 595 B
dist/elements-YoutubeBlockComponent.js 2.07 kB
dist/elements-YoutubeBlockComponent.legacy.js 2.15 kB
dist/embedIframe.js 1.88 kB
dist/embedIframe.legacy.js 2.13 kB
dist/ga.js 3.87 kB
dist/ga.legacy.js 4.1 kB
dist/GetMatchStats.js 3.27 kB
dist/GetMatchStats.legacy.js 3.34 kB
dist/guardian-braze-components-banner.js 9.81 kB
dist/guardian-braze-components-banner.legacy.js 9.82 kB
dist/guardian-braze-components-end-of-article.js 6.51 kB
dist/guardian-braze-components-end-of-article.legacy.js 6.52 kB
dist/MostViewedFooterData.js 6.32 kB
dist/MostViewedFooterData.legacy.js 6.41 kB
dist/MostViewedRightWrapper.js 5.63 kB
dist/MostViewedRightWrapper.legacy.js 5.88 kB
dist/newsletterEmbedIframe.js 1.83 kB
dist/newsletterEmbedIframe.legacy.js 2.08 kB
dist/OnwardsLower.js 11.3 kB
dist/OnwardsLower.legacy.js 11.6 kB
dist/OnwardsUpper.js 12.4 kB
dist/OnwardsUpper.legacy.js 12.7 kB
dist/ophan.js 7.16 kB
dist/ophan.legacy.js 7.36 kB
dist/sentry.js 677 B
dist/sentry.legacy.js 688 B
dist/sentryLoader.js 4.73 kB
dist/sentryLoader.legacy.js 7.67 kB
dist/shimport.js 2.75 kB
dist/shimport.legacy.js 2.76 kB
dist/SignInGateMain.js 1.84 kB
dist/SignInGateMain.legacy.js 1.88 kB

compressed-size-action

import { brandAlt, neutral } from '@guardian/src-foundations/palette';
import { textSans } from '@guardian/src-foundations/typography';
import { SvgCamera } from '@guardian/src-icons';
import type { Option } from '@guardian/types';
Copy link
Member

Choose a reason for hiding this comment

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

this package has been deprecated in favour of libs and now only contains Option and Result.

they're left installable (but deprecated) for existing codebases that still need use them, but they shouldn't really be used in new ones.

this is especially true of things that intended to be shared from the start (cf guardian/types#12 (review))

Copy link
Contributor

Choose a reason for hiding this comment

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

I strongly agree with @sndrs. We shouldn't be propagating a deprecated library. It is no longer possible to make changes to @guardian/types which puts this repo at further risk of exposure to unfixable bugs and security vulnerabilities. It also frustrates our team's efforts to help you migrate away from this package.

sndrs
sndrs previously requested changes Oct 14, 2021
Copy link
Member

@sndrs sndrs left a comment

Choose a reason for hiding this comment

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

just to reiterate the auto-dismissed comments, @guardian/types is deprecated in favour of @guardian/libs, and use of Option/Result is strongly discouraged for all the reasons they weren't ported over to libs.

we might not be looking to remove them from existing code in situ, but this is altering the intention and location of that existing code into sharable behaviours intended to be used outside the current AR codebase.

@JamieB-gu JamieB-gu dismissed sndrs’s stale review October 14, 2021 11:03

As discussed offline, I'd like to get this merged because it fixes an issue in production (see final commit). We're going to discuss Alex's concerns separately.

@JamieB-gu JamieB-gu merged commit 28425a1 into main Oct 14, 2021
@JamieB-gu JamieB-gu deleted the lift-image-details-to-common-rendering branch October 14, 2021 11:04
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.

4 participants