agroptima-design-system 1.2.0-beta.0 → 1.2.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
|
|
145
145
|
.notification-center {
|
|
146
146
|
width: 100%;
|
|
147
|
-
height:
|
|
147
|
+
height: 93vh;
|
|
148
148
|
|
|
149
149
|
.notification-header {
|
|
150
150
|
.notification-header-title {
|
|
@@ -153,8 +153,16 @@
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
.notification-list {
|
|
156
|
+
height: 100%;
|
|
157
|
+
background-color: var(--neutral-white);
|
|
156
158
|
max-height: 100vh;
|
|
157
159
|
}
|
|
160
|
+
|
|
161
|
+
.notification-line {
|
|
162
|
+
&.empty-state {
|
|
163
|
+
height: 100%;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
158
166
|
}
|
|
159
167
|
}
|
|
160
168
|
}
|
|
@@ -16,7 +16,7 @@ function NotificationEmptyState({
|
|
|
16
16
|
className,
|
|
17
17
|
}: NotificationEmptyStateProps) {
|
|
18
18
|
return (
|
|
19
|
-
<div className={classNames('notification-line', className)}>
|
|
19
|
+
<div className={classNames('notification-line', 'empty-state', className)}>
|
|
20
20
|
<div className="notification-line-head">
|
|
21
21
|
<span className="notification-line-title">
|
|
22
22
|
<Icon variant="success" name="Check" />
|
|
@@ -20,12 +20,12 @@ const meta = {
|
|
|
20
20
|
description: {
|
|
21
21
|
component:
|
|
22
22
|
'<h2>Usage guidelines</h2>' +
|
|
23
|
-
'<p>The <code>
|
|
23
|
+
'<p>The <code>NotificationCenter</code> component is used to show an open/close action, list of notifications and related filters actions to the user.</p>' +
|
|
24
24
|
'<ul>' +
|
|
25
|
-
' <li>Use it at the
|
|
26
|
-
' <li>
|
|
27
|
-
' <li>
|
|
28
|
-
' <li>
|
|
25
|
+
' <li>Use it at the header to display the open/close IconButton</li>' +
|
|
26
|
+
' <li>By default, the <code>NotificationCenter</code> will be aligned to the right of the open/close IconButton</li>' +
|
|
27
|
+
' <li>Use short, informative, and actionable text. Avoid vague, repetitive, or excessive notifications</li>' +
|
|
28
|
+
' <li>Distinguish between read and unread messages</li>' +
|
|
29
29
|
'</ul>',
|
|
30
30
|
},
|
|
31
31
|
},
|
|
@@ -33,7 +33,7 @@ const meta = {
|
|
|
33
33
|
tags: ['autodocs', 'Feedback components', 'Layout components'],
|
|
34
34
|
argTypes: {
|
|
35
35
|
children: {
|
|
36
|
-
description: 'Header
|
|
36
|
+
description: 'Header, List and Line components are passed as children',
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
}
|
|
@@ -41,13 +41,13 @@ const meta = {
|
|
|
41
41
|
export default meta
|
|
42
42
|
type Story = StoryObj<typeof meta>
|
|
43
43
|
|
|
44
|
-
export const
|
|
44
|
+
export const NotificationCenterWithNotifications: Story = {
|
|
45
45
|
render: (props: NotificationCenterProps) => (
|
|
46
46
|
<Header {...props}>
|
|
47
47
|
<h1>Header Title</h1>
|
|
48
48
|
|
|
49
49
|
<div style={{ display: 'flex', gap: '10px', marginRight: '30px' }}>
|
|
50
|
-
<NotificationCenter
|
|
50
|
+
<NotificationCenter>
|
|
51
51
|
<NotificationHeader title="Notifications">
|
|
52
52
|
<CheckableTagGroup>
|
|
53
53
|
<CheckableTag
|
|
@@ -120,7 +120,7 @@ export const Primary: Story = {
|
|
|
120
120
|
),
|
|
121
121
|
} as unknown as Story
|
|
122
122
|
|
|
123
|
-
export const
|
|
123
|
+
export const NotificationCenterEmptyState: Story = {
|
|
124
124
|
render: (props: NotificationCenterProps) => (
|
|
125
125
|
<Header {...props}>
|
|
126
126
|
<h1>Header Title</h1>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { render } from '@testing-library/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { Button } from '../src/atoms/Button'
|
|
4
|
+
import { CheckableTag, CheckableTagGroup } from '../src/atoms/CheckableTag'
|
|
5
|
+
import {
|
|
6
|
+
NotificationCenter,
|
|
7
|
+
NotificationHeader,
|
|
8
|
+
NotificationLine,
|
|
9
|
+
NotificationList,
|
|
10
|
+
} from '../src/atoms/Notification'
|
|
11
|
+
|
|
12
|
+
describe('NotificationCenter', () => {
|
|
13
|
+
it('renders with expected content and buttons', () => {
|
|
14
|
+
const { getByText } = render(
|
|
15
|
+
<NotificationCenter>
|
|
16
|
+
<NotificationHeader title="Notifications">
|
|
17
|
+
<CheckableTagGroup>
|
|
18
|
+
<CheckableTag
|
|
19
|
+
variant="primary"
|
|
20
|
+
label="All"
|
|
21
|
+
aria-label="All notifications"
|
|
22
|
+
onSelect={() => alert('click')}
|
|
23
|
+
isChecked={true}
|
|
24
|
+
/>
|
|
25
|
+
<CheckableTag
|
|
26
|
+
variant="primary"
|
|
27
|
+
label="Errors"
|
|
28
|
+
aria-label="Notification errors"
|
|
29
|
+
onSelect={() => alert('click')}
|
|
30
|
+
isChecked={false}
|
|
31
|
+
/>
|
|
32
|
+
<CheckableTag
|
|
33
|
+
variant="primary"
|
|
34
|
+
label="Updates"
|
|
35
|
+
aria-label="Notification updates"
|
|
36
|
+
onSelect={() => alert('click')}
|
|
37
|
+
isChecked={false}
|
|
38
|
+
/>
|
|
39
|
+
</CheckableTagGroup>
|
|
40
|
+
<Button
|
|
41
|
+
onClick={() => alert('mark all as read')}
|
|
42
|
+
label="Mark all as read"
|
|
43
|
+
/>
|
|
44
|
+
</NotificationHeader>
|
|
45
|
+
<NotificationList>
|
|
46
|
+
<NotificationLine
|
|
47
|
+
title="Trophy: Parting on Good Terms"
|
|
48
|
+
date="Jan 04"
|
|
49
|
+
onClick={() => alert('Notification clicked')}
|
|
50
|
+
>
|
|
51
|
+
Good terms? No. I'm here to burn bridges.
|
|
52
|
+
</NotificationLine>
|
|
53
|
+
<NotificationLine
|
|
54
|
+
title="New SHf game patch update"
|
|
55
|
+
date="Dec 29"
|
|
56
|
+
isRead={true}
|
|
57
|
+
>
|
|
58
|
+
Fixes a bug when saving the game in certain conditions.
|
|
59
|
+
</NotificationLine>
|
|
60
|
+
</NotificationList>
|
|
61
|
+
</NotificationCenter>,
|
|
62
|
+
)
|
|
63
|
+
expect(getByText('All')).toBeInTheDocument()
|
|
64
|
+
expect(getByText('Errors')).toBeInTheDocument()
|
|
65
|
+
expect(getByText('Updates')).toBeInTheDocument()
|
|
66
|
+
expect(getByText(/Mark all as read/i)).toBeInTheDocument()
|
|
67
|
+
|
|
68
|
+
expect(getByText('Trophy: Parting on Good Terms')).toHaveClass(
|
|
69
|
+
'notification-line-title',
|
|
70
|
+
)
|
|
71
|
+
expect(getByText('Jan 04')).toHaveClass('notification-line-date')
|
|
72
|
+
expect(
|
|
73
|
+
getByText("Good terms? No. I'm here to burn bridges."),
|
|
74
|
+
).toBeInTheDocument()
|
|
75
|
+
expect(getByText('New SHf game patch update')).toHaveClass(
|
|
76
|
+
'notification-line-title',
|
|
77
|
+
)
|
|
78
|
+
expect(getByText('Dec 29')).toBeInTheDocument()
|
|
79
|
+
expect(
|
|
80
|
+
getByText('Fixes a bug when saving the game in certain conditions.'),
|
|
81
|
+
).toBeInTheDocument()
|
|
82
|
+
})
|
|
83
|
+
})
|
package/tests/library.ts
CHANGED
|
@@ -27,6 +27,7 @@ export * as Label from '../src/stories/Label.stories'
|
|
|
27
27
|
export * as Menu from '../src/stories/Menu.stories'
|
|
28
28
|
export * as Modal from '../src/stories/Modal.stories'
|
|
29
29
|
export * as Multiselect from '../src/stories/Multiselect.stories'
|
|
30
|
+
export * as Notification from '../src/stories/Notification.stories'
|
|
30
31
|
export * as Pagination from '../src/stories/Pagination.stories'
|
|
31
32
|
export * as Popover from '../src/stories/Popover.stories'
|
|
32
33
|
export * as PopoverMenu from '../src/stories/PopoverMenu.stories'
|