added an optional param to the object users and object teams to use a button with a label and use the share icon when it isn't there
This commit is contained in:
parent
186604dccf
commit
9d41499c27
3 changed files with 28 additions and 11 deletions
|
|
@ -247,6 +247,7 @@ export default function TeamPage() {
|
||||||
closeDialogCallback={() => setUserDialog(false)}
|
closeDialogCallback={() => setUserDialog(false)}
|
||||||
refreshCallback={() => {}}
|
refreshCallback={() => {}}
|
||||||
useImitation={false}
|
useImitation={false}
|
||||||
|
shareLabel="Add Team Member +"
|
||||||
/>
|
/>
|
||||||
<Grid2 container spacing={1}>
|
<Grid2 container spacing={1}>
|
||||||
<Grid2 size={{ xs: 12, sm: 4 }}>
|
<Grid2 size={{ xs: 12, sm: 4 }}>
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ interface Props {
|
||||||
cardMode?: boolean;
|
cardMode?: boolean;
|
||||||
keys?: string[];
|
keys?: string[];
|
||||||
types?: string[];
|
types?: string[];
|
||||||
|
shareLabel?: string; // a custom label to pass in that will replace the share icon
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ObjectTeams(props: Props) {
|
export default function ObjectTeams(props: Props) {
|
||||||
|
|
@ -126,7 +127,8 @@ export default function ObjectTeams(props: Props) {
|
||||||
dialog,
|
dialog,
|
||||||
cardMode,
|
cardMode,
|
||||||
keys,
|
keys,
|
||||||
types
|
types,
|
||||||
|
shareLabel
|
||||||
} = props;
|
} = props;
|
||||||
const prevPermissions = usePrevious(permissions);
|
const prevPermissions = usePrevious(permissions);
|
||||||
const prevIsDialogOpen = usePrevious(isDialogOpen);
|
const prevIsDialogOpen = usePrevious(isDialogOpen);
|
||||||
|
|
@ -322,12 +324,18 @@ export default function ObjectTeams(props: Props) {
|
||||||
<Grid size={{ xs: 4 }} container justifyContent="flex-end">
|
<Grid size={{ xs: 4 }} container justifyContent="flex-end">
|
||||||
{canShare && (
|
{canShare && (
|
||||||
<Tooltip title={"Share " + label}>
|
<Tooltip title={"Share " + label}>
|
||||||
<IconButton
|
{shareLabel ?
|
||||||
aria-label="Share"
|
<Button variant="contained" color="primary" aria-label="Share" onClick={openShareObjectDialog}>
|
||||||
className={classes.iconButton}
|
{shareLabel}
|
||||||
onClick={openShareObjectDialog}>
|
</Button>
|
||||||
<Share className={classes.shareIcon} />
|
:
|
||||||
</IconButton>
|
<IconButton
|
||||||
|
aria-label="Share"
|
||||||
|
className={classes.iconButton}
|
||||||
|
onClick={openShareObjectDialog}>
|
||||||
|
<Share className={classes.shareIcon} />
|
||||||
|
</IconButton>
|
||||||
|
}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ interface Props {
|
||||||
dialog?: string;
|
dialog?: string;
|
||||||
cardMode?: boolean;
|
cardMode?: boolean;
|
||||||
useImitation?: boolean;
|
useImitation?: boolean;
|
||||||
|
shareLabel?: string; // s string to replace the share icon button with a labelled button
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ObjectUsers(props: Props) {
|
export default function ObjectUsers(props: Props) {
|
||||||
|
|
@ -127,8 +128,9 @@ export default function ObjectUsers(props: Props) {
|
||||||
refreshCallback,
|
refreshCallback,
|
||||||
userCallback,
|
userCallback,
|
||||||
dialog,
|
dialog,
|
||||||
cardMode
|
cardMode,
|
||||||
//useImitation
|
//useImitation
|
||||||
|
shareLabel
|
||||||
} = props;
|
} = props;
|
||||||
const prevPermissions = usePrevious(permissions);
|
const prevPermissions = usePrevious(permissions);
|
||||||
const prevIsDialogOpen = usePrevious(isDialogOpen);
|
const prevIsDialogOpen = usePrevious(isDialogOpen);
|
||||||
|
|
@ -367,11 +369,17 @@ export default function ObjectUsers(props: Props) {
|
||||||
<Box display="flex" justifyContent="flex-end">
|
<Box display="flex" justifyContent="flex-end">
|
||||||
{canShare && (
|
{canShare && (
|
||||||
<Tooltip title={`Share ${label}`}>
|
<Tooltip title={`Share ${label}`}>
|
||||||
<IconButton
|
{shareLabel ?
|
||||||
|
<Button variant="contained" color="primary" aria-label="Share" onClick={openShareObjectDialog}>
|
||||||
|
{shareLabel}
|
||||||
|
</Button>
|
||||||
|
:
|
||||||
|
<IconButton
|
||||||
aria-label="Share"
|
aria-label="Share"
|
||||||
onClick={openShareObjectDialog}>
|
onClick={openShareObjectDialog}>
|
||||||
<ShareIcon />
|
<ShareIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue