Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

add banner variant to Overlay#117

Merged
Osmose merged 4 commits intomasterfrom
anjali/add-variant-to-overlay
Jul 10, 2020
Merged

add banner variant to Overlay#117
Osmose merged 4 commits intomasterfrom
anjali/add-variant-to-overlay

Conversation

@anjapatel
Copy link
Copy Markdown

This PR adds a banner variant for Overlay. The goal is to create an Overlay option that looks close to the one in this design spec: https://www.figma.com/file/LLBMwcB37R4fQrn7kgZKUi/061820_PrivateApps_MI%2BKAC?node-id=34%3A0

This introduces new variants in block.js for this Overlay banner, specifically. I commented above the relevant banners to hopefully make this clearer.

How to Test

  1. Go to overlay.js
  2. Add variant={'banner'} to the Overlay, Title, and Info components
  3. Add variant={'alignright'} to the Actions component
  4. When you open an overlay, it should look like the overlay in the attached screenshot:

Screen Shot 2020-07-09 at 8 43 58 PM

5. Test in dark mode!

@anjapatel anjapatel requested a review from Osmose July 10, 2020 00:51
Copy link
Copy Markdown
Contributor

@Osmose Osmose left a comment

Choose a reason for hiding this comment

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

Nice work, thanks for the PR!

One difference I noted between the normal overlay in master and in this branch is that the title bar has a white background instead of grey; we should fix that so that existing overlays don't change appearance at all.

lib/block.js Outdated
color: var(--colors-primary);
background-color: var(--colors-background);
`,
alignright: css`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This variant also removes the background color and top border, so we should probably also name it "banner" since it's more than just alignment.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Is alignrightbanner okay? Can also do actionsbanner because it would only be used there. I'm thrown errors when I try to hyphenate and I'm not sure if camel case is the convention here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ohhh how about actionsbanner and infobanner under sectionVariants ?

Comment on lines +148 to +151
<p>
The Overlay component renders an accessible modal. See <a href="#Story_Blocks_for_Overlay_and_Popover_content">blocks to use with Overlays</a>
.
</p>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we add a second button to the story docs showing the variant overlay and how to use it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes!

@jlord
Copy link
Copy Markdown

jlord commented Jul 10, 2020

Will the dropshadow, buttons and 'X' be updated to match the design in Figma in this PR?

@anjapatel
Copy link
Copy Markdown
Author

Will the dropshadow, buttons and 'X' be updated to match the design in Figma in this PR?

@jlord I missed the dropshadow on the Overlay, so I will pull that out in this PR! The "X" can just be deleted and the buttons can be styled independently, but I can make everything look like the Figma design in the example button I'm adding in now!

@ackristen
Copy link
Copy Markdown

@anjapatel this looks great! Just want to call out typography and spacing feedback:
(I'm not viewing this locally just referencing the screen shot so forgive me if it's already correct!)

  • Body copy: 14px
  • Heading: 16px
  • Spacing: 6px between heading and body and then 24px between body and buttons

@jlord
Copy link
Copy Markdown

jlord commented Jul 10, 2020

@ackristen question on the radius of the modal: in Figma on its own it's shown with rounded corners on each corner but in the screenshot of it in the editor, there is no to top radius.

@ackristen
Copy link
Copy Markdown

@ackristen question on the radius of the modal: in Figma on its own it's shown with rounded corners on each corner but in the screenshot of it in the editor, there is no to top radius.

Originally:
In the editor, I imagined it sitting flush below the editor header.

Update:
I found another place to use this component within the private project experience so we can keep the radius on all 4 corners.

Sorry for the confusion!

@anjapatel
Copy link
Copy Markdown
Author

anjapatel commented Jul 10, 2020

@ackristen is this looking better?
Screen Shot 2020-07-10 at 1 10 56 PM

Edit: I did put 6px of space between the header and body, but it does look a little more spaced out than the figma. I'm combing through now in case there's some extra padding somewhere. Let me know if this is on the right track!

@ackristen
Copy link
Copy Markdown

@ackristen is this looking better?
Screen Shot 2020-07-10 at 1 10 56 PM

Edit: I did put 6px of space between the header and body, but it does look a little more spaced out than the figma. I'm combing through now in case there's some extra padding somewhere. Let me know if this is on the right track!

This looks good to me! I'm happy with it 👏

Copy link
Copy Markdown
Contributor

@Osmose Osmose left a comment

Choose a reason for hiding this comment

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

Looks good, nice work! Once the fix for useOverlay is in we can land this.

lib/overlay.js Outdated
Comment on lines +138 to +149
export const useOverlay = () => {
const [open, setOpen] = React.useState(false);
const [openNormal, setOpenNormal] = React.useState(false);
const [openBanner, setOpenBanner] = React.useState(false);
const toggleRef = React.useRef();
const onOpen = () => setOpen(true);
const onOpenNormal = () => setOpenNormal(true);
const onOpenBanner = () => setOpenBanner(true);
const onClose = () => {
setOpen(false);
setOpenNormal(false);
setOpenBanner(false);
toggleRef.current.focus();
};
return { open, onOpen, onClose, toggleRef };
return { openNormal, onOpenNormal, openBanner, onOpenBanner, onClose, toggleRef };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

useOverlay is actually exported for use outside shared-components, so we shouldn't add a second set of state values since it's meant to handle a single overlay. We can call it twice in StoryOverlay, though, once for each overlay.

@anjapatel
Copy link
Copy Markdown
Author

Also @ackristen, this new overlay style is positioned against the top of the browser window. Is this okay? The overlay is positioned relative to the browser so it would take a lot more time for me to find a way to work around that.

If this doesn't work for what you have in mind for the future, let me know! Maybe I can add this style variant to a different component that's easier to position.

@Osmose
Copy link
Copy Markdown
Contributor

Osmose commented Jul 10, 2020

Approved via Slack.

@Osmose Osmose merged commit 94b502b into master Jul 10, 2020
@Osmose Osmose deleted the anjali/add-variant-to-overlay branch July 10, 2020 20:54
@keithk
Copy link
Copy Markdown
Contributor

keithk commented Nov 10, 2020

🚀 PR was released in v0.19.0 🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants