mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: revert form section 100 height (#3345)
Small fix that reverts https://github.com/Unleash/unleash/pull/3335/files#r1138829014 - Turns out it wasn't totally harmless and broke some modals that had more than 100% height and no overflow. This approach maintains the original logic and adds a new prop for the segment forms to make them proper modals when used in the project context.
This commit is contained in:
		
							parent
							
								
									c68f0038a2
								
							
						
					
					
						commit
						71f6b8e172
					
				| @ -34,7 +34,6 @@ const StyledContainer = styled('section', { | |||||||
|     minHeight: modal ? '100vh' : '80vh', |     minHeight: modal ? '100vh' : '80vh', | ||||||
|     borderRadius: modal ? 0 : theme.spacing(2), |     borderRadius: modal ? 0 : theme.spacing(2), | ||||||
|     width: '100%', |     width: '100%', | ||||||
|     height: '100%', |  | ||||||
|     display: 'flex', |     display: 'flex', | ||||||
|     margin: '0 auto', |     margin: '0 auto', | ||||||
|     [theme.breakpoints.down(1100)]: { |     [theme.breakpoints.down(1100)]: { | ||||||
|  | |||||||
| @ -41,7 +41,7 @@ export const ProjectSegments = () => { | |||||||
|                         onClose={() => navigate(GO_BACK)} |                         onClose={() => navigate(GO_BACK)} | ||||||
|                         label="Create segment" |                         label="Create segment" | ||||||
|                     > |                     > | ||||||
|                         <CreateSegment /> |                         <CreateSegment modal /> | ||||||
|                     </SidebarModal> |                     </SidebarModal> | ||||||
|                 } |                 } | ||||||
|             /> |             /> | ||||||
| @ -53,7 +53,7 @@ export const ProjectSegments = () => { | |||||||
|                         onClose={() => navigate(GO_BACK)} |                         onClose={() => navigate(GO_BACK)} | ||||||
|                         label="Edit segment" |                         label="Edit segment" | ||||||
|                     > |                     > | ||||||
|                         <EditSegment /> |                         <EditSegment modal /> | ||||||
|                     </SidebarModal> |                     </SidebarModal> | ||||||
|                 } |                 } | ||||||
|             /> |             /> | ||||||
|  | |||||||
| @ -18,7 +18,11 @@ import { SEGMENT_CREATE_BTN_ID } from 'utils/testIds'; | |||||||
| import { useSegmentLimits } from 'hooks/api/getters/useSegmentLimits/useSegmentLimits'; | import { useSegmentLimits } from 'hooks/api/getters/useSegmentLimits/useSegmentLimits'; | ||||||
| import { useOptionalPathParam } from 'hooks/useOptionalPathParam'; | import { useOptionalPathParam } from 'hooks/useOptionalPathParam'; | ||||||
| 
 | 
 | ||||||
| export const CreateSegment = () => { | interface ICreateSegmentProps { | ||||||
|  |     modal?: boolean; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export const CreateSegment = ({ modal }: ICreateSegmentProps) => { | ||||||
|     const projectId = useOptionalPathParam('projectId'); |     const projectId = useOptionalPathParam('projectId'); | ||||||
|     const { uiConfig } = useUiConfig(); |     const { uiConfig } = useUiConfig(); | ||||||
|     const { setToastData, setToastApiError } = useToast(); |     const { setToastData, setToastApiError } = useToast(); | ||||||
| @ -87,6 +91,7 @@ export const CreateSegment = () => { | |||||||
|     return ( |     return ( | ||||||
|         <FormTemplate |         <FormTemplate | ||||||
|             loading={loading} |             loading={loading} | ||||||
|  |             modal={modal} | ||||||
|             title="Create segment" |             title="Create segment" | ||||||
|             description={segmentsFormDescription} |             description={segmentsFormDescription} | ||||||
|             documentationLink={segmentsDocsLink} |             documentationLink={segmentsDocsLink} | ||||||
|  | |||||||
| @ -20,7 +20,11 @@ import { SEGMENT_SAVE_BTN_ID } from 'utils/testIds'; | |||||||
| import { useSegmentLimits } from 'hooks/api/getters/useSegmentLimits/useSegmentLimits'; | import { useSegmentLimits } from 'hooks/api/getters/useSegmentLimits/useSegmentLimits'; | ||||||
| import { useOptionalPathParam } from 'hooks/useOptionalPathParam'; | import { useOptionalPathParam } from 'hooks/useOptionalPathParam'; | ||||||
| 
 | 
 | ||||||
| export const EditSegment = () => { | interface IEditSegmentProps { | ||||||
|  |     modal?: boolean; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export const EditSegment = ({ modal }: IEditSegmentProps) => { | ||||||
|     const projectId = useOptionalPathParam('projectId'); |     const projectId = useOptionalPathParam('projectId'); | ||||||
|     const segmentId = useRequiredPathParam('segmentId'); |     const segmentId = useRequiredPathParam('segmentId'); | ||||||
|     const { segment } = useSegment(Number(segmentId)); |     const { segment } = useSegment(Number(segmentId)); | ||||||
| @ -91,6 +95,7 @@ export const EditSegment = () => { | |||||||
|     return ( |     return ( | ||||||
|         <FormTemplate |         <FormTemplate | ||||||
|             loading={loading} |             loading={loading} | ||||||
|  |             modal={modal} | ||||||
|             title="Edit segment" |             title="Edit segment" | ||||||
|             description={segmentsFormDescription} |             description={segmentsFormDescription} | ||||||
|             documentationLink={segmentsDocsLink} |             documentationLink={segmentsDocsLink} | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user