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

Refactor to use css variables that match brandable color palette #3321

Merged
merged 44 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
55d6757
Bare bones modal
allisonking May 11, 2023
3521a9d
Attempt to make NoticeToggleTable a react component
allisonking May 11, 2023
8cb47c7
Try using react as a dependency
allisonking May 11, 2023
54d30bf
Fix linting errors
allisonking May 12, 2023
4ceec4c
Fixup configs
allisonking May 12, 2023
b1c7886
Refactor button to be shared between modal and banner
allisonking May 12, 2023
41032c1
Initial toggle component
allisonking May 12, 2023
2c0ccd3
Modal styling
allisonking May 12, 2023
0ddc5c4
Fix rollup configuration
allisonking May 12, 2023
a704d3e
Add React as dependency
allisonking May 15, 2023
858626e
Hook up toggle logic
allisonking May 15, 2023
f8c7581
Fix cy test
allisonking May 15, 2023
7d24726
Clean up modal a bit
allisonking May 15, 2023
3044c62
Attempt to export NoticeToggleTable
allisonking May 15, 2023
d1dc0fe
Add test for triggering the banner
allisonking May 15, 2023
5beaf2a
Add divider and close modal on save
allisonking May 16, 2023
f55a860
Add accordion expanding
allisonking May 16, 2023
7e13023
Add cypress test for toggling notices
allisonking May 17, 2023
85dab8c
Format
allisonking May 17, 2023
b1c0a3e
Accessibiilty fixes on toggle
allisonking May 17, 2023
c4e3eb3
Update package.json to include react-dom
allisonking May 17, 2023
d2643b1
Update name to NoticeToggles
allisonking May 17, 2023
744cc4f
Update changelog
allisonking May 17, 2023
1bb87f6
Merge branch 'main' into aking/3162/pc-experience
allisonking May 17, 2023
3d8950b
Rename css file to overlay.module.css
allisonking May 17, 2023
1b9f373
Refactor css file with new vars
allisonking May 17, 2023
5f50519
Update cypress test
allisonking May 17, 2023
b883cd2
Update changelog
allisonking May 17, 2023
d7433f1
Derive other colors from initial variables
allisonking May 18, 2023
205da25
Only open the modal from the banner
allisonking May 18, 2023
a5a579b
Pass all submit handlers through Overlay
allisonking May 18, 2023
82337e6
Refactor cookie logic
allisonking May 18, 2023
f485941
Read consent preferences from cookie
allisonking May 18, 2023
55e6ca7
Update cypress tests to test for notice toggling cookies
allisonking May 18, 2023
243ef98
Add cookie unit tests
allisonking May 18, 2023
4e7eeb3
Merge branch 'main' into aking/3162/pc-experience
allisonking May 18, 2023
313fe01
Add preferences.ts to streamline preference saving
allisonking May 18, 2023
168ed0c
Restore setting win obj
allisonking May 18, 2023
fe4008f
Use primary button color for secondary button border
allisonking May 19, 2023
2bdaf91
Merge branch 'main' into aking/3258/css-variables
allisonking May 19, 2023
10774da
Merge branch 'aking/3162/pc-experience' into aking/3258/css-variables
allisonking May 19, 2023
8287648
Merge branch 'main' into aking/3258/css-variables
allisonking May 22, 2023
0b13272
Give components straight edges
allisonking May 22, 2023
a8fcf67
Merge branch 'main' into aking/3258/css-variables
allisonking May 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The types of changes are:
- Remove logging within the Celery creation function [#3303](https://github.com/ethyca/fides/pull/3303)
- Update how generic endpoint generation works [#3304](https://github.com/ethyca/fides/pull/3304)
- Restrict strack-trace logging when not in Dev mode [#3081](https://github.com/ethyca/fides/pull/3081)
- Refactor CSS variables for `fides-js` to match brandable color palette [#3321](https://github.com/ethyca/fides/pull/3321)
- Moved all of the dirs from `fides.api.ops` into `fides.api` [#3318](https://github.com/ethyca/fides/pull/3318)

### Added
Expand Down
6 changes: 3 additions & 3 deletions clients/fides-js/src/components/ConsentBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { h, FunctionComponent } from "preact";
import { useState, useEffect } from "preact/hooks";
import { ButtonType, ExperienceConfig } from "../lib/consent-types";
import Button from "./Button";
import "../lib/banner.module.css";
import "../lib/overlay.module.css";
import { useHasMounted } from "../lib/hooks";

interface BannerProps {
Expand Down Expand Up @@ -74,12 +74,12 @@ const ConsentBanner: FunctionComponent<BannerProps> = ({
className="fides-consent-banner-buttons"
>
<Button
buttonType={ButtonType.TERTIARY}
buttonType={ButtonType.SECONDARY}
label={managePreferencesLabel}
onClick={handleManagePreferencesClick}
/>
<Button
buttonType={ButtonType.SECONDARY}
buttonType={ButtonType.PRIMARY}
label={rejectButtonLabel}
onClick={() => {
onRejectAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,56 @@
* Default CSS styles for the banner
*/
:root {
--fides-consent-overlay-font-family: inherit;
--fides-consent-overlay-font-size: 16px;
--fides-consent-overlay-font-size-title: 18px;
--fides-consent-overlay-background: #fff;
--fides-consent-overlay-text-color: #24292f;
--fides-consent-overlay-padding: 0.75em 2em 1em;

--fides-consent-overlay-button-background: #eee;
--fides-consent-overlay-button-text-color: #24292f;
--fides-consent-overlay-button-hover-background: #ccc;
--fides-consent-overlay-button-border-radius: 4px;
--fides-consent-overlay-button-padding: 0.5em 1em;

--fides-consent-overlay-button-primary-background: #464b83;
--fides-consent-overlay-button-primary-text-color: #fff;
--fides-consent-overlay-button-primary-hover-background: #3f4375;

--fides-consent-overlay-button-secondary-background: var(
--fides-consent-overlay-button-background
/* Colors */
--fides-consent-overlay-primary-color: #8243f2;
--fides-consent-overlay-background-color: #f7fafc;
--fides-consent-overlay-font-color: #4a5568;
--fides-consent-overlay-hover-color: #edf2f7;
/* Buttons */
--fides-consent-overlay-primary-button-background-color: var(
--fides-consent-overlay-primary-color
);
--fides-consent-overlay-button-secondary-text-color: var(
--fides-consent-overlay-button-text-color
--fides-consent-overlay-primary-button-background-hover-color: #9569f4;
--fides-consent-overlay-primary-button-text-color: #ffffff;
--fides-consent-overlay-primary-button-border-color: transparent;
--fides-consent-overlay-secondary-button-background-color: var(
--fides-consent-overlay-background-color
);
--fides-consent-overlay-button-secondary-hover-background: var(
--fides-consent-overlay-button-hover-background
--fides-consent-overlay-secondary-button-background-hover-color: var(
--fides-consent-overlay-hover-color
);

--fides-consent-overlay-button-tertiary-background: var(
--fides-consent-overlay-button-background
--fides-consent-overlay-secondary-button-text-color: #2d3748;
--fides-consent-overlay-secondary-button-border-color: var(
--fides-consent-overlay-primary-color
);
--fides-consent-overlay-button-tertiary-text-color: var(
--fides-consent-overlay-button-text-color
/* Text */
--fides-consent-overlay-title-font-color: var(
--fides-consent-overlay-font-color
);
--fides-consent-overlay-button-tertiary-hover-background: var(
--fides-consent-overlay-button-hover-background
--fides-consent-overlay-body-font-color: var(
--fides-consent-overlay-font-color
);
/* Switches */
--fides-consent-overlay-primary-active-color: var(
--fides-consent-overlay-primary-color
);

/* In progress(fides#3258): start to transition to updated design colors */
--fides-consent-overlay-primary-color: #8243f2;
--fides-consent-overlay-background-color: #f7fafc;
--fides-consent-overlay-primary-active-color: #824ef2;
--fides-consent-overlay-primary-active-disabled-color: #bda4f7;
--fides-consent-overlay-inactive-color: #cbd5e0;
--fides-consent-overlay-disabled-color: #e1e7ee;
/* Dividers */
--fides-consent-overlay-row-divider-color: #e2e8f0;
--fides-consent-overlay-row-hover-color: #edf2f7;
--fides-consent-overlay-row-hover-color: var(
--fides-consent-overlay-hover-color
);

/* Everything else */
--fides-consent-overlay-font-family: "inherit";
--fides-consent-overlay-font-size: 16px;
--fides-consent-overlay-font-size-title: 18px;
--fides-consent-overlay-padding: 0.75em 2em 1em;
--fides-consent-overlay-button-border-radius: 4px;
--fides-consent-overlay-button-padding: 0.5em 1em;
allisonking marked this conversation as resolved.
Show resolved Hide resolved
--fides-consent-overlay-component-border-radius: 0px;
}

#fides-consent-modal-link {
Expand All @@ -57,10 +61,12 @@
div#fides-consent-banner {
font-family: var(--fides-consent-overlay-font-family);
font-size: var(--fides-consent-overlay-font-size);
background: var(--fides-consent-overlay-background);
color: var(--fides-consent-overlay-text-color);
background: var(--fides-consent-overlay-background-color);
color: var(--fides-consent-overlay-body-font-color);
box-sizing: border-box;
padding: var(--fides-consent-overlay-padding);
border: 1px solid var(--fides-consent-overlay-primary-color);
border-radius: var(--fides-consent-overlay-component-border-radius);

display: flex;
flex-direction: row;
Expand Down Expand Up @@ -102,6 +108,7 @@ div#fides-consent-banner-title {
margin-right: 2em;
min-width: 33%;
flex: 1;
color: var(--fides-consent-overlay-title-font-color);
}

div#fides-consent-banner-description {
Expand All @@ -126,9 +133,9 @@ button.fides-consent-banner-button {
margin-top: 0.25em;
margin-right: 0.5em;
padding: var(--fides-consent-overlay-button-padding);
background: var(--fides-consent-overlay-button-background);
color: var(--fides-consent-overlay-button-text-color);
border: none;
background: var(--fides-consent-overlay-primary-button-background-color);
color: var(--fides-consent-overlay-primary-button-text-color);
border: 1px solid;
border-radius: var(--fides-consent-overlay-button-border-radius);

font-family: inherit;
Expand All @@ -138,48 +145,45 @@ button.fides-consent-banner-button {
}

button.fides-consent-banner-button:hover {
background: var(--fides-consent-overlay-button-hover-background);
background: var(
--fides-consent-overlay-primary-button-background-hover-color
);
}

button.fides-consent-banner-button.fides-consent-banner-button-primary {
background: var(--fides-consent-overlay-button-primary-background);
color: var(--fides-consent-overlay-button-primary-text-color);
background: var(--fides-consent-overlay-primary-button-background-color);
color: var(--fides-consent-overlay-primary-button-text-color);
border: none;
}

button.fides-consent-banner-button.fides-consent-banner-button-primary:hover {
background: var(--fides-consent-overlay-button-primary-hover-background);
background: var(
--fides-consent-overlay-primary-button-background-hover-color
);
}

button.fides-consent-banner-button.fides-consent-banner-button-secondary {
background: var(--fides-consent-overlay-button-secondary-background);
color: var(--fides-consent-overlay-button-secondary-text-color);
background: var(--fides-consent-overlay-secondary-button-background-color);
color: var(--fides-consent-overlay-secondary-button-text-color);
border: 1px solid var(--fides-consent-overlay-primary-button-background-color);
}

button.fides-consent-banner-button.fides-consent-banner-button-secondary:hover {
background: var(--fides-consent-overlay-button-secondary-hover-background);
}

button.fides-consent-banner-button.fides-consent-banner-button-tertiary {
background: var(--fides-consent-overlay-button-tertiary-background);
color: var(--fides-consent-overlay-button-tertiary-text-color);
}

button.fides-consent-banner-button.fides-consent-banner-button-tertiary:hover {
background: var(--fides-consent-overlay-button-tertiary-hover-background);
background: var(
--fides-consent-overlay-secondary-button-background-hover-color
);
}

/** Modal */
div#fides-consent-modal {
font-family: var(--fides-consent-overlay-font-family);
font-size: var(--fides-consent-overlay-font-size);
background: var(--fides-consent-overlay-background);
color: var(--fides-consent-overlay-text-color);
color: var(--fides-consent-overlay-body-font-color);
box-sizing: border-box;
padding: var(--fides-consent-overlay-padding);
border: 1px solid var(--fides-consent-overlay-primary-color);
background-color: var(--fides-consent-overlay-background-color);
/* TODO: make dynamic? */
border-radius: 6px;
border-radius: var(--fides-consent-overlay-component-border-radius);
max-height: 100%;
max-width: 100%;
/* TODO: use a system for z-indexes */
Expand All @@ -192,7 +196,8 @@ div#fides-consent-modal {

.modal-header {
text-align: center;
font-size: 1.2rem;
font-size: var(--fides-consent-overlay-font-size-title);
color: var(--fides-consent-overlay-title-font-color);
}

.modal-button-group {
Expand Down
10 changes: 5 additions & 5 deletions clients/privacy-center/cypress/e2e/consent-banner.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,21 @@ describe("Consent banner", () => {
"div#fides-consent-banner-buttons.fides-consent-banner-buttons"
).within(() => {
cy.get(
"button#fides-consent-banner-button-tertiary.fides-consent-banner-button.fides-consent-banner-button-tertiary"
"button#fides-consent-banner-button-secondary.fides-consent-banner-button.fides-consent-banner-button-secondary"
).contains("Manage preferences");
cy.get(
"button#fides-consent-banner-button-secondary.fides-consent-banner-button.fides-consent-banner-button-secondary"
"button#fides-consent-banner-button-primary.fides-consent-banner-button.fides-consent-banner-button-primary"
).contains("Reject Test");
cy.get(
"button#fides-consent-banner-button-primary.fides-consent-banner-button.fides-consent-banner-button-primary"
).contains("Accept Test");
// Order matters - it should always be tertiary, then secondary, then primary!
// Order matters - it should always be secondary, then primary!
cy.get("button")
.eq(0)
.should("have.id", "fides-consent-banner-button-tertiary");
.should("have.id", "fides-consent-banner-button-secondary");
cy.get("button")
.eq(1)
.should("have.id", "fides-consent-banner-button-secondary");
.should("have.id", "fides-consent-banner-button-primary");
cy.get("button")
.eq(2)
.should("have.id", "fides-consent-banner-button-primary");
Expand Down