-
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
Migrate standard epic to DCR #9959
Conversation
Size Change: +10.5 kB (+1%) Total Size: 756 kB
ℹ️ View Unchanged
|
fb249d5
to
4145f62
Compare
8276972
to
ad979c2
Compare
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.
LGTM!
❤️ the bundle size change in the description.
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.
Good to see this codebase being the home for these components!
Left some thoughts, but nothing blocking or that needs to be addressed as part of this port.
dotcom-rendering/src/components/SlotBodyEnd/ReaderRevenueEpic.tsx
Outdated
Show resolved
Hide resolved
dotcom-rendering/src/components/marketing/epics/BylineWithHeadshot.tsx
Outdated
Show resolved
Hide resolved
url: string; | ||
}): JSX.Element => { | ||
const [iframeHeight, setIframeHeight] = useState(60); | ||
const iframeRef = useRef<HTMLIFrameElement>(null); |
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.
@arelra made me aware that it’s probably best to useCallback
for this, and make sure your useEffect
has iframeRef
as part of its dependencies array.
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.
Nice, I think I'll do this in a follow up PR though
const markerTranslate = (goal / end) * 100 - 100; | ||
const markerTransform = `translate3d(${markerTranslate}%, 0, 0)`; | ||
|
||
return <div css={goalMarkerStyles(markerTransform)} />; |
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.
Not a blocker, but as per Emotion best practice, you should use the style prop for dynamic styles.
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.
👍 health card created
rootMargin: '-18px', | ||
threshold: 0, |
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 I ask why we picked a negative root margin, which shrinks the intersection area, rather than increase the threshold?
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.
Good question - I don't know! I think this is something to play with after this PR
window.requestAnimationFrame(() => { | ||
setRunningTotal((prevRunningTotal) => { | ||
const newRunningTotal = | ||
prevRunningTotal + Math.floor(total / 100); | ||
|
||
if (newRunningTotal > total) { | ||
return total; | ||
} | ||
|
||
return newRunningTotal; | ||
}); | ||
}); |
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.
It’s curious that this does not rely on a clock, but rather on the speed at which the device is able to request animation frames…
08ddada
to
d745b77
Compare
d745b77
to
84124be
Compare
Background
Currently our marketing components (epic, banner, header links) live in SDC. The SDC repo also has the server that does targeting/AB testing of marketing messages.
We want to move the client-side components from SDC to DCR.
So far, only the liveblog epic has been migrated to DCR:
#9538
Changes
This PR migrates the standard article epic.
As with the liveblog epic, the files have been copied over largely unchanged (besides import and linting fixes).
Note - this does remove the Apple Pay button feature from the epic. This was AB tested last year but is not currently in use. Migrating it to DCR would have made this PR a bit more involved so I'm leaving it out. If we change our minds later then we can do the work to add it back in. Original SDC PR.
Size
Before (from S3):
After (webpack chunk):
Screenshots from CODE
(Plenty more in storybook)