Skip to content

Commit 4905099

Browse files
authored
RI-7785 Fix Analysis tabs padding consistency (#5255)
* feat(ui): create shared AnalysisPageContainer component * refactor(ui): use shared AnalysisPageContainer in Database Analysis page * fix(ui): add consistent padding to Overview page using shared container * refactor(ui): replace local styles with styled-components in ClusterDetailsPage * fix(ui): add consistent padding to Slow Log page using shared container * fix(ui): integrate AnalyticsPageHeader in ClusterDetails and SlowLog pages * refactor(ui): clean up styles in ClusterDetailsPage References: #RI-7785
1 parent 79f21b7 commit 4905099

File tree

22 files changed

+288
-222
lines changed

22 files changed

+288
-222
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import { Theme } from '@redis-ui/styles'
12
import styled from 'styled-components'
3+
import { scrollbarStyles } from 'uiSrc/styles/mixins'
24

3-
export const ClusterDetailsPageWrapper = styled.div<
4-
React.HTMLAttributes<HTMLDivElement>
5-
>`
5+
export const ClusterDetailsPageWrapper = styled.div`
6+
${scrollbarStyles()};
67
height: 100%;
7-
padding: 0 1.6rem;
8+
padding: 0 ${({ theme }: { theme: Theme }) => theme.core.space.space200};
89
`

redisinsight/ui/src/pages/cluster-details/ClusterDetailsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ const ClusterDetailsPage = () => {
134134
}
135135

136136
return (
137-
<S.ClusterDetailsPageWrapper data-testid="cluster-details-page">
137+
<S.ClusterDetailsPageWrapper as="div" data-testid="cluster-details-page">
138138
<ClusterDetailsHeader />
139139
<ClusterDetailsGraphics nodes={nodes} loading={loading} />
140140
<ClusterNodesTable nodes={nodes} />

redisinsight/ui/src/pages/cluster-details/components/cluster-details-header/ClusterDetailsHeader.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import {
1515
ConnectionType,
1616
CONNECTION_TYPE_DISPLAY,
1717
} from 'uiSrc/slices/interfaces'
18-
import AnalyticsTabs from 'uiSrc/components/analytics-tabs'
1918
import { clusterDetailsSelector } from 'uiSrc/slices/analytics/clusterDetails'
2019
import { Text } from 'uiSrc/components/base/text'
2120
import { RiTooltip } from 'uiSrc/components'
21+
import { AnalyticsPageHeader } from 'uiSrc/pages/database-analysis/components/analytics-page-header'
2222

2323
import styles from './styles.module.scss'
2424

@@ -91,8 +91,7 @@ const ClusterDetailsHeader = () => {
9191

9292
return (
9393
<div className={styles.container} data-testid="cluster-details-header">
94-
<AnalyticsTabs />
95-
94+
<AnalyticsPageHeader />
9695
{loading && !data && (
9796
<div className={styles.loading} data-testid="cluster-details-loading">
9897
<LoadingContent lines={2} />

redisinsight/ui/src/pages/cluster-details/components/cluster-details-header/styles.module.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.container {
22
background-color: var(--euiColorEmptyShade);
3-
max-width: 960px;
43
}
54

65
.content {

redisinsight/ui/src/pages/database-analysis/DatabaseAnalysisPageView.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
type ShortDatabaseAnalysis,
55
} from 'apiSrc/modules/database-analysis/models'
66
import { Nullable } from 'uiSrc/utils'
7-
import { MainContainer } from './components/styles'
7+
import { AnalysisPageContainer } from './components/analysis-page-container'
88
import { Header } from './components'
99
import DatabaseAnalysisTabs from './components/data-nav-tabs'
1010

@@ -23,7 +23,7 @@ export const DatabaseAnalysisPageView = ({
2323
handleSelectAnalysis,
2424
}: Props) => {
2525
return (
26-
<MainContainer data-testid="database-analysis-page">
26+
<AnalysisPageContainer data-testid="database-analysis-page">
2727
<Header
2828
items={reports}
2929
selectedValue={selectedAnalysis}
@@ -36,6 +36,6 @@ export const DatabaseAnalysisPageView = ({
3636
reports={reports}
3737
data={data}
3838
/>
39-
</MainContainer>
39+
</AnalysisPageContainer>
4040
)
4141
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import styled from 'styled-components'
2+
import { Col } from 'uiSrc/components/base/layout/flex'
3+
import { Theme } from 'uiSrc/components/base/theme/types'
4+
5+
export const StyledAnalysisPageContainer = styled(Col)`
6+
overflow: auto;
7+
padding-inline: ${({ theme }: { theme: Theme }) => theme.core.space.space200};
8+
`
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react'
2+
import { StyledAnalysisPageContainer } from './AnalysisPageContainer.styles'
3+
import { AnalysisPageContainerProps } from './AnalysisPageContainer.types'
4+
5+
export const AnalysisPageContainer = ({
6+
children,
7+
...rest
8+
}: AnalysisPageContainerProps) => (
9+
<StyledAnalysisPageContainer {...rest}>
10+
{children}
11+
</StyledAnalysisPageContainer>
12+
)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { ComponentPropsWithoutRef } from 'react'
2+
import { StyledAnalysisPageContainer } from './AnalysisPageContainer.styles'
3+
4+
export type AnalysisPageContainerProps = ComponentPropsWithoutRef<
5+
typeof StyledAnalysisPageContainer
6+
>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { AnalysisPageContainer } from './AnalysisPageContainer'
2+
export type { AnalysisPageContainerProps } from './AnalysisPageContainer.types'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import styled from 'styled-components'
2+
import { Row } from 'uiSrc/components/base/layout/flex'
3+
import { Theme } from 'uiSrc/components/base/theme/types'
4+
5+
const getBorderColor = (theme: Theme) =>
6+
theme.name === 'dark' ? theme.color.dark600 : theme.color.dusk150
7+
8+
export const HeaderContainer = styled.div`
9+
width: 100%;
10+
border-bottom: 4px solid
11+
${({ theme }: { theme: Theme }) => getBorderColor(theme)}; /* Mimic the tabs border width and color */
12+
`
13+
14+
export const HeaderContent = styled(Row).attrs({
15+
align: 'center',
16+
justify: 'between',
17+
})`
18+
min-height: 36px;
19+
`
20+
21+
export const TabsWrapper = styled.div`
22+
margin-bottom: -14px; /* Move it so it overlaps with the border of the tabs container */
23+
`

0 commit comments

Comments
 (0)