1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 22:03:36 +00:00
This commit is contained in:
Daniel Riera
2025-05-08 15:12:13 -04:00
committed by GitHub
parent b56cfba5bf
commit 61243c68e2
6 changed files with 34 additions and 20 deletions

View File

@@ -29,7 +29,9 @@ export function CipherInfo({ cipher, theme }: CipherInfoProps) {
</span> </span>
${login?.username ${login?.username
? html`<span class=${cipherInfoSecondaryTextStyles(theme)}>${login.username}</span>` ? html`<span title=${login.username} class=${cipherInfoSecondaryTextStyles(theme)}
>${login.username}</span
>`
: null} : null}
</div> </div>
`; `;

View File

@@ -3,7 +3,7 @@ import { html, nothing } from "lit";
import { Theme } from "@bitwarden/common/platform/enums"; import { Theme } from "@bitwarden/common/platform/enums";
import { themes } from "../../constants/styles"; import { spacing, themes } from "../../constants/styles";
import { Celebrate, Keyhole, Warning } from "../../illustrations"; import { Celebrate, Keyhole, Warning } from "../../illustrations";
import { NotificationConfirmationMessage } from "./message"; import { NotificationConfirmationMessage } from "./message";
@@ -66,7 +66,7 @@ const iconContainerStyles = (error?: string) => css`
} }
`; `;
const notificationConfirmationBodyStyles = ({ theme }: { theme: Theme }) => css` const notificationConfirmationBodyStyles = ({ theme }: { theme: Theme }) => css`
gap: 16px; gap: ${spacing[4]};
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;

View File

@@ -43,7 +43,7 @@ export function NotificationConfirmationContainer({
type, type,
}: NotificationConfirmationContainerProps) { }: NotificationConfirmationContainerProps) {
const headerMessage = getHeaderMessage(i18n, type, error); const headerMessage = getHeaderMessage(i18n, type, error);
const confirmationMessage = getConfirmationMessage(i18n, itemName, type, error); const confirmationMessage = getConfirmationMessage(i18n, type, error);
const buttonText = error ? i18n.newItem : i18n.view; const buttonText = error ? i18n.newItem : i18n.view;
const buttonAria = chrome.i18n.getMessage("notificationViewAria", [itemName]); const buttonAria = chrome.i18n.getMessage("notificationViewAria", [itemName]);
@@ -109,19 +109,13 @@ const notificationContainerStyles = (theme: Theme) => css`
} }
`; `;
function getConfirmationMessage( function getConfirmationMessage(i18n: I18n, type?: NotificationType, error?: string) {
i18n: I18n,
itemName: string,
type?: NotificationType,
error?: string,
) {
const loginSaveConfirmation = chrome.i18n.getMessage("loginSaveConfirmation", [itemName]);
const loginUpdatedConfirmation = chrome.i18n.getMessage("loginUpdatedConfirmation", [itemName]);
if (error) { if (error) {
return i18n.saveFailureDetails; return i18n.saveFailureDetails;
} }
return type === NotificationTypes.Add ? loginSaveConfirmation : loginUpdatedConfirmation; return type === NotificationTypes.Add
? i18n.loginSaveConfirmation
: i18n.loginUpdatedConfirmation;
} }
function getHeaderMessage(i18n: I18n, type?: NotificationType, error?: string) { function getHeaderMessage(i18n: I18n, type?: NotificationType, error?: string) {

View File

@@ -3,7 +3,7 @@ import { html, nothing } from "lit";
import { Theme } from "@bitwarden/common/platform/enums"; import { Theme } from "@bitwarden/common/platform/enums";
import { themes, typography } from "../../constants/styles"; import { spacing, themes, typography } from "../../constants/styles";
export type NotificationConfirmationMessageProps = { export type NotificationConfirmationMessageProps = {
buttonAria?: string; buttonAria?: string;
@@ -18,15 +18,17 @@ export type NotificationConfirmationMessageProps = {
export function NotificationConfirmationMessage({ export function NotificationConfirmationMessage({
buttonAria, buttonAria,
buttonText, buttonText,
itemName,
message, message,
messageDetails, messageDetails,
handleClick, handleClick,
theme, theme,
}: NotificationConfirmationMessageProps) { }: NotificationConfirmationMessageProps) {
return html` return html`
<div> <div class=${containerStyles}>
${message || buttonText ${message || buttonText
? html` ? html`
<span class=${itemNameStyles(theme)} title=${itemName}> ${itemName} </span>
<span <span
title=${message || buttonText} title=${message || buttonText}
class=${notificationConfirmationMessageStyles(theme)} class=${notificationConfirmationMessageStyles(theme)}
@@ -57,8 +59,15 @@ export function NotificationConfirmationMessage({
`; `;
} }
const containerStyles = css`
display: flex;
flex-wrap: wrap;
align-items: center;
gap: ${spacing[1]};
width: 100%;
`;
const baseTextStyles = css` const baseTextStyles = css`
flex-grow: 1;
overflow-x: hidden; overflow-x: hidden;
text-align: left; text-align: left;
text-overflow: ellipsis; text-overflow: ellipsis;
@@ -74,6 +83,15 @@ const notificationConfirmationMessageStyles = (theme: Theme) => css`
font-weight: 400; font-weight: 400;
`; `;
const itemNameStyles = (theme: Theme) => css`
${baseTextStyles}
color: ${themes[theme].text.main};
font-weight: 400;
white-space: nowrap;
max-width: 300px;
`;
const notificationConfirmationButtonTextStyles = (theme: Theme) => css` const notificationConfirmationButtonTextStyles = (theme: Theme) => css`
${baseTextStyles} ${baseTextStyles}

View File

@@ -4,7 +4,7 @@ import { html } from "lit";
import { Theme, ThemeTypes } from "@bitwarden/common/platform/enums"; import { Theme, ThemeTypes } from "@bitwarden/common/platform/enums";
import { CloseButton } from "../buttons/close-button"; import { CloseButton } from "../buttons/close-button";
import { themes } from "../constants/styles"; import { spacing, themes } from "../constants/styles";
import { BrandIconContainer } from "../icons/brand-icon-container"; import { BrandIconContainer } from "../icons/brand-icon-container";
import { NotificationHeaderMessage } from "./header-message"; import { NotificationHeaderMessage } from "./header-message";
@@ -47,7 +47,7 @@ const notificationHeaderStyles = ({
standalone: boolean; standalone: boolean;
theme: Theme; theme: Theme;
}) => css` }) => css`
gap: 8px; gap: ${spacing[2]};
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;

View File

@@ -51,7 +51,7 @@ export function ButtonRow({ theme, primaryButton, selectButtons }: ButtonRowProp
} }
const buttonRowStyles = css` const buttonRowStyles = css`
gap: 16px; gap: ${spacing[4]};
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;