-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
ref(layout) use layout.main #112651
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
base: master
Are you sure you want to change the base?
ref(layout) use layout.main #112651
Changes from all commits
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 |
|---|---|---|
| @@ -1,11 +1,9 @@ | ||
| import styled from '@emotion/styled'; | ||
|
|
||
| import type {FlexProps} from '@sentry/scraps/layout'; | ||
|
|
||
| import * as Layout from 'sentry/components/layouts/thirds'; | ||
| import {SHORT_VIEWPORT_HEIGHT} from 'sentry/utils/useIsShortViewport'; | ||
|
|
||
| interface ViewportConstrainedPageProps extends FlexProps<'main'> { | ||
| interface ViewportConstrainedPageProps extends Layout.MainProps { | ||
| constrained?: boolean; | ||
| hideFooter?: boolean; | ||
| } | ||
|
|
@@ -27,11 +25,12 @@ export function ViewportConstrainedPage({ | |
| ...rest | ||
| }: ViewportConstrainedPageProps) { | ||
| if (!constrained) { | ||
| return <Layout.Page {...rest} />; | ||
| return <FlexMain width="full" {...rest} />; | ||
| } | ||
|
|
||
| return ( | ||
| <ConstrainedPage | ||
| <ConstrainedMain | ||
| width="full" | ||
| minHeight="0" | ||
| overflow="hidden" | ||
| data-hide-footer={hideFooter ? '' : undefined} | ||
|
|
@@ -40,7 +39,13 @@ export function ViewportConstrainedPage({ | |
| ); | ||
| } | ||
|
|
||
| const ConstrainedPage = styled(Layout.Page)` | ||
| const FlexMain = styled(Layout.Main)` | ||
| display: flex; | ||
| flex-direction: column; | ||
| min-height: 0; | ||
| `; | ||
|
Comment on lines
+42
to
+46
Collaborator
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. shouldn’t we use a Flex with render prop instead of custom styled ?
Member
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. I should add a lint rule just to prevent myself from doing this at this point |
||
|
|
||
| const ConstrainedMain = styled(FlexMain)` | ||
| contain: size; | ||
|
|
||
| @media (max-height: ${SHORT_VIEWPORT_HEIGHT}px) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| import styled from '@emotion/styled'; | ||
|
|
||
| import {FeatureBadge} from '@sentry/scraps/badge'; | ||
|
|
||
| import {FeedbackButton} from 'sentry/components/feedbackButton/feedbackButton'; | ||
|
|
@@ -25,15 +27,15 @@ export default function ErrorsContent() { | |
|
|
||
| return ( | ||
| <SentryDocumentTitle title={t('Errors')} orgSlug={organization?.slug}> | ||
| <Layout.Page> | ||
| <ErrorsPageMain width="full"> | ||
| <ErrorsHeader /> | ||
| <PageFiltersContainer> | ||
| <ExploreBodySearch> | ||
| <ErrorsFilterSection /> | ||
| </ExploreBodySearch> | ||
| </PageFiltersContainer> | ||
| <ErrorsBody /> | ||
| </Layout.Page> | ||
| </ErrorsPageMain> | ||
| </SentryDocumentTitle> | ||
| ); | ||
| } | ||
|
|
@@ -77,3 +79,9 @@ export function ErrorsBody() { | |
| </ExploreBodyContent> | ||
| ); | ||
| } | ||
|
|
||
| const ErrorsPageMain = styled(Layout.Main)` | ||
| display: flex; | ||
| flex-direction: column; | ||
| min-height: 0; | ||
| `; | ||
|
Contributor
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. Duplicated styled component across two filesLow Severity
Additional Locations (1)Reviewed by Cursor Bugbot for commit 6b4b5bb. Configure here. |
||


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.
Missing flex growth causes constrained page to collapse
High Severity
Switching from
Layout.PagetoLayout.Maindrops theflex="1"thatLayout.Pageprovides via itsStackwrapper.Layout.Mainrenders a plainContainerwith no flex-grow behavior. In the constrained path,ConstrainedMainappliescontain: size(which makes the element's intrinsic size zero) andminHeight="0". Withoutflex="1"to grow within the parent flex container (Layout.Page), this element collapses to zero height, making the logs page content invisible. The non-constrained path is also affected — the content won't fill remaining vertical space — though at least children remain visible. Aflex="1"prop needs to be passed toLayout.Mainin both paths.Additional Locations (1)
static/app/views/explore/components/viewportConstrainedPage.tsx#L27-L28Reviewed by Cursor Bugbot for commit 46689a5. Configure here.
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.
this is a valid feedback
but other than that, it looks good!