diff --git a/packages/main/src/components/Notification/Notification.test.tsx b/packages/main/src/components/Notification/Notification.test.tsx
index 0ad2c6bc6c9..39d47bc766a 100644
--- a/packages/main/src/components/Notification/Notification.test.tsx
+++ b/packages/main/src/components/Notification/Notification.test.tsx
@@ -38,20 +38,12 @@ describe('Notification', () => {
datetime="1337 Minutes ago"
avatar="ME"
priority={Priority.High}
- visible
- hideShowMoreButton={false}
- showCloseButton
truncate
/>
);
expect(wrapper).toMatchSnapshot();
});
- test('Hidden', () => {
- const wrapper = renderThemedComponent();
- expect(wrapper).toMatchSnapshot();
- });
-
test('w/ custom Avatar', () => {
const wrapper = renderThemedComponent(
} />
diff --git a/packages/main/src/components/Notification/__snapshots__/Notification.test.tsx.snap b/packages/main/src/components/Notification/__snapshots__/Notification.test.tsx.snap
index e507efef423..e9c33899561 100644
--- a/packages/main/src/components/Notification/__snapshots__/Notification.test.tsx.snap
+++ b/packages/main/src/components/Notification/__snapshots__/Notification.test.tsx.snap
@@ -70,8 +70,6 @@ exports[`Notification Default 1`] = `
`;
-exports[`Notification Hidden 1`] = `null`;
-
exports[`Notification Long Title and Description 1`] = `
(
datetime={text('datetime', 'Datetime')}
avatar={
}
priority={select('priority', Priority, Priority.None)}
- visible={boolean('visible', true)}
onClick={action('Notification clicked')}
- hideShowMoreButton={boolean('hideShowMoreButton', false)}
+ noShowMoreButton={boolean('noShowMoreButton', false)}
truncate={boolean('truncate', true)}
- showCloseButton={boolean('showCloseButton', true)}
+ noCloseButton={boolean('noCloseButton', false)}
onClose={action('Closed')}
/>
);
diff --git a/packages/main/src/components/Notification/index.tsx b/packages/main/src/components/Notification/index.tsx
index 6857a776db6..554d19d9436 100644
--- a/packages/main/src/components/Notification/index.tsx
+++ b/packages/main/src/components/Notification/index.tsx
@@ -27,19 +27,15 @@ export interface NotificationProptypes extends CommonProps {
loading?: boolean;
datetime?: string;
priority?: Priority;
- showCloseButton?: boolean;
- visible?: boolean;
+ noCloseButton?: boolean;
onClick?: (e: any) => any;
- hideShowMoreButton?: boolean;
+ noShowMoreButton?: boolean;
truncate?: boolean;
onClose?: (event: Event) => void;
children?: React.ReactElement
| React.ReactElement[];
collapsed?: boolean;
autoPriority?: boolean;
-
- isChild?: boolean;
- isLastChild?: boolean;
}
const useStyles = createUseStyles>(styles, { name: 'Notification' });
@@ -56,31 +52,24 @@ const Notification: FC = forwardRef(
datetime,
avatar,
priority,
- visible,
onClick,
children,
collapsed,
className,
tooltip,
style,
- isChild,
- isLastChild,
autoPriority,
- hideShowMoreButton,
+ noShowMoreButton,
truncate,
- showCloseButton,
+ noCloseButton,
onClose
} = props;
const classes = useStyles(props);
- const [visibleState, toggleVisible] = useState(visible);
+ const [visibleState, toggleVisible] = useState(true);
const [showChildren, toggleChildrenVisible] = useState(!collapsed);
const [showMore, toggleShowMore] = useState(!truncate);
- useEffect(() => {
- toggleVisible(visible);
- }, [visible]);
-
useEffect(() => {
toggleChildrenVisible(!collapsed);
}, [collapsed]);
@@ -129,6 +118,9 @@ const Notification: FC = forwardRef(
toggleShowMore(!showMore);
}, [showMore]);
+ const isLastChild = props['isLastChild'];
+ const isChild = props['isChild'];
+
const notificationContainerStyles = useMemo(() => {
const borderRadius = () => {
if (isChild) {
@@ -211,11 +203,13 @@ const Notification: FC = forwardRef(
return React.Children.map(children, (item, index) => {
if (React.Children.count(children) === index + 1) {
return React.cloneElement(item, {
+ // @ts-ignore
isLastChild: true,
className: `${item.props.className} ${classes.notificationContainerChild}`
});
}
return React.cloneElement(item, {
+ // @ts-ignore
isChild: true,
className: `${item.props.className} ${classes.notificationContainerChild}`
});
@@ -256,7 +250,7 @@ const Notification: FC = forwardRef(
{renderSemanticIcon}
)}
{title}
- {showCloseButton && (
+ {!noCloseButton && (
- {!hideShowMoreButton && (
+ {!noShowMoreButton && (
@@ -311,9 +305,7 @@ const Notification: FC
= forwardRef(
);
Notification.defaultProps = {
- visible: true,
- truncate: true,
- showCloseButton: true
+ truncate: true
};
Notification.displayName = 'Notification';
diff --git a/packages/main/src/components/NotificationGroup/Notification.test.tsx b/packages/main/src/components/NotificationGroup/NotificationGroup.test.tsx
similarity index 99%
rename from packages/main/src/components/NotificationGroup/Notification.test.tsx
rename to packages/main/src/components/NotificationGroup/NotificationGroup.test.tsx
index b1d09035437..6b5ace37824 100644
--- a/packages/main/src/components/NotificationGroup/Notification.test.tsx
+++ b/packages/main/src/components/NotificationGroup/NotificationGroup.test.tsx
@@ -34,9 +34,6 @@ describe('NotificationGroup', () => {
datetime="1337 Minutes ago"
avatar="ME"
priority={Priority.High}
- visible
- hideShowMoreButton={false}
- showCloseButton
truncate
/>
} />
@@ -76,9 +73,6 @@ describe('NotificationGroup', () => {
datetime="1337 Minutes ago"
avatar="ME"
priority={Priority.High}
- visible
- hideShowMoreButton={false}
- showCloseButton
truncate
/>
} />
@@ -104,9 +98,6 @@ describe('NotificationGroup', () => {
datetime="1337 Minutes ago"
avatar="ME"
priority={Priority.High}
- visible
- hideShowMoreButton={false}
- showCloseButton
truncate
/>
} />
@@ -132,9 +123,6 @@ describe('NotificationGroup', () => {
datetime="1337 Minutes ago"
avatar="ME"
priority={Priority.High}
- visible
- hideShowMoreButton={false}
- showCloseButton
truncate
>
diff --git a/packages/main/src/components/NotificationGroup/__snapshots__/Notification.test.tsx.snap b/packages/main/src/components/NotificationGroup/__snapshots__/NotificationGroup.test.tsx.snap
similarity index 100%
rename from packages/main/src/components/NotificationGroup/__snapshots__/Notification.test.tsx.snap
rename to packages/main/src/components/NotificationGroup/__snapshots__/NotificationGroup.test.tsx.snap
diff --git a/packages/main/src/components/NotificationGroup/demo.stories.tsx b/packages/main/src/components/NotificationGroup/demo.stories.tsx
index 5a4244d82aa..e39b526d1f5 100644
--- a/packages/main/src/components/NotificationGroup/demo.stories.tsx
+++ b/packages/main/src/components/NotificationGroup/demo.stories.tsx
@@ -31,12 +31,11 @@ export const defaultStory = () => (
datetime={text('datetime', 'Datetime')}
avatar={}
priority={select('priority', Priority, Priority.None)}
- visible={boolean('visible', true)}
onClick={action('Notification clicked')}
- hideShowMoreButton={boolean('hideShowMoreButton', false)}
+ noShowMoreButton={boolean('noShowMoreButton', false)}
autoPriority={boolean('autoPriority', true)}
collapsed={boolean('collapsed', false)}
- showCloseButton={boolean('showCloseButton', true)}
+ noCloseButton={boolean('noCloseButton', false)}
truncate={boolean('truncate', true)}
onClose={action('Group closed')}
>
@@ -47,8 +46,6 @@ export const defaultStory = () => (
authorName="Author"
avatar="LH"
priority={Priority.Medium}
- visible={true}
- showCloseButton={false}
truncate={boolean('truncate', true)}
/>
(
title="Very long Title. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
authorName="Author"
priority={Priority.Low}
- visible={true}
onClick={action('Child Notification clicked')}
- showCloseButton={false}
+ noCloseButton={true}
truncate={boolean('truncate', true)}
/>
diff --git a/packages/main/src/components/NotificationGroup/index.tsx b/packages/main/src/components/NotificationGroup/index.tsx
index 4e6865d09c8..f1a31154e94 100644
--- a/packages/main/src/components/NotificationGroup/index.tsx
+++ b/packages/main/src/components/NotificationGroup/index.tsx
@@ -11,10 +11,8 @@ const NotificationGroup: FC = forwardRef(
);
NotificationGroup.defaultProps = {
- visible: true,
autoPriority: true,
- truncate: true,
- showCloseButton: true
+ truncate: true
};
NotificationGroup.displayName = 'Notification Group';