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

[fides.js] Fix button arrangement #4407

Merged
merged 13 commits into from
Nov 10, 2023
Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The types of changes are:
- "is_service_specific" default updated when building TC strings on the backend [#4377](https://github.com/ethyca/fides/pull/4377)
- "isServiceSpecific" default updated when building TC strings on the frontend [#4384](https://github.com/ethyca/fides/pull/4384)
- Redact cli, database, and redis configuration information from GET api/v1/config API request responses. [#4379](https://github.com/ethyca/fides/pull/4379)
- Button ordering in fides.js UI [#4407](https://github.com/ethyca/fides/pull/4407)

## [2.23.3](https://github.com/ethyca/fides/compare/2.23.2...2.23.3)

Expand Down
26 changes: 9 additions & 17 deletions clients/fides-js/src/components/ConsentButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentChildren, h, VNode } from "preact";
import { h, VNode } from "preact";
import Button from "./Button";
import {
ButtonType,
Expand All @@ -7,27 +7,24 @@ import {
PrivacyNotice,
ExperienceConfig,
} from "../lib/consent-types";
import PrivacyPolicyLink from "./PrivacyPolicyLink";

export const ConsentButtons = ({
experienceConfig,
onManagePreferencesClick,
firstButton,
middleButton,
onAcceptAll,
onRejectAll,
children,
isMobile,
includePrivacyPolicy,
}: {
experienceConfig: ExperienceConfig;
onManagePreferencesClick?: () => void;
firstButton?: VNode;
/** Used to add a button between the "manage preferences" button and the "accept/reject" buttons */
middleButton?: VNode;
onAcceptAll: () => void;
onRejectAll: () => void;
/** Added as siblings to the button group after the "accept/reject" buttons */
children?: ComponentChildren;
isMobile: boolean;
includePrivacyPolicy?: boolean;
}) => (
<div id="fides-button-group">
{onManagePreferencesClick ? (
Expand All @@ -39,7 +36,9 @@ export const ConsentButtons = ({
/>
</div>
) : null}
{middleButton || null}
{includePrivacyPolicy ? (
<PrivacyPolicyLink experience={experienceConfig} />
) : null}
<div
className={
firstButton ? "fides-modal-button-group" : "fides-banner-button-group"
Expand All @@ -57,7 +56,6 @@ export const ConsentButtons = ({
onClick={onAcceptAll}
/>
</div>
{children}
</div>
);

Expand All @@ -70,8 +68,6 @@ interface NoticeConsentButtonProps {
enabledKeys: NoticeKeys;
isAcknowledge: boolean;
isInModal?: boolean;
children?: ComponentChildren;
middleButton?: VNode;
isMobile: boolean;
Comment on lines -73 to -74
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 glad these are gone!

}

Expand All @@ -82,8 +78,6 @@ export const NoticeConsentButtons = ({
enabledKeys,
isInModal,
isAcknowledge,
children,
middleButton,
isMobile,
}: NoticeConsentButtonProps) => {
if (!experience.experience_config || !experience.privacy_notices) {
Expand Down Expand Up @@ -138,10 +132,8 @@ export const NoticeConsentButtons = ({
/>
) : undefined
}
middleButton={middleButton}
isMobile={isMobile}
>
{children}
</ConsentButtons>
includePrivacyPolicy={!isInModal}
/>
);
};
11 changes: 3 additions & 8 deletions clients/fides-js/src/components/fides.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
--fides-overlay-container-border-radius: 12px;
--fides-overlay-component-border-radius: 4px;
--fides-overlay-banner-offset: 48px;
--fides-banner-font-size-title: var(--16px);
Kelsey-Ethyca marked this conversation as resolved.
Show resolved Hide resolved
}

div#fides-overlay {
Expand Down Expand Up @@ -182,7 +183,7 @@ div#fides-banner-heading {
}

div#fides-banner-title {
font-size: var(--fides-overlay-font-size-title);
font-size: var(--fides-banner-font-size-title);
font-weight: 600;
line-height: 1.5em;
min-width: 33%;
Expand Down Expand Up @@ -1001,12 +1002,6 @@ div#fides-banner-inner .fides-privacy-policy {
border-width: 1px 0 0 0;
padding: 24px 40px 40px 40px;
}
.fides-tcf-banner-container
div#fides-banner
div#fides-banner-inner
div#fides-button-group {
justify-content: flex-start;
}
.fides-tcf-banner-container #fides-privacy-policy-link {
margin-left: auto;
margin: auto;
}
1 change: 0 additions & 1 deletion clients/fides-js/src/components/notices/NoticeOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ const NoticeOverlay: FunctionComponent<OverlayProps> = ({
onSave();
}}
isAcknowledge={isAllNoticeOnly}
middleButton={<PrivacyPolicyLink experience={experienceConfig} />}
isMobile={isMobile}
/>
)}
Expand Down
11 changes: 5 additions & 6 deletions clients/fides-js/src/components/tcf/TcfConsentButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentChildren, VNode, h } from "preact";
import { VNode, h } from "preact";

import { PrivacyExperience } from "../../lib/consent-types";
import { ConsentButtons } from "../ConsentButtons";
Expand All @@ -9,8 +9,8 @@ interface TcfConsentButtonProps {
onManagePreferencesClick?: () => void;
onSave: (keys: EnabledIds) => void;
firstButton?: VNode;
children?: ComponentChildren;
isMobile: boolean;
includePrivacyPolicy?: boolean;
}

const getAllIds = (modelList: TcfModels) => {
Expand All @@ -25,8 +25,8 @@ export const TcfConsentButtons = ({
onManagePreferencesClick,
onSave,
firstButton,
children,
isMobile,
includePrivacyPolicy,
}: TcfConsentButtonProps) => {
if (!experience.experience_config) {
return null;
Expand Down Expand Up @@ -71,8 +71,7 @@ export const TcfConsentButtons = ({
onRejectAll={handleRejectAll}
firstButton={firstButton}
isMobile={isMobile}
>
{children}
</ConsentButtons>
includePrivacyPolicy={includePrivacyPolicy}
/>
);
};
5 changes: 2 additions & 3 deletions clients/fides-js/src/components/tcf/TcfOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,8 @@ const TcfOverlay: FunctionComponent<OverlayProps> = ({
onSave();
}}
isMobile={isMobile}
>
<PrivacyPolicyLink experience={experienceConfig} />
</TcfConsentButtons>
includePrivacyPolicy
/>
)}
className="fides-tcf-banner-container"
>
Expand Down
Loading