-
Notifications
You must be signed in to change notification settings - Fork 12
/
AccessChip.jsx
32 lines (30 loc) · 956 Bytes
/
AccessChip.jsx
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
import React from 'react';
import {
Public as PublicIcon,
Lock as PrivateIcon,
} from '@mui/icons-material';
import { Tooltip, Chip } from '@mui/material';
import { startCase, includes } from 'lodash';
const AccessChip = props => {
const publicAccess = props.public_access || props.publicAccess || '';
const isPublic = includes(['view', 'edit'], publicAccess.toLowerCase())
const label = isPublic ? 'Public' : 'Private';
const title = isPublic ? `Public Access: ${startCase(publicAccess)}` : 'Private';
return (
<span style={{marginTop: '-5px'}}>
<Tooltip arrow title={title} placement="top">
<Chip
label={label}
size='small'
icon={
isPublic ?
<PublicIcon fontSize='inherit' /> :
<PrivateIcon fontSize='inherit' />
}
style={{backgroundColor: '#e0e0e0'}}
/>
</Tooltip>
</span>
);
}
export default AccessChip;