mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +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:
parent
4a41e624a6
commit
3aa7e89a3e
@ -22,6 +22,11 @@ export const HiddenDescription = styled('p')(() => ({
|
|||||||
|
|
||||||
export const ButtonLabel = styled('span', {
|
export const ButtonLabel = styled('span', {
|
||||||
shouldForwardProp: (prop) => prop !== 'labelWidth',
|
shouldForwardProp: (prop) => prop !== 'labelWidth',
|
||||||
})<{ labelWidth?: string }>(({ labelWidth }) => ({
|
})<{ labelWidth?: string }>(({ labelWidth, theme }) => ({
|
||||||
width: labelWidth || 'unset',
|
width: labelWidth || 'unset',
|
||||||
|
overflowX: 'hidden',
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
[theme.breakpoints.down('sm')]: {
|
||||||
|
width: 'max-content',
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
@ -33,10 +33,6 @@ const StyledDialog = styled(Dialog)(({ theme, maxWidth }) => ({
|
|||||||
|
|
||||||
const CREATE_PROJECT_BTN = 'CREATE_PROJECT_BTN';
|
const CREATE_PROJECT_BTN = 'CREATE_PROJECT_BTN';
|
||||||
|
|
||||||
const StyledButton = styled(Button)(({ theme }) => ({
|
|
||||||
marginLeft: theme.spacing(3),
|
|
||||||
}));
|
|
||||||
|
|
||||||
const StyledProjectIcon = styled(ProjectIcon)(({ theme }) => ({
|
const StyledProjectIcon = styled(ProjectIcon)(({ theme }) => ({
|
||||||
fill: theme.palette.common.white,
|
fill: theme.palette.common.white,
|
||||||
stroke: theme.palette.common.white,
|
stroke: theme.palette.common.white,
|
||||||
@ -166,7 +162,7 @@ export const CreateProjectDialog = ({
|
|||||||
overrideDocumentation={setDocumentation}
|
overrideDocumentation={setDocumentation}
|
||||||
clearDocumentationOverride={clearDocumentationOverride}
|
clearDocumentationOverride={clearDocumentationOverride}
|
||||||
>
|
>
|
||||||
<StyledButton onClick={onClose}>Cancel</StyledButton>
|
<Button onClick={onClose}>Cancel</Button>
|
||||||
<CreateButton
|
<CreateButton
|
||||||
name='project'
|
name='project'
|
||||||
permission={CREATE_PROJECT}
|
permission={CREATE_PROJECT}
|
||||||
|
@ -50,6 +50,15 @@ export const OptionButtons = styled(StyledFormSection)(({ theme }) => ({
|
|||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexFlow: 'row wrap',
|
flexFlow: 'row wrap',
|
||||||
gap: theme.spacing(2),
|
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 }) => ({
|
export const FormActions = styled(StyledFormSection)(({ theme }) => ({
|
||||||
@ -57,4 +66,14 @@ export const FormActions = styled(StyledFormSection)(({ theme }) => ({
|
|||||||
gap: theme.spacing(5),
|
gap: theme.spacing(5),
|
||||||
justifyContent: 'flex-end',
|
justifyContent: 'flex-end',
|
||||||
flexFlow: 'row wrap',
|
flexFlow: 'row wrap',
|
||||||
|
[theme.breakpoints.down('sm')]: {
|
||||||
|
flexFlow: 'column nowrap',
|
||||||
|
gap: theme.spacing(2),
|
||||||
|
'& > *': {
|
||||||
|
display: 'flex',
|
||||||
|
button: {
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
@ -217,6 +217,7 @@ export const NewProjectForm: React.FC<FormProps> = ({
|
|||||||
button={{
|
button={{
|
||||||
label: projectStickiness,
|
label: projectStickiness,
|
||||||
icon: <StickinessIcon />,
|
icon: <StickinessIcon />,
|
||||||
|
labelWidth: '12ch',
|
||||||
}}
|
}}
|
||||||
search={{
|
search={{
|
||||||
label: 'Filter stickiness options',
|
label: 'Filter stickiness options',
|
||||||
|
Loading…
Reference in New Issue
Block a user