1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

chore: fix button design on narrow screens for new project form (#7195)

This PR contains a few fixes for button designs on small screens for the
new project form.

It makes all buttons (config and actions) full-width and addresses some
sizing stuff.

It also caps the width of the stickiness button on non-small screens to
avoid shifting.




![image](https://github.com/Unleash/unleash/assets/17786332/83af0a1c-8eb0-4a6b-aa5c-491bbcfab8e9)
This commit is contained in:
Thomas Heartman 2024-05-29 08:37:52 +02:00 committed by GitHub
parent 4a41e624a6
commit 3aa7e89a3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 27 additions and 6 deletions

View File

@ -22,6 +22,11 @@ export const HiddenDescription = styled('p')(() => ({
export const ButtonLabel = styled('span', {
shouldForwardProp: (prop) => prop !== 'labelWidth',
})<{ labelWidth?: string }>(({ labelWidth }) => ({
})<{ labelWidth?: string }>(({ labelWidth, theme }) => ({
width: labelWidth || 'unset',
overflowX: 'hidden',
textOverflow: 'ellipsis',
[theme.breakpoints.down('sm')]: {
width: 'max-content',
},
}));

View File

@ -33,10 +33,6 @@ const StyledDialog = styled(Dialog)(({ theme, maxWidth }) => ({
const CREATE_PROJECT_BTN = 'CREATE_PROJECT_BTN';
const StyledButton = styled(Button)(({ theme }) => ({
marginLeft: theme.spacing(3),
}));
const StyledProjectIcon = styled(ProjectIcon)(({ theme }) => ({
fill: theme.palette.common.white,
stroke: theme.palette.common.white,
@ -166,7 +162,7 @@ export const CreateProjectDialog = ({
overrideDocumentation={setDocumentation}
clearDocumentationOverride={clearDocumentationOverride}
>
<StyledButton onClick={onClose}>Cancel</StyledButton>
<Button onClick={onClose}>Cancel</Button>
<CreateButton
name='project'
permission={CREATE_PROJECT}

View File

@ -50,6 +50,15 @@ export const OptionButtons = styled(StyledFormSection)(({ theme }) => ({
display: 'flex',
flexFlow: 'row wrap',
gap: theme.spacing(2),
[theme.breakpoints.down('sm')]: {
flexFlow: 'column nowrap',
'div:has(button)': {
display: 'flex',
button: {
flex: 1,
},
},
},
}));
export const FormActions = styled(StyledFormSection)(({ theme }) => ({
@ -57,4 +66,14 @@ export const FormActions = styled(StyledFormSection)(({ theme }) => ({
gap: theme.spacing(5),
justifyContent: 'flex-end',
flexFlow: 'row wrap',
[theme.breakpoints.down('sm')]: {
flexFlow: 'column nowrap',
gap: theme.spacing(2),
'& > *': {
display: 'flex',
button: {
flex: 1,
},
},
},
}));

View File

@ -217,6 +217,7 @@ export const NewProjectForm: React.FC<FormProps> = ({
button={{
label: projectStickiness,
icon: <StickinessIcon />,
labelWidth: '12ch',
}}
search={{
label: 'Filter stickiness options',