-
Notifications
You must be signed in to change notification settings - Fork 117
refactor: handle 'fit-content' layout via restricted max height #683
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
Changes from all commits
89284ec
b9d9d91
72b9cd3
3169e66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,10 +39,6 @@ export function WidgetViewContainer({ | |
| const showHeader = isFullHeightLayout && showMockHeader | ||
| const showFooter = isFullHeightLayout && showMockFooter | ||
|
|
||
| const isDefault = | ||
| !config?.theme?.container?.height || | ||
| config?.theme?.container?.height === 'fit-content' | ||
|
|
||
| return ( | ||
| <Main open={isDrawerOpen} drawerWidth={drawerWidth}> | ||
| <ExternalWalletProvider isExternalProvider={isWalletManagementExternal}> | ||
|
|
@@ -64,23 +60,16 @@ export function WidgetViewContainer({ | |
| ) : null} | ||
| </FloatingToolsContainer> | ||
| <WidgetContainer | ||
| removePaddingTop={ | ||
| (config?.theme?.container?.height === '100%' && !showHeader) || | ||
| (config?.theme?.container?.display === 'flex' && !showHeader) | ||
| } | ||
| alignTop={config?.theme?.container?.display === 'flex'} | ||
| removePaddingTop={isFullHeightLayout && !showHeader} | ||
| alignTop={isFullHeightLayout} | ||
| > | ||
| {showHeader ? ( | ||
| <MockElement sx={{ position: 'fixed', zIndex: 1, top: 0 }}> | ||
| Mock header | ||
| </MockElement> | ||
| ) : null} | ||
| <WidgetContainerRow | ||
| sx={ | ||
| (isFullHeightLayout && isFooterFixed) || isDefault | ||
| ? { marginBottom: 6 } | ||
| : undefined | ||
| } | ||
| sx={{ marginBottom: !isFullHeightLayout || isFooterFixed ? 6 : 0 }} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Margin bottom is added for widget not to touch the bottom of the page or the footer (routes container still might though - because of the absolute positioning). |
||
| > | ||
| {children} | ||
| </WidgetContainerRow> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,36 +15,27 @@ import { getWidgetMaxHeight } from '../utils/widgetSize.js' | |
| // - useSetContentHeight | ||
| // Also check any code that is using the methods from elements.ts utils file | ||
|
|
||
| export const AppExpandedContainer = styled(Box, { | ||
| shouldForwardProp: (prop) => prop !== 'variant', | ||
| })<{ variant?: WidgetVariant }>(({ theme }) => ({ | ||
| display: 'flex', | ||
| justifyContent: 'center', | ||
| alignItems: 'start', | ||
| flex: 1, | ||
| height: | ||
| theme.container?.display === 'flex' | ||
| ? '100%' | ||
| : theme.container?.maxHeight | ||
| ? 'auto' | ||
| : theme.container?.height || 'auto', | ||
| variants: [ | ||
| { | ||
| props: { | ||
| variant: 'drawer', | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed since previously |
||
| }, | ||
| style: { | ||
| height: 'none', | ||
| }, | ||
| }, | ||
| ], | ||
| })) | ||
| export const AppExpandedContainer = styled(Box)(({ theme }) => { | ||
| return { | ||
| display: 'flex', | ||
| justifyContent: 'center', | ||
| alignItems: 'start', | ||
| flex: 1, | ||
| height: | ||
| theme.container?.display === 'flex' | ||
| ? '100%' | ||
| : theme.container?.maxHeight | ||
| ? 'auto' | ||
| : theme.container?.height || 'auto', | ||
| } | ||
| }) | ||
|
|
||
| export const RelativeContainer = styled(Box, { | ||
| shouldForwardProp: (prop) => prop !== 'variant', | ||
| })<{ variant?: WidgetVariant }>(({ theme }) => { | ||
| const maxHeight = | ||
| theme.container?.height === 'fit-content' | ||
| theme.container?.height === 'fit-content' || | ||
| (!theme.container?.height && !theme.container?.maxHeight) | ||
| ? 'none' | ||
| : getWidgetMaxHeight(theme) | ||
| return { | ||
|
|
@@ -89,7 +80,8 @@ const CssBaselineContainer = styled(ScopedCssBaseline, { | |
| !['variant', 'paddingTopAdjustment', 'elementId'].includes(prop as string), | ||
| })<CssBaselineContainerProps>(({ theme, variant, paddingTopAdjustment }) => { | ||
| const maxHeight = | ||
| theme.container?.height === 'fit-content' | ||
| theme.container?.height === 'fit-content' || | ||
| (!theme.container?.height && !theme.container?.maxHeight) | ||
| ? 'none' | ||
| : getWidgetMaxHeight(theme) | ||
| return { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On playground, config?.theme?.container?.height === '100%' and config?.theme?.container?.display === 'flex' is "Full height" layout - there are no other layouts with display: "flex".