mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
PM-18522 Adjust Confirmation UI text to accommodate truncating (#13639)
* PM-18522 adjust styling * add text to action button * address type errors and fix storybook
This commit is contained in:
@@ -9,6 +9,7 @@ type Args = {
|
||||
notificationType: NotificationType;
|
||||
theme: Theme;
|
||||
handleSaveAction: (e: Event) => void;
|
||||
i18n: { [key: string]: string };
|
||||
};
|
||||
|
||||
export default {
|
||||
@@ -23,6 +24,11 @@ export default {
|
||||
args: {
|
||||
theme: ThemeTypes.Light,
|
||||
notificationType: "add",
|
||||
i18n: {
|
||||
saveAsNewLoginAction: "Save as New Login",
|
||||
saveAction: "Save",
|
||||
},
|
||||
handleSaveAction: () => alert("Save action triggered"),
|
||||
},
|
||||
parameters: {
|
||||
design: {
|
||||
|
||||
@@ -7,15 +7,18 @@ import { ButtonRow } from "../../rows/button-row";
|
||||
type Args = {
|
||||
theme: Theme;
|
||||
buttonAction: (e: Event) => void;
|
||||
buttonText: string;
|
||||
};
|
||||
|
||||
export default {
|
||||
title: "Components/Rows/Button Row",
|
||||
argTypes: {
|
||||
theme: { control: "select", options: [...Object.values(ThemeTypes)] },
|
||||
buttonText: { control: "text" },
|
||||
},
|
||||
args: {
|
||||
theme: ThemeTypes.Light,
|
||||
buttonText: "Action",
|
||||
},
|
||||
} as Meta<Args>;
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ const baseTextStyles = css`
|
||||
text-align: left;
|
||||
text-overflow: ellipsis;
|
||||
line-height: 24px;
|
||||
white-space: nowrap;
|
||||
font-family: "DM Sans", sans-serif;
|
||||
font-size: 16px;
|
||||
`;
|
||||
|
||||
@@ -56,5 +56,4 @@ const notificationConfirmationBodyStyles = ({ theme }: { theme: Theme }) => css`
|
||||
justify-content: flex-start;
|
||||
background-color: ${themes[theme].background.alt};
|
||||
padding: 12px;
|
||||
white-space: nowrap;
|
||||
`;
|
||||
|
||||
@@ -58,6 +58,7 @@ export function NotificationContainer({
|
||||
handleSaveAction,
|
||||
theme,
|
||||
notificationType: type,
|
||||
i18n,
|
||||
})}
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -15,14 +15,16 @@ export function NotificationFooter({
|
||||
handleSaveAction,
|
||||
notificationType,
|
||||
theme,
|
||||
i18n,
|
||||
}: {
|
||||
handleSaveAction: (e: Event) => void;
|
||||
i18n: { [key: string]: string };
|
||||
notificationType?: NotificationType;
|
||||
theme: Theme;
|
||||
}) {
|
||||
const isChangeNotification = notificationType === NotificationTypes.Change;
|
||||
// @TODO localize
|
||||
const saveNewItemText = "Save as new login";
|
||||
const saveNewItemText = i18n.saveAsNewLoginAction;
|
||||
const buttonText = i18n.saveAction;
|
||||
|
||||
return html`
|
||||
<div class=${notificationFooterStyles({ theme })}>
|
||||
@@ -32,7 +34,7 @@ export function NotificationFooter({
|
||||
handleAction: handleSaveAction,
|
||||
theme,
|
||||
})
|
||||
: ButtonRow({ theme, buttonAction: handleSaveAction })}
|
||||
: ButtonRow({ theme, buttonAction: handleSaveAction, buttonText })}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -11,16 +11,18 @@ import { DropdownMenu } from "../dropdown-menu";
|
||||
export function ButtonRow({
|
||||
theme,
|
||||
buttonAction,
|
||||
buttonText,
|
||||
}: {
|
||||
theme: Theme;
|
||||
buttonAction: (e: Event) => void;
|
||||
buttonText: string;
|
||||
}) {
|
||||
return html`
|
||||
<div class=${buttonRowStyles}>
|
||||
${[
|
||||
ActionButton({
|
||||
buttonAction: buttonAction,
|
||||
buttonText: "Action Button",
|
||||
buttonText,
|
||||
theme,
|
||||
}),
|
||||
DropdownContainer({
|
||||
|
||||
Reference in New Issue
Block a user