Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: permission button unintended full width behavior #8920

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, type ButtonProps } from '@mui/material';
import { Button, styled, type ButtonProps } from '@mui/material';
import Lock from '@mui/icons-material/Lock';
import React from 'react';
import {
Expand All @@ -12,6 +12,11 @@ import {
useHasProjectEnvironmentAccess,
} from 'hooks/useHasAccess';

const StyledButton = styled(Button)({
justifySelf: 'start',
alignSelf: 'start',
});

export interface IPermissionButtonProps extends Omit<ButtonProps, 'title'> {
permission: string | string[];
onClick?: (e: any) => void;
Expand Down Expand Up @@ -104,7 +109,7 @@ const BasePermissionButton = React.forwardRef<
title={formatAccessText(access, tooltipProps?.title)}
arrow
>
<Button
<StyledButton
ref={ref}
onClick={onClick}
disabled={disabled || !access}
Expand All @@ -115,7 +120,7 @@ const BasePermissionButton = React.forwardRef<
endIcon={endIcon}
>
{children}
</Button>
</StyledButton>
</TooltipResolver>
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ exports[`renders an empty list correctly 1`] = `
/>
<button
aria-labelledby="useId-0"
className="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium css-om67xs-MuiButtonBase-root-MuiButton-root"
className="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium css-1pzmo7x-MuiButtonBase-root-MuiButton-root"
disabled={false}
onBlur={[Function]}
onClick={[Function]}
Expand Down
Loading