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:
csawatzky 2026-03-31 15:37:56 -06:00
parent 186604dccf
commit 9d41499c27
3 changed files with 28 additions and 11 deletions

View file

@ -247,6 +247,7 @@ export default function TeamPage() {
closeDialogCallback={() => setUserDialog(false)}
refreshCallback={() => {}}
useImitation={false}
shareLabel="Add Team Member +"
/>
<Grid2 container spacing={1}>
<Grid2 size={{ xs: 12, sm: 4 }}>

View file

@ -104,6 +104,7 @@ interface Props {
cardMode?: boolean;
keys?: string[];
types?: string[];
shareLabel?: string; // a custom label to pass in that will replace the share icon
}
export default function ObjectTeams(props: Props) {
@ -126,7 +127,8 @@ export default function ObjectTeams(props: Props) {
dialog,
cardMode,
keys,
types
types,
shareLabel
} = props;
const prevPermissions = usePrevious(permissions);
const prevIsDialogOpen = usePrevious(isDialogOpen);
@ -322,12 +324,18 @@ export default function ObjectTeams(props: Props) {
<Grid size={{ xs: 4 }} container justifyContent="flex-end">
{canShare && (
<Tooltip title={"Share " + label}>
{shareLabel ?
<Button variant="contained" color="primary" aria-label="Share" onClick={openShareObjectDialog}>
{shareLabel}
</Button>
:
<IconButton
aria-label="Share"
className={classes.iconButton}
onClick={openShareObjectDialog}>
<Share className={classes.shareIcon} />
</IconButton>
}
</Tooltip>
)}
</Grid>

View file

@ -108,6 +108,7 @@ interface Props {
dialog?: string;
cardMode?: boolean;
useImitation?: boolean;
shareLabel?: string; // s string to replace the share icon button with a labelled button
}
export default function ObjectUsers(props: Props) {
@ -127,8 +128,9 @@ export default function ObjectUsers(props: Props) {
refreshCallback,
userCallback,
dialog,
cardMode
cardMode,
//useImitation
shareLabel
} = props;
const prevPermissions = usePrevious(permissions);
const prevIsDialogOpen = usePrevious(isDialogOpen);
@ -367,11 +369,17 @@ export default function ObjectUsers(props: Props) {
<Box display="flex" justifyContent="flex-end">
{canShare && (
<Tooltip title={`Share ${label}`}>
{shareLabel ?
<Button variant="contained" color="primary" aria-label="Share" onClick={openShareObjectDialog}>
{shareLabel}
</Button>
:
<IconButton
aria-label="Share"
onClick={openShareObjectDialog}>
<ShareIcon />
</IconButton>
}
</Tooltip>
)}
</Box>