Skip to content

Commit 283483a

Browse files
committed
fixing styles for InlineItemEditor.tsx 3
1 parent 66096af commit 283483a

File tree

7 files changed

+87
-71
lines changed

7 files changed

+87
-71
lines changed

redisinsight/ui/src/components/auto-refresh/AutoRefresh.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ const AutoRefresh = ({
250250
anchorPosition="downRight"
251251
isOpen={isPopoverOpen}
252252
anchorClassName={styles.anchorWrapper}
253-
panelClassName={cx('popover-without-top-tail', styles.popoverWrapper)}
253+
panelClassName={cx('popover-without-top-tail', styles.popoverWrapper, {
254+
[styles.popoverWrapperEditing]: editingRate,
255+
})}
254256
closePopover={closePopover}
255257
button={
256258
<IconButton

redisinsight/ui/src/components/auto-refresh/styles.module.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,14 @@
6161

6262
input {
6363
height: 30px !important;
64-
border-radius: 0px !important;
64+
border-radius: 0 !important;
6565
background-color: var(--euiColorLightestShade) !important;
6666
}
6767
}
6868
}
69+
.popoverWrapperEditing {
70+
height: 140px;
71+
}
6972

7073
.inputContainer {
7174
height: 30px;

redisinsight/ui/src/components/inline-item-editor/InlineItemEditor.styles.tsx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import styled, { css } from 'styled-components'
3-
import { Row } from 'uiSrc/components/base/layout/flex'
3+
import { FlexItem, Row } from 'uiSrc/components/base/layout/flex'
44
import { Theme } from 'uiSrc/components/base/theme/types'
55
import { Props } from 'uiSrc/components/inline-item-editor/InlineItemEditor'
66
import { IconButton } from 'uiSrc/components/base/forms/buttons'
@@ -25,9 +25,13 @@ const RefStyledContainer = React.forwardRef(
2525
export const StyledContainer = styled(RefStyledContainer)`
2626
max-width: 100%;
2727
28-
:global(.euiFormControlLayout) {
28+
& .euiFormControlLayout {
2929
max-width: 100% !important;
3030
}
31+
32+
& .tooltip {
33+
display: inline-block;
34+
}
3135
`
3236

3337
export const IIEContainer = React.forwardRef<
@@ -50,9 +54,6 @@ export const DeclineButton = styled(IconButton).attrs({
5054
icon: CancelSlimIcon,
5155
'aria-label': 'Cancel editing',
5256
})`
53-
width: 50%;
54-
height: 100%;
55-
5657
&:hover {
5758
color: ${({ theme }: { theme: Theme }) =>
5859
theme.semantic.color.text.danger500};
@@ -64,9 +65,7 @@ export const ApplyButton = styled(IconButton).attrs({
6465
color: 'primary',
6566
'aria-label': 'Apply',
6667
})`
67-
height: 100% !important;
68-
width: 100% !important;
69-
68+
vertical-align: initial;
7069
&:hover:not([class*='isDisabled']) {
7170
color: ${({ theme }: { theme: Theme }) =>
7271
theme.semantic.color.text.neutral500};
@@ -134,6 +133,13 @@ const designs = {
134133
`,
135134
}
136135

136+
export const ActionsWrapper = styled(FlexItem)<{
137+
$size?: { width: string; height: string }
138+
}>`
139+
width: ${({ $size }) => $size?.width ?? '24px'} !important;
140+
height: ${({ $size }) => $size?.height ?? '24px'} !important;
141+
`
142+
137143
export const ActionsContainer = styled(Row)<ActionsContainerProps>`
138144
position: absolute;
139145
background-color: ${({ theme }: { theme: Theme }) =>
@@ -145,11 +151,4 @@ export const ActionsContainer = styled(Row)<ActionsContainerProps>`
145151
z-index: 3;
146152
${({ $position }) => positions[$position || 'inside']}
147153
${({ $design }) => designs[$design || 'default']}
148-
149-
.tooltip,
150-
.declineBtn,
151-
.popoverWrapper {
152-
width: 50% !important;
153-
height: 100% !important;
154-
}
155154
`

redisinsight/ui/src/components/inline-item-editor/InlineItemEditor.tsx

Lines changed: 59 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { ChangeEvent, Ref, useEffect, useRef, useState } from 'react'
22
import cx from 'classnames'
3+
import { useTheme } from '@redis-ui/styles'
34
import { EuiFieldText } from '@elastic/eui'
45

56
import * as keys from 'uiSrc/constants/keys'
@@ -12,6 +13,7 @@ import { DestructiveButton } from 'uiSrc/components/base/forms/buttons'
1213
import { Text } from 'uiSrc/components/base/text'
1314
import {
1415
ActionsContainer,
16+
ActionsWrapper,
1517
ApplyButton,
1618
DeclineButton,
1719
IIEContainer,
@@ -92,6 +94,9 @@ const InlineItemEditor = (props: Props) => {
9294
const [value, setValue] = useState<string>(initialValue)
9395
const [isError, setIsError] = useState<boolean>(false)
9496
const [isShowApprovePopover, setIsShowApprovePopover] = useState(false)
97+
const theme = useTheme()
98+
99+
const size = theme.components.iconButton.sizes[iconSize ?? 'M']
95100

96101
const inputRef: Ref<HTMLInputElement> = useRef(null)
97102

@@ -165,7 +170,7 @@ const InlineItemEditor = (props: Props) => {
165170

166171
const ApplyBtn = (
167172
<RiTooltip
168-
anchorClassName={styles.tooltip}
173+
anchorClassName={cx(styles.tooltip, 'tooltip')}
169174
position="bottom"
170175
title={
171176
(isDisabled && disabledTooltipText?.title) ||
@@ -227,6 +232,8 @@ const InlineItemEditor = (props: Props) => {
227232
)}
228233
</FlexItem>
229234
<ActionsContainer
235+
justify="around"
236+
gap="m"
230237
$position={controlsPosition}
231238
$design={controlsDesign}
232239
grow={false}
@@ -236,53 +243,61 @@ const InlineItemEditor = (props: Props) => {
236243
controlsClassName,
237244
)}
238245
>
239-
<DeclineButton
240-
size={iconSize ?? 'M'}
241-
onClick={onDecline}
242-
disabled={isLoading}
243-
data-testid="cancel-btn"
244-
/>
245-
{!approveByValidation && ApplyBtn}
246+
<ActionsWrapper $size={size}>
247+
<DeclineButton
248+
onClick={onDecline}
249+
disabled={isLoading}
250+
data-testid="cancel-btn"
251+
/>
252+
</ActionsWrapper>
253+
{!approveByValidation && (
254+
<ActionsWrapper $size={size}>{ApplyBtn}</ActionsWrapper>
255+
)}
246256
{approveByValidation && (
247-
<RiPopover
248-
anchorPosition="leftCenter"
249-
isOpen={isShowApprovePopover}
250-
closePopover={() => setIsShowApprovePopover(false)}
251-
anchorClassName={styles.popoverAnchor}
252-
panelClassName={cx(styles.popoverPanel)}
253-
button={ApplyBtn}
254-
>
255-
<div
256-
className={styles.popover}
257-
data-testid="approve-popover"
257+
<ActionsWrapper $size={size}>
258+
<RiPopover
259+
anchorPosition="leftCenter"
260+
isOpen={isShowApprovePopover}
261+
closePopover={() => setIsShowApprovePopover(false)}
262+
anchorClassName={cx(
263+
styles.popoverAnchor,
264+
'popoverAnchor',
265+
)}
266+
panelClassName={cx(styles.popoverPanel)}
267+
button={ApplyBtn}
258268
>
259-
<Text size="m" component="div">
260-
{!!approveText?.title && (
261-
<h4>
262-
<b>{approveText?.title}</b>
263-
</h4>
264-
)}
265-
<Text
266-
size="s"
267-
color="subdued"
268-
className={styles.approveText}
269-
>
270-
{approveText?.text}
269+
<div
270+
className={styles.popover}
271+
data-testid="approve-popover"
272+
>
273+
<Text size="m" component="div">
274+
{!!approveText?.title && (
275+
<h4>
276+
<b>{approveText?.title}</b>
277+
</h4>
278+
)}
279+
<Text
280+
size="s"
281+
color="subdued"
282+
className={styles.approveText}
283+
>
284+
{approveText?.text}
285+
</Text>
271286
</Text>
272-
</Text>
273-
<div className={styles.popoverFooter}>
274-
<DestructiveButton
275-
aria-label="Save"
276-
className={cx(styles.btn, styles.saveBtn)}
277-
disabled={isDisabledApply()}
278-
onClick={handleFormSubmit}
279-
data-testid="save-btn"
280-
>
281-
Save
282-
</DestructiveButton>
287+
<div className={styles.popoverFooter}>
288+
<DestructiveButton
289+
aria-label="Save"
290+
className={cx(styles.btn, styles.saveBtn)}
291+
disabled={isDisabledApply()}
292+
onClick={handleFormSubmit}
293+
data-testid="save-btn"
294+
>
295+
Save
296+
</DestructiveButton>
297+
</div>
283298
</div>
284-
</div>
285-
</RiPopover>
299+
</RiPopover>
300+
</ActionsWrapper>
286301
)}
287302
</ActionsContainer>
288303
</form>

redisinsight/ui/src/components/inline-item-editor/styles.module.scss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,7 @@
1515
}
1616

1717
.controls {
18-
position: absolute;
19-
background-color: var(--euiColorLightestShade);
20-
width: 80px;
21-
height: 33px;
22-
23-
z-index: 3;
24-
2518
.tooltip,
26-
.declineBtn,
2719
.popoverWrapper {
2820
width: 50% !important;
2921
height: 100% !important;

redisinsight/ui/src/components/instance-header/styles.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969

7070
.dbIndexInput {
7171
width: 60px !important;
72+
height: 32px !important;
73+
border-color: transparent !important;
74+
border-bottom-right-radius: 0 !important;
75+
border-top-right-radius: 0 !important;
7276
}
7377

7478
.divider {

redisinsight/ui/src/components/settings-item/styles.module.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.input {
22
height: 31px !important;
33
font-family: 'Graphik', sans-serif !important;
4+
border-bottom-right-radius: 0 !important;
5+
border-top-right-radius: 0 !important;
46
}
57

68
.inputEditing {
@@ -13,8 +15,7 @@
1315
align-items: center;
1416
justify-content: space-between;
1517
padding-left: 10px;
16-
padding-bottom: 5px;
17-
18+
1819
& > * {
1920
line-height: 3.1rem !important;
2021
}

0 commit comments

Comments
 (0)