-
Notifications
You must be signed in to change notification settings - Fork 104
Expand file tree
/
Copy pathCommonCollectionsPanel.tsx
More file actions
78 lines (73 loc) · 2 KB
/
CommonCollectionsPanel.tsx
File metadata and controls
78 lines (73 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import {
Button,
makeStyles,
MessageBar,
MessageBarBody,
DrawerFooter,
tokens
} from '@fluentui/react-components';
import { ReactNode } from 'react';
import { translateMessage } from '../../../../utils/translate-messages';
interface CommonCollectionsPanelProps {
messageBarText?: string;
messageBarSpanText?: string;
primaryButtonText: string;
primaryButtonAction: () => void;
primaryButtonDisabled: boolean;
closePopup: () => void;
children: ReactNode;
}
const useStyles = makeStyles({
drawerFooter: {
display: 'flex',
justifyContent: 'flex-start',
position: 'sticky',
bottom: 0,
width: '100%',
gap: tokens.spacingHorizontalXXXL,
paddingInline: tokens.spacingHorizontalL,
paddingBlock: tokens.spacingVerticalL,
paddingLeft: 0,
backgroundColor: tokens.colorNeutralBackground1,
marginInlineStart: tokens.spacingHorizontalL
},
messageBar: {
marginInlineStart: tokens.spacingHorizontalM,
width: '100%'
}
});
const CommonCollectionsPanel: React.FC<CommonCollectionsPanelProps> = ({
messageBarText,
messageBarSpanText,
primaryButtonText,
primaryButtonAction,
primaryButtonDisabled,
closePopup,
children
}) => {
const styles = useStyles();
return (
<>
{messageBarText ? <MessageBar className={styles.messageBar} intent='info'>
<MessageBarBody>
{translateMessage(messageBarText)}
{messageBarSpanText ? (
<span style={{ fontWeight: 'bold' }}>
{translateMessage(messageBarSpanText)}
</span>
) : null}
</MessageBarBody>
</MessageBar> : null}
{children}
<DrawerFooter className={styles.drawerFooter}>
<Button appearance="primary" onClick={primaryButtonAction} disabled={primaryButtonDisabled}>
{translateMessage(primaryButtonText)}
</Button>
<Button onClick={closePopup}>
{translateMessage('Close')}
</Button>
</DrawerFooter>
</>
);
};
export default CommonCollectionsPanel;