tycho-components 0.30.5 → 0.30.7
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.
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Modal } from
|
|
3
|
-
import { useEffect } from
|
|
4
|
-
import { useTranslation } from
|
|
5
|
-
import { Button, Icon } from
|
|
6
|
-
import
|
|
7
|
-
import { attachCloseToEscape, stopEventPropagation } from
|
|
2
|
+
import { Box, Modal } from '@mui/material';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Button, Icon } from 'tycho-storybook';
|
|
6
|
+
import './style.scss';
|
|
7
|
+
import { attachCloseToEscape, stopEventPropagation } from './AppModalUtils';
|
|
8
8
|
export default function AppModalConfirm({ title, subtitle, onClose, onConfirm, closeLabel, confirmLabel, confirmDisabled, disableClose, disableEscapeClose, disableBackdropClose, }) {
|
|
9
|
-
const { t } = useTranslation(
|
|
9
|
+
const { t } = useTranslation('common');
|
|
10
10
|
useEffect(() => {
|
|
11
|
-
if (disableEscapeClose)
|
|
11
|
+
if (!onClose || disableEscapeClose)
|
|
12
12
|
return;
|
|
13
13
|
return attachCloseToEscape(onClose);
|
|
14
14
|
}, [onClose, disableEscapeClose]);
|
|
15
|
-
return (_jsx(Modal, { open: true, disableEscapeKeyDown: !!disableEscapeClose, onClose: (event, reason) => {
|
|
15
|
+
return (_jsx(Modal, { open: true, disableEscapeKeyDown: !onClose || !!disableEscapeClose, onClose: (event, reason) => {
|
|
16
16
|
stopEventPropagation(event);
|
|
17
|
-
if (
|
|
17
|
+
if (!onClose || disableClose)
|
|
18
18
|
return;
|
|
19
|
-
if (
|
|
19
|
+
if (disableBackdropClose && reason === 'backdropClick')
|
|
20
20
|
return;
|
|
21
21
|
onClose();
|
|
22
|
-
}, children: _jsxs(Box, { className: "modal-container modal-confirm", sx: style, children: [_jsxs("div", { className: "body", children: [_jsx(Icon, { name: "warning", size: "large", filled: true }), _jsxs("div", { className: "texts", children: [_jsx("span", { className: "title", children: title }), _jsx("span", { className: "subtitle", children: subtitle })] })] }), _jsxs("div", { className: "footer", children: [_jsx(Button, { onClick: (e) => {
|
|
22
|
+
}, children: _jsxs(Box, { className: "modal-container modal-confirm", sx: style, children: [_jsxs("div", { className: "body", children: [_jsx(Icon, { name: "warning", size: "large", filled: true }), _jsxs("div", { className: "texts", children: [_jsx("span", { className: "title", children: title }), _jsx("span", { className: "subtitle", children: subtitle })] })] }), _jsxs("div", { className: "footer", children: [onClose && (_jsx(Button, { onClick: (e) => {
|
|
23
23
|
stopEventPropagation(e);
|
|
24
24
|
onClose();
|
|
25
|
-
}, text: closeLabel || t(
|
|
25
|
+
}, text: closeLabel || t('button.cancel'), mode: "tonal" })), _jsx(Button, { onClick: onConfirm, text: confirmLabel || t('button.confirm'), disabled: confirmDisabled })] })] }) }));
|
|
26
26
|
}
|
|
27
27
|
const style = {
|
|
28
|
-
position:
|
|
29
|
-
top:
|
|
30
|
-
left:
|
|
31
|
-
transform:
|
|
32
|
-
width:
|
|
33
|
-
maxWidth:
|
|
34
|
-
borderRadius:
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
top: '40%',
|
|
30
|
+
left: '50%',
|
|
31
|
+
transform: 'translate(-50%, -50%)',
|
|
32
|
+
width: '30%',
|
|
33
|
+
maxWidth: '580px',
|
|
34
|
+
borderRadius: 'var(--radius-200)',
|
|
35
35
|
boxShadow: 24,
|
|
36
|
-
bgcolor:
|
|
36
|
+
bgcolor: 'var(--background-default)',
|
|
37
37
|
};
|
|
@@ -9,8 +9,8 @@ import SecurityUtils from '../../functions/SecurityUtils';
|
|
|
9
9
|
import UsabilityUtils from '../../functions/UsabilityUtils';
|
|
10
10
|
import CommentAdd from './CommentAdd';
|
|
11
11
|
import CommentInfo from './CommentInfo';
|
|
12
|
-
import './style.scss';
|
|
13
12
|
import CommentService from './CommentService';
|
|
13
|
+
import './style.scss';
|
|
14
14
|
export default function Comments({ uid, keywords, references, mode, onClose, onChange, }) {
|
|
15
15
|
const { t } = useTranslation('comments');
|
|
16
16
|
const [openAddComment, setOpenAddComment] = useState(false);
|
|
@@ -54,7 +54,8 @@ export default function Comments({ uid, keywords, references, mode, onClose, onC
|
|
|
54
54
|
onChange?.(updated);
|
|
55
55
|
}
|
|
56
56
|
else {
|
|
57
|
-
const updated = comments?.map((c) => (c.id === comment.id ? el : c)) ||
|
|
57
|
+
const updated = comments?.map((c) => (c.id === comment.id ? el : c)) ||
|
|
58
|
+
[];
|
|
58
59
|
setComments(updated);
|
|
59
60
|
onChange?.(updated);
|
|
60
61
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.comments-container {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
|
-
width:
|
|
4
|
+
width: 25vw;
|
|
5
5
|
|
|
6
6
|
> .header {
|
|
7
7
|
display: flex;
|
|
@@ -123,3 +123,21 @@
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
+
|
|
127
|
+
@media (max-width: 1366px) {
|
|
128
|
+
.comments-container {
|
|
129
|
+
width: 40vw;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@media (max-width: 768px) {
|
|
134
|
+
.comments-container {
|
|
135
|
+
width: 60vw;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@media (max-width: 767px) {
|
|
140
|
+
.comments-container {
|
|
141
|
+
width: 90vw;
|
|
142
|
+
}
|
|
143
|
+
}
|