Skip to content

Commit

Permalink
NEO-1804 PR #2 (#242)
Browse files Browse the repository at this point in the history
* Completed preliminary re-factor of Notification Component: re-worked CSS, provided for more modular actions, created new timestamp, badge and text truncation features, allowed for inline vs not-inline functionality, updated stories

* Commented out failing Notification tests to re-work in second PR

* Added temporary test to quiet test suite error until new tests written in PR 2

* Added missing CSS style

* Update src/components/Notification/Notification.tsx

Include default value for `navigator` object

Co-authored-by: JoeS <55896546+joe-s-avaya@users.noreply.github.com>

* Switched inline styles out for class name

* Commiting changes in progress in order to switch to previous branch

* Changed font size and color for timestamp, used Neo typography classes for same

* Picke up design feedback on PR

* Changed variable name as per feedback

* Continued re-building Notification Component - updated tests, added logic for improved text truncation, added aria-label translations

* Ran yarn all

* Ran yarn all

* Restored use of PopUpManager, re-factored truncation logic to fix issues w/ using PopUpManager and description text wrapping, picked up misc. feedback suggestions

* Re-factored truncation behavior to avoid unnecessary dependencies in Component, added Tooltip to Badge, fixed bug in truncation behavior

* Allowed for default/custom width in PopUpManager

* Removed console.logs, renamed function for clarity

* git doesn't like changing capitalization of file names

* Fixed missing logic in textWidth function

---------

Co-authored-by: JoeS <55896546+joe-s-avaya@users.noreply.github.com>
  • Loading branch information
mrazian85 and joe-s-avaya committed Aug 28, 2023
1 parent 7551994 commit 7d15726
Show file tree
Hide file tree
Showing 18 changed files with 638 additions and 462 deletions.
2 changes: 1 addition & 1 deletion badges/badge-branches.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion badges/badge-functions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion badges/badge-lines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion badges/badge-statements.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { Button } from "components/Button";

import { SecondaryButtonProps } from "./ButtonActionTypes";

export const SecondaryButton = ({
children,
notificationType = "info",
...rest
}: SecondaryButtonProps) => {
return (
<Button
className="neo-notification__button"
size="compact"
variant="secondary"
status={notificationType}
{...rest}
>
{children}
Expand Down
6 changes: 5 additions & 1 deletion src/components/Notification/Actions/CounterAction.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export type CounterActionProps = { count: string };
export const CounterAction = ({ count }: CounterActionProps) => {
return <div className="neo-notification__counter">{count}</div>;
return (
<div className="neo-notification__counter" aria-label={count}>
{count}
</div>
);
};
7 changes: 7 additions & 0 deletions src/components/Notification/EventNotification.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ Event.args = {
header: "Event",
description: "This is an event.",
isElevated: true,
isInline: true,
actions: {
closable: {
onClick: () => alert("closed"),
"aria-label": "Click this button will close this notification",
},
},
};

export const EventCloseAlert = EventTemplate.bind({});
Expand Down
1 change: 1 addition & 0 deletions src/components/Notification/Helpers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./translations";
15 changes: 15 additions & 0 deletions src/components/Notification/Helpers/translations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export interface INotificationTranslations {
icon: string;
badge: string;
textTruncation: string;
closeAction: string;
counterAction: string;
}

export const defaultTranslations: INotificationTranslations = {
icon: "icon",
badge: "Badge representing number of times notification has occured: ",
textTruncation: "Expand/collapse",
closeAction: "Close notification",
counterAction: "Counter: ",
};
6 changes: 5 additions & 1 deletion src/components/Notification/NonEventNotification.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const Info: Story = {
header: "Info",
description: "This is some info.",
isElevated: false,
isInline: true,
},
};

Expand All @@ -31,6 +32,7 @@ export const Success: Story = {
header: "Success",
description: "You are successful.",
isElevated: true,
isInline: true,
},
};

Expand All @@ -40,6 +42,7 @@ export const Warning: Story = {
header: "Warning",
description: "This is a warning.",
isElevated: true,
isInline: true,
},
};

Expand All @@ -49,6 +52,7 @@ export const Alert: Story = {
header: "Alert",
description: "This is an alert.",
isElevated: false,
isInline: true,
},
};

Expand All @@ -57,6 +61,7 @@ export const AlertCloseAlert: Story = {
type: "alert",
header: "Alert",
description: "This is an alert.",
isInline: true,
actions: {
closable: {
onClick: () => alert("closed"),
Expand All @@ -74,7 +79,6 @@ export const AlertCounter: Story = {
description:
"Body copy placeholder, single line of text before it is truncated. Body copy placeholder, single line of text before it is truncated. Body copy placeholder, single line of text before it is truncated.",
isElevated: false,
isInline: false,
occurences: 4,
actions: {
closable: {
Expand Down
Loading

0 comments on commit 7d15726

Please sign in to comment.