diff --git a/apps/ui/components/common/PageWrapper.tsx b/apps/ui/components/common/PageWrapper.tsx
index b394f84ea..422c5686c 100644
--- a/apps/ui/components/common/PageWrapper.tsx
+++ b/apps/ui/components/common/PageWrapper.tsx
@@ -35,10 +35,7 @@ function PageWrapper({
-
+
{children}
diff --git a/packages/common/src/components/BannerNotificationsList.tsx b/packages/common/src/components/BannerNotificationsList.tsx
index aa2a55374..7930480bd 100644
--- a/packages/common/src/components/BannerNotificationsList.tsx
+++ b/packages/common/src/components/BannerNotificationsList.tsx
@@ -17,14 +17,12 @@ import { filterNonNullable } from "../helpers";
type BannerNotificationListProps = {
target: BannerNotificationTarget;
displayAmount?: number;
- centered?: boolean;
};
-type BannerNotificationItemProps = {
+type NotificationsListItemProps = {
notification: BannerNotificationCommonFragment;
closeFn: React.Dispatch>;
closedArray: string[];
- centered?: boolean;
};
const PositionWrapper = styled.div`
@@ -63,8 +61,7 @@ function NotificationsListItem({
notification,
closeFn,
closedArray,
- centered,
-}: BannerNotificationItemProps) {
+}: NotificationsListItemProps) {
let notificationType: NotificationType;
switch (notification.level) {
case "EXCEPTION":
@@ -80,7 +77,6 @@ function NotificationsListItem({
{
// no-cache is required because admin is caching bannerNotifications query and
// there is no key setup for this so this query returns garbage from the admin cache.
@@ -174,7 +169,6 @@ const BannerNotificationsList = ({
notification={notification}
closedArray={closedNotificationsList ?? []}
closeFn={setClosedNotificationsList}
- centered={centered}
/>
))}
diff --git a/packages/common/src/components/NotificationWrapper.tsx b/packages/common/src/components/NotificationWrapper.tsx
index 0ba641b4c..a1ff1c359 100644
--- a/packages/common/src/components/NotificationWrapper.tsx
+++ b/packages/common/src/components/NotificationWrapper.tsx
@@ -1,41 +1,35 @@
-import React from "react";
+import React, { useState } from "react";
import styled from "styled-components";
import { Notification, NotificationProps } from "hds-react";
-import { breakpoints } from "../common/style";
type NotificationPropsWithCentering = NotificationProps & {
centered?: boolean;
- "data-testid"?: string;
};
-const Wrapper = styled.div<{ $centerContent?: boolean }>`
- > section > div {
- max-width: calc(${breakpoints.xl} - (2 * var(--spacing-m)));
- margin: 0 ${(props) => (props.$centerContent ? "auto" : "0")} !important;
+const StyledNotification = styled(Notification)<{ $centerContent?: boolean }>`
+ > div {
+ max-width: var(--tilavaraus-page-max-width);
+ margin: 0 ${(props) => (props.$centerContent ? "auto" : "0")};
}
`;
function NotificationWrapper(
props: NotificationPropsWithCentering
): JSX.Element | null {
- const [isVisible, setIsVisible] = React.useState(true);
+ const [isVisible, setIsVisible] = useState(true);
- // data-testid passed to the HDS component is not passed to the DOM
- // pass it to the div wrapper instead
- const testId = props["data-testid"];
if (!isVisible) {
return null;
}
return (
-
- {
- setIsVisible(false);
- props.onClose?.();
- }}
- />
-
+ {
+ setIsVisible(false);
+ props.onClose?.();
+ }}
+ />
);
}