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