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

enable isFilled on <Notification/> #258

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export const notificationPreview: ComponentPreview = {
},
],
},
{
type: "checkbox",
prop: "isFilled",
label: "Filled",
},
{
type: "select",
prop: "children",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { linkPreview } from "@site/src/componentPreview/linkPreview";
import { loaderPreview } from "@site/src/componentPreview/loaderPreview";
import { modalPreview } from "@site/src/componentPreview/modalPreview";
import { navButtonPreview } from "@site/src/componentPreview/navButtonPreview";
import { notificationPreview } from "@site/src/componentPreview/notificationPreview ";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was an empty space between the file name and .tsx

import { notificationPreview } from "@site/src/componentPreview/notificationPreview";
import { paginationPreview } from "@site/src/componentPreview/paginationPreview";
import { profilePreview } from "@site/src/componentPreview/profilePreview";
import { projectLogoPreview } from "@site/src/componentPreview/projectLogoPreview";
Expand Down
10 changes: 9 additions & 1 deletion @stellar/design-system/src/components/Notification/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export interface NotificationProps {
title: string;
/** Notification icon @defaultValue `<Icon.InfoCircle />` */
icon?: React.ReactNode;
/** Notification background */
isFilled?: boolean;
/** Notification message */
children?: string | React.ReactNode;
}
Expand All @@ -30,10 +32,16 @@ export const Notification: React.FC<Props> = ({
variant,
title,
icon,
isFilled,
children,
}: NotificationProps) => {
const additionalClasses = [
`Notification--${variant}`,
...(isFilled ? [`Notification--filled`] : []),
].join(" ");

return (
<div className={`Notification Notification--${variant}`}>
<div className={`Notification ${additionalClasses}`}>
<div className="Notification__title">
<div className="Notification__title__icon">
{icon ? icon : <Icon.InfoCircle />}
Expand Down
14 changes: 13 additions & 1 deletion @stellar/design-system/src/components/Notification/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,31 @@
--Notification-color-border: var(--sds-clr-gray-06);
--Notification-color-icon: var(--sds-clr-green-09);
--Notification-color-action: var(--sds-clr-green-11);

&.Notification--filled {
--Notification-color-background: var(--sds-clr-green-03);
}
}

&--error {
--Notification-color-background: var(--sds-clr-red-02);
--Notification-color-background: var(--sds-clr-gray-01);
--Notification-color-border: var(--sds-clr-gray-06);
--Notification-color-icon: var(--sds-clr-red-09);
--Notification-color-action: var(--sds-clr-red-11);

&.Notification--filled {
--Notification-color-background: var(--sds-clr-red-02);
}
}

&--warning {
--Notification-color-background: var(--sds-clr-gray-01);
--Notification-color-border: var(--sds-clr-gray-06);
--Notification-color-icon: var(--sds-clr-amber-09);
--Notification-color-action: var(--sds-clr-amber-11);

&.Notification--filled {
--Notification-color-background: var(--sds-clr-amber-03);
}
}
}
Loading