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

DOP-5132: Support image-less banners and add TypeScript support #1318

Merged
merged 25 commits into from
Dec 5, 2024

Conversation

rayangler
Copy link
Collaborator

@rayangler rayangler commented Dec 4, 2024

Stories/Links:

DOP-5132

Current Behavior:

Atlas prod
Landing prod

Staging Links:

Atlas staging
Landing staging

Notes:

  • Adds support for customizing the banner text, pill text, and background color of the banner while keeping existing banner styles. Design has LGTM'd this on Slack. For testing purposes, the banner-dev value on Atlas App Services has been updated with the new fields.
  • This maintains backwards compatibility with image-based banners, in case there is a really custom design that needs to be hosted immediately.
  • ADDS INITIAL TYPESCRIPT SUPPORT. I promised to start incrementally adding TS support whenever I touched components, so this is the start 😤. This does end up increasing the scope of the PR a bit, but I tried to limit the changes to initial setup (with linting, formatting, testing, etc.) and to the site banner components. This should not negatively impact current usage of the frontend. Just run npm ci and things should build as it does currently. If it is preferred to split this into a separate PR, please let me know!

README updates

    • This PR introduces changes that should be reflected in the README, and I have made those updates.
    • This PR does not introduce changes that should be reflected in the README

Copy link

netlify bot commented Dec 4, 2024

Deploy Preview for docs-frontend-stg ready!

Name Link
🔨 Latest commit ddc4f4d
🔍 Latest deploy log https://app.netlify.com/sites/docs-frontend-stg/deploys/6751d72d308582000851bdf2
😎 Deploy Preview https://deploy-preview-1318--docs-frontend-stg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Dec 4, 2024

Deploy Preview for docs-frontend-dotcomprd ready!

Name Link
🔨 Latest commit ddc4f4d
🔍 Latest deploy log https://app.netlify.com/sites/docs-frontend-dotcomprd/deploys/6751d72dce28be0008af1cec
😎 Deploy Preview https://deploy-preview-1318--docs-frontend-dotcomprd.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Dec 4, 2024

Deploy Preview for docs-frontend-dotcomstg ready!

Name Link
🔨 Latest commit ddc4f4d
🔍 Latest deploy log https://app.netlify.com/sites/docs-frontend-dotcomstg/deploys/6751d72de4a59b0008fd2f6c
😎 Deploy Preview https://deploy-preview-1318--docs-frontend-dotcomstg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was effectively replaced with src/components/SiteBanner/index.tsx

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Replaced by tests/unit/__snapshots__/SiteBanner.test.tsx.snap. If anyone knows how to get GH to cooperate with these name changes and git mv commands, please let me know 🙃

@@ -34,6 +40,8 @@
"jest-environment-jsdom": "^29.5.0",
"lint-staged": "^10.5.4",
"prettier": "^2.2.1",
"ts-jest": "^29.2.5",
"typescript": "<5.4.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Limiting the typescript version due to a bunch of incompatibility warnings and issues from babel-eslint and required TS linting parser/plugin. I tried to make config changes as minimal as possible for now, but we should have more flexibility on this once we get the chance to upgrade our linter (DOP-5057)

@rayangler rayangler marked this pull request as ready for review December 4, 2024 23:03
@rayangler rayangler requested review from seungpark and mmeigs December 4, 2024 23:03
Copy link
Collaborator

@mmeigs mmeigs left a comment

Choose a reason for hiding this comment

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

Ohhh this is very exciting about Typescript. Also, the banner looks great!


@media ${theme.screenSize.upToMedium} {
background-image: url(${getBannerSource(bannerContent.tabletImgPath)});
gap: 104px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just curious on why tablet size has such a large gap

Copy link
Collaborator Author

@rayangler rayangler Dec 5, 2024

Choose a reason for hiding this comment

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

The Figma design showed a gap of 104px, but thinking about it now, seems like the intention is to just have the brand shape and pill be on the righthand side. I've updated the CSS to ensure the flex container has space-between instead to make it more flexible. Thanks for bringing this up and let me know what you think!

try {
const res: SiteBannerContent = await fetchBanner(snootyEnv);
// Guard against missing banner content
if (res && (res.imgPath || res.text)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I'm wondering if we also want to guard against res.url not existing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point! Added!

@rayangler rayangler requested a review from mmeigs December 5, 2024 15:15
Copy link
Collaborator

@seungpark seungpark left a comment

Choose a reason for hiding this comment

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

minor comments below but overall looks great! TS is very exciting! 🙌

src/types.ts Outdated Show resolved Hide resolved
src/components/Banner/SiteBanner/index.tsx Outdated Show resolved Hide resolved
src/components/Banner/SiteBanner/index.tsx Outdated Show resolved Hide resolved
max-height: 40px;

@media ${theme.screenSize.upToMedium} {
max-width: 543px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need these max widths? the flexbox + gap should handle the width of the text box

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think keeping the max width around would help make the max width guidelines included in the design more explicit vs. relying solely on flexbox/gap. Would it be preferable to remove?

Copy link
Collaborator

Choose a reason for hiding this comment

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

minor preference, but don't feel too strongly about it!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

src/components/Banner/SiteBanner/index.tsx Outdated Show resolved Hide resolved
@rayangler rayangler requested a review from seungpark December 5, 2024 16:27
@rayangler rayangler merged commit bf047c1 into main Dec 5, 2024
14 checks passed
@rayangler rayangler deleted the DOP-5132-seamless-banner branch December 5, 2024 17:12
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.

3 participants