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

Phase 2 CSS improvements for consent banner and overlay #4334

Merged
merged 11 commits into from
Oct 25, 2023
Merged

Conversation

galvana
Copy link
Contributor

@galvana galvana commented Oct 24, 2023

Closes #4274

Description Of Changes

This PR focused on:

  • Making the banners and overlays responsive
  • Breaking up the modal into a header, body, and footer to be able to style custom headers and footers

I tried to make the layout changes with just CSS but there were enough differences between the desktop and mobile layouts that I think it made sense to have an isMobile prop to conditionally render the components instead of trying to nest them or modify them with CSS.

Code Changes

  • Added an isMobile state to the ConsentBanner.tsx
    • To position the button group in a different location based on the screen width
    • Change the manage preferences link to a button in the mobile view
  • Refactored the ConsentModal.tsx to use fides-modal-header, fides-modal-body, and fides-modal-footer
  • Misc CSS fixes

Steps to Confirm

Pre-Merge Checklist

  • All CI Pipelines Succeeded
  • Issue Requirements are Met
  • Update CHANGELOG.md

@galvana galvana linked an issue Oct 24, 2023 that may be closed by this pull request
@cypress
Copy link

cypress bot commented Oct 24, 2023

Passing run #4838 ↗︎

0 4 0 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

Merge b3e5248 into 0dfa690...
Project: fides Commit: 4ef92cc204 ℹ️
Status: Passed Duration: 00:55 💡
Started: Oct 25, 2023 10:40 PM Ended: Oct 25, 2023 10:41 PM

Review all test suite changes for PR #4334 ↗︎

@galvana galvana marked this pull request as ready for review October 25, 2023 00:09
@galvana
Copy link
Contributor Author

galvana commented Oct 25, 2023

Hey @allisonking, heads up, I just made a tiny fix to the drop-down carets, they were being pushed out of the div if the corresponding text was too wide 279a9d1

@allisonking
Copy link
Contributor

Got it, starting review now!

@allisonking
Copy link
Contributor

small thing—could we add a lil bit of margin right to the iab tcf tag in small viewports? it seems to run into the legint toggle a bit
image

Copy link
Contributor

@allisonking allisonking left a comment

Choose a reason for hiding this comment

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

tested it out and it's looking nice, great work! a few comments but nothing blocking. largest thing might be the carets in firefox

}) => {
const [isMobile, setIsMobile] = useState(window.innerWidth < 768);
Copy link
Contributor

Choose a reason for hiding this comment

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

can we put 768 as a constant somewhere?

Copy link
Contributor

Choose a reason for hiding this comment

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

this whole state + useEffect could go into hooks.ts to keep this component cleaner


useEffect(() => {
const handleResize = () => {
setIsMobile(window.innerWidth < 768);
Copy link
Contributor

Choose a reason for hiding this comment

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

a lil bit of repeated code here—could pull out into a func? or at least make the 768 a reused constant

renderModalFooter={() =>
renderModalFooter({
onClose: handleCloseModal,
isMobile: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

hm why is this false?

min-height: 40px;
align-items: center;

& svg {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this kind of nesting doesn't work in firefox 😢

see firefox on left, chrome on right
image

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm on firefox 116 (which is a little out of date) which doesn't support it, seems to only be a recent thing https://caniuse.com/css-nesting

/>
) : null
}
renderModalContent={({ onClose }) => (
renderModalContent={() => (
Copy link
Contributor

Choose a reason for hiding this comment

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

if this no longer needs an argument, I think it'd be cleaner to revert it back to a component, i.e.

modalContent={
  <div>
  ...
  </div>
}

or even to let this be children

@galvana
Copy link
Contributor Author

galvana commented Oct 25, 2023

small thing—could we add a lil bit of margin right to the iab tcf tag in small viewports? it seems to run into the legint toggle a bit

Nice catch! The tag should be left-aligned even for the small viewports
image

@galvana
Copy link
Contributor Author

galvana commented Oct 25, 2023

Thanks for the review @allisonking 🙏 I addressed the visual issues but in the interest of time, I'm moving the code-cleanup recommendations to the next sprint. I'll address them when I come back from break.

@galvana galvana merged commit 5761526 into main Oct 25, 2023
7 of 9 checks passed
@galvana galvana deleted the PROD-1173 branch October 25, 2023 22:43
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.

CSS customization - Phase 2
2 participants