@eeacms/volto-eea-website-theme 4.2.0 → 4.3.0
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/CHANGELOG.md +8 -3
- package/package.json +1 -1
- package/src/customizations/@root/theme.js +1 -0
- package/src/customizations/@root/toast.less +99 -0
- package/src/customizations/volto/components/manage/Toast/Toast.jsx +55 -0
- package/src/customizations/volto/components/manage/Toast/Toast.test.jsx +41 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
-
### [4.
|
|
7
|
+
### [4.3.0](https://github.com/eea/volto-eea-website-theme/compare/4.2.0...4.3.0) - 23 April 2026
|
|
8
8
|
|
|
9
|
-
#### :
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: Align Toast with EEA Design System Message - refs #294806 [Alin Voinea - [`53106b1`](https://github.com/eea/volto-eea-website-theme/commit/53106b1099b4bfae59a1746e7dc62c49a8ae63cd)]
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
#### :hammer_and_wrench: Others
|
|
14
|
+
|
|
15
|
+
- Release 4.3.0 [Alin Voinea - [`707331f`](https://github.com/eea/volto-eea-website-theme/commit/707331fa7d26a22e5dfdbcb816d62ff18277ac07)]
|
|
16
|
+
### [4.2.0](https://github.com/eea/volto-eea-website-theme/compare/4.1.1...4.2.0) - 21 April 2026
|
|
12
17
|
|
|
13
18
|
#### :hammer_and_wrench: Others
|
|
14
19
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
.Toastify__toast-container--bottom-center {
|
|
2
|
+
top: 24px;
|
|
3
|
+
bottom: auto;
|
|
4
|
+
left: 50%;
|
|
5
|
+
width: ~'min(480px, calc(100vw - 32px))';
|
|
6
|
+
padding: 0;
|
|
7
|
+
margin-left: 0;
|
|
8
|
+
-webkit-transform: translateX(-50%);
|
|
9
|
+
transform: translateX(-50%);
|
|
10
|
+
|
|
11
|
+
.Toastify__toast {
|
|
12
|
+
display: flex;
|
|
13
|
+
overflow: visible;
|
|
14
|
+
min-height: 0;
|
|
15
|
+
align-items: flex-start;
|
|
16
|
+
padding: 0;
|
|
17
|
+
border: 0;
|
|
18
|
+
border-radius: 0;
|
|
19
|
+
margin-bottom: 12px;
|
|
20
|
+
background: transparent;
|
|
21
|
+
box-shadow: none;
|
|
22
|
+
color: inherit;
|
|
23
|
+
cursor: default;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.Toastify__toast-body {
|
|
27
|
+
min-width: 0;
|
|
28
|
+
flex: 1 1 auto;
|
|
29
|
+
padding: 0;
|
|
30
|
+
margin: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.Toastify__close-button {
|
|
34
|
+
flex: 0 0 auto;
|
|
35
|
+
align-self: flex-start;
|
|
36
|
+
padding: 4px;
|
|
37
|
+
border: 0;
|
|
38
|
+
margin: -4px -4px -4px 12px;
|
|
39
|
+
background: transparent;
|
|
40
|
+
color: inherit;
|
|
41
|
+
opacity: 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.Toastify__close-button:hover,
|
|
45
|
+
.Toastify__close-button:focus {
|
|
46
|
+
opacity: 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.Toastify__toast--info .Toastify__close-button {
|
|
50
|
+
color: #003052;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.Toastify__toast--success .Toastify__close-button {
|
|
54
|
+
color: #005248;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.Toastify__toast--error .Toastify__close-button {
|
|
58
|
+
color: #b83230;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.Toastify__toast--warning .Toastify__close-button {
|
|
62
|
+
color: #3d2201;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.toast-dismiss-action {
|
|
66
|
+
display: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.toast-dismiss-action svg {
|
|
70
|
+
fill: currentColor;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ui.message.eea-toast {
|
|
74
|
+
width: 100%;
|
|
75
|
+
margin: 0;
|
|
76
|
+
cursor: default;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.toast-inner-content {
|
|
80
|
+
min-width: 0;
|
|
81
|
+
margin-left: 0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@media only screen and (max-width: 767px) {
|
|
86
|
+
.Toastify__toast-container--bottom-center {
|
|
87
|
+
top: 16px;
|
|
88
|
+
bottom: auto;
|
|
89
|
+
width: ~'min(480px, calc(100vw - 24px))';
|
|
90
|
+
|
|
91
|
+
.Toastify__toast {
|
|
92
|
+
margin-bottom: 8px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.Toastify__close-button {
|
|
96
|
+
margin-left: 8px;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import { Icon, Message } from 'semantic-ui-react';
|
|
5
|
+
|
|
6
|
+
const Toast = (props) => {
|
|
7
|
+
function getStatus(props) {
|
|
8
|
+
if (props.info) {
|
|
9
|
+
return 'info';
|
|
10
|
+
} else if (props.success) {
|
|
11
|
+
return 'success';
|
|
12
|
+
} else if (props.error) {
|
|
13
|
+
return 'error';
|
|
14
|
+
} else if (props.warning) {
|
|
15
|
+
return 'warning';
|
|
16
|
+
} else {
|
|
17
|
+
return 'success';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { title, content } = props;
|
|
22
|
+
const status = getStatus(props);
|
|
23
|
+
const statusProps = {
|
|
24
|
+
info: status === 'info',
|
|
25
|
+
success: status === 'success',
|
|
26
|
+
error: status === 'error',
|
|
27
|
+
warning: status === 'warning',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Message
|
|
32
|
+
icon
|
|
33
|
+
size="large"
|
|
34
|
+
className={cx('eea-toast', `eea-toast--${status}`)}
|
|
35
|
+
{...statusProps}
|
|
36
|
+
>
|
|
37
|
+
<Icon name="exclamation circle" />
|
|
38
|
+
<Message.Content className="toast-inner-content">
|
|
39
|
+
{title && <Message.Header>{title}</Message.Header>}
|
|
40
|
+
<div>{content}</div>
|
|
41
|
+
</Message.Content>
|
|
42
|
+
</Message>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
Toast.propTypes = {
|
|
47
|
+
title: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
48
|
+
content: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
|
|
49
|
+
info: PropTypes.bool,
|
|
50
|
+
success: PropTypes.bool,
|
|
51
|
+
error: PropTypes.bool,
|
|
52
|
+
warning: PropTypes.bool,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default Toast;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
|
|
5
|
+
import Toast from './Toast';
|
|
6
|
+
|
|
7
|
+
describe('Toast', () => {
|
|
8
|
+
it('renders the title, content, and Volto compatibility class', () => {
|
|
9
|
+
const { container, getByText } = render(
|
|
10
|
+
<Toast success title="Saved" content="The content was saved." />,
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
expect(getByText('Saved')).toBeInTheDocument();
|
|
14
|
+
expect(getByText('The content was saved.')).toBeInTheDocument();
|
|
15
|
+
expect(container.querySelector('.eea-toast')).toHaveClass(
|
|
16
|
+
'ui',
|
|
17
|
+
'message',
|
|
18
|
+
'success',
|
|
19
|
+
'large',
|
|
20
|
+
'icon',
|
|
21
|
+
'eea-toast--success',
|
|
22
|
+
);
|
|
23
|
+
expect(
|
|
24
|
+
container.querySelector('.exclamation.circle.icon'),
|
|
25
|
+
).toBeInTheDocument();
|
|
26
|
+
expect(container.querySelector('.toast-inner-content')).toBeInTheDocument();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it.each([
|
|
30
|
+
['info', { info: true }, 'eea-toast--info'],
|
|
31
|
+
['success', { success: true }, 'eea-toast--success'],
|
|
32
|
+
['error', { error: true }, 'eea-toast--error'],
|
|
33
|
+
['warning', { warning: true }, 'eea-toast--warning'],
|
|
34
|
+
])('applies the %s status class', (status, props, className) => {
|
|
35
|
+
const { container } = render(
|
|
36
|
+
<Toast {...props} title={status} content={`${status} content`} />,
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
expect(container.querySelector('.eea-toast')).toHaveClass(className);
|
|
40
|
+
});
|
|
41
|
+
});
|