diff --git a/apps/browser/src/autofill/content/components/lit-stories/notification/at-risk-notification/container.lit-stories.ts b/apps/browser/src/autofill/content/components/lit-stories/notification/at-risk-notification/container.lit-stories.ts
index e66edc5122f..1c5860ad7dd 100644
--- a/apps/browser/src/autofill/content/components/lit-stories/notification/at-risk-notification/container.lit-stories.ts
+++ b/apps/browser/src/autofill/content/components/lit-stories/notification/at-risk-notification/container.lit-stories.ts
@@ -2,7 +2,6 @@ import { Meta, StoryObj } from "@storybook/web-components";
import { ThemeTypes } from "@bitwarden/common/platform/enums";
-import { NotificationTypes } from "../../../../../notification/abstractions/notification-bar";
import {
AtRiskNotification,
AtRiskNotificationProps,
@@ -10,19 +9,15 @@ import {
import { mockI18n, mockBrowserI18nGetMessage } from "../../mock-data";
export default {
- title: "Components/Notifications/AtRiskNotification",
+ title: "Components/Notifications/At-Risk Notification",
argTypes: {
- error: { control: "text" },
theme: { control: "select", options: [...Object.values(ThemeTypes)] },
- type: { control: "select", options: [NotificationTypes.AtRiskPassword] },
},
args: {
- error: "",
- type: NotificationTypes.AtRiskPassword,
theme: ThemeTypes.Light,
handleCloseNotification: () => alert("Close notification action triggered"),
params: {
- passwordChangeUri: "https://webtests.dev", // Remove to see "navigate" version of notification
+ passwordChangeUri: "webtests.dev", // Remove to see "navigate" version of notification
organizationName: "Acme Co.",
},
i18n: mockI18n,
diff --git a/apps/browser/src/autofill/content/components/notification/at-risk-password/body.ts b/apps/browser/src/autofill/content/components/notification/at-risk-password/body.ts
index 062a7e50c1a..3cc08a26210 100644
--- a/apps/browser/src/autofill/content/components/notification/at-risk-password/body.ts
+++ b/apps/browser/src/autofill/content/components/notification/at-risk-password/body.ts
@@ -1,40 +1,49 @@
+import createEmotion from "@emotion/css/create-instance";
import { html, nothing } from "lit";
import { Theme } from "@bitwarden/common/platform/enums";
+import { spacing, themes } from "../../constants/styles";
import { Warning } from "../../illustrations";
-import { iconContainerStyles, notificationConfirmationBodyStyles } from "../confirmation/body";
import { AtRiskNotificationMessage } from "./message";
-export const componentClassPrefix = "notification-confirmation-body";
+export const componentClassPrefix = "at-risk-notification-body";
+
+const { css } = createEmotion({
+ key: componentClassPrefix,
+});
export type AtRiskNotificationBodyProps = {
- confirmationMessage: string;
- messageDetails?: string;
+ riskMessage: string;
theme: Theme;
- handleOpenVault: (e: Event) => void;
};
-export function AtRiskNotificationBody({
- confirmationMessage,
- messageDetails,
- theme,
- handleOpenVault,
-}: AtRiskNotificationBodyProps) {
- const showConfirmationMessage = confirmationMessage || messageDetails;
-
+export function AtRiskNotificationBody({ riskMessage, theme }: AtRiskNotificationBodyProps) {
return html`
-
-
${Warning()}
- ${showConfirmationMessage
+
+
${Warning()}
+ ${riskMessage
? AtRiskNotificationMessage({
- message: confirmationMessage,
- messageDetails,
+ message: riskMessage,
theme,
- handleClick: handleOpenVault,
})
: nothing}
`;
}
+
+const iconContainerStyles = css`
+ > svg {
+ width: 50px;
+ height: auto;
+ }
+`;
+const atRiskNotificationBodyStyles = ({ theme }: { theme: Theme }) => css`
+ gap: ${spacing[4]};
+ display: flex;
+ align-items: center;
+ justify-content: flex-start;
+ background-color: ${themes[theme].background.alt};
+ padding: 12px;
+`;
diff --git a/apps/browser/src/autofill/content/components/notification/at-risk-password/container.ts b/apps/browser/src/autofill/content/components/notification/at-risk-password/container.ts
index 64382bb4653..90da0833fd9 100644
--- a/apps/browser/src/autofill/content/components/notification/at-risk-password/container.ts
+++ b/apps/browser/src/autofill/content/components/notification/at-risk-password/container.ts
@@ -1,16 +1,15 @@
+import { css } from "@emotion/css";
import { html, nothing } from "lit";
-import { ThemeTypes } from "@bitwarden/common/platform/enums";
+import { Theme, ThemeTypes } from "@bitwarden/common/platform/enums";
-import {
- AtRiskPasswordNotificationParams,
- NotificationBarIframeInitData,
- NotificationType,
- NotificationTypes,
-} from "../../../../notification/abstractions/notification-bar";
+import { NotificationBarIframeInitData } from "../../../../notification/abstractions/notification-bar";
import { I18n } from "../../common-types";
-import { notificationContainerStyles } from "../confirmation/container";
-import { NotificationHeader } from "../header";
+import { themes, spacing } from "../../constants/styles";
+import {
+ NotificationHeader,
+ componentClassPrefix as notificationHeaderClassPrefix,
+} from "../header";
import { AtRiskNotificationBody } from "./body";
import { AtRiskNotificationFooter } from "./footer";
@@ -18,37 +17,32 @@ import { AtRiskNotificationFooter } from "./footer";
export type AtRiskNotificationProps = NotificationBarIframeInitData & {
handleCloseNotification: (e: Event) => void;
} & {
- error?: string;
i18n: I18n;
- type: NotificationType;
- params: AtRiskPasswordNotificationParams;
};
export function AtRiskNotification({
handleCloseNotification,
i18n,
theme = ThemeTypes.Light,
- type,
params,
}: AtRiskNotificationProps) {
- const headerMessage = getHeaderMessage(i18n, type);
const { passwordChangeUri, organizationName } = params;
+ const riskMessage = chrome.i18n.getMessage(
+ passwordChangeUri ? "atRiskChangePrompt" : "atRiskNavigatePrompt",
+ organizationName,
+ );
return html`
-
+
${NotificationHeader({
handleCloseNotification,
i18n,
- message: headerMessage,
+ message: i18n.atRiskPassword,
theme,
})}
${AtRiskNotificationBody({
theme,
- handleOpenVault: () => {},
- confirmationMessage: chrome.i18n.getMessage(
- passwordChangeUri ? "atRiskChangePrompt" : "atRiskNavigatePrompt",
- organizationName,
- ),
+ riskMessage,
})}
${passwordChangeUri
? AtRiskNotificationFooter({
@@ -61,6 +55,18 @@ export function AtRiskNotification({
`;
}
-function getHeaderMessage(i18n: I18n, type?: NotificationType) {
- return type === NotificationTypes.AtRiskPassword ? i18n.atRiskPassword : undefined;
-}
+const atRiskNotificationContainerStyles = (theme: Theme) => css`
+ position: absolute;
+ right: 20px;
+ border: 1px solid ${themes[theme].secondary["300"]};
+ border-radius: ${spacing["4"]};
+ box-shadow: -2px 4px 6px 0px #0000001a;
+ background-color: ${themes[theme].background.alt};
+ width: 400px;
+ overflow: hidden;
+
+ [class*="${notificationHeaderClassPrefix}-"] {
+ border-radius: ${spacing["4"]} ${spacing["4"]} 0 0;
+ border-bottom: 0.5px solid ${themes[theme].secondary["300"]};
+ }
+`;
diff --git a/apps/browser/src/autofill/content/components/notification/at-risk-password/footer.ts b/apps/browser/src/autofill/content/components/notification/at-risk-password/footer.ts
index 30b7567a48b..31a9f62f257 100644
--- a/apps/browser/src/autofill/content/components/notification/at-risk-password/footer.ts
+++ b/apps/browser/src/autofill/content/components/notification/at-risk-password/footer.ts
@@ -1,3 +1,4 @@
+import { css } from "@emotion/css";
import { html } from "lit";
import { Theme } from "@bitwarden/common/platform/enums";
@@ -5,8 +6,7 @@ import { Theme } from "@bitwarden/common/platform/enums";
import { ActionButton } from "../../buttons/action-button";
import { AdditionalTasksButtonContent } from "../../buttons/additional-tasks/button-content";
import { I18n } from "../../common-types";
-// Utilizes default notification styles, not confirmation.
-import { notificationFooterStyles } from "../footer";
+import { spacing } from "../../constants/styles";
export type AtRiskNotificationFooterProps = {
i18n: I18n;
@@ -19,7 +19,7 @@ export function AtRiskNotificationFooter({
theme,
passwordChangeUri,
}: AtRiskNotificationFooterProps) {
- return html`