diff --git a/redisinsight/ui/src/components/auto-refresh/AutoRefresh.tsx b/redisinsight/ui/src/components/auto-refresh/AutoRefresh.tsx index 831c79545b..7598a7a19b 100644 --- a/redisinsight/ui/src/components/auto-refresh/AutoRefresh.tsx +++ b/redisinsight/ui/src/components/auto-refresh/AutoRefresh.tsx @@ -250,7 +250,9 @@ const AutoRefresh = ({ anchorPosition="downRight" isOpen={isPopoverOpen} anchorClassName={styles.anchorWrapper} - panelClassName={cx('popover-without-top-tail', styles.popoverWrapper)} + panelClassName={cx('popover-without-top-tail', styles.popoverWrapper, { + [styles.popoverWrapperEditing]: editingRate, + })} closePopover={closePopover} button={ { export const StyledLink = styled(RedisUiLink)` ${useColorTextStyles}; - - text-decoration: underline !important; - - &:hover { + text-decoration: none !important; + & > span { text-decoration: none !important; } + &:hover { + text-decoration: underline !important; + } ` diff --git a/redisinsight/ui/src/components/inline-item-editor/InlineItemEditor.styles.tsx b/redisinsight/ui/src/components/inline-item-editor/InlineItemEditor.styles.tsx new file mode 100644 index 0000000000..7f45ad145e --- /dev/null +++ b/redisinsight/ui/src/components/inline-item-editor/InlineItemEditor.styles.tsx @@ -0,0 +1,154 @@ +import React from 'react' +import styled, { css } from 'styled-components' +import { FlexItem, Row } from 'uiSrc/components/base/layout/flex' +import { Theme } from 'uiSrc/components/base/theme/types' +import { Props } from 'uiSrc/components/inline-item-editor/InlineItemEditor' +import { IconButton } from 'uiSrc/components/base/forms/buttons' +import { CancelSlimIcon, CheckThinIcon } from 'uiSrc/components/base/icons' + +interface ContainerProps { + className?: string + children?: React.ReactNode +} + +const RefStyledContainer = React.forwardRef( + ( + { className, children }: ContainerProps, + ref?: React.Ref, + ) => ( +
+ {children} +
+ ), +) + +export const StyledContainer = styled(RefStyledContainer)` + max-width: 100%; + + & .euiFormControlLayout { + max-width: 100% !important; + } + + & .tooltip { + display: inline-block; + } +` + +export const IIEContainer = React.forwardRef< + HTMLDivElement, + { + children?: React.ReactNode + } +>(({ children, ...rest }, ref) => ( + + {children} + +)) + +type ActionsContainerProps = React.ComponentProps & { + $position?: Props['controlsPosition'] + $design?: Props['controlsDesign'] +} + +export const DeclineButton = styled(IconButton).attrs({ + icon: CancelSlimIcon, + 'aria-label': 'Cancel editing', +})` + &:hover { + color: ${({ theme }: { theme: Theme }) => + theme.semantic.color.text.danger500}; + } +` + +export const ApplyButton = styled(IconButton).attrs({ + icon: CheckThinIcon, + color: 'primary', + 'aria-label': 'Apply', +})` + vertical-align: initial; + &:hover:not([class*='isDisabled']) { + color: ${({ theme }: { theme: Theme }) => + theme.semantic.color.text.neutral500}; + } +` + +const positions = { + bottom: css` + top: 100%; + right: 0; + border-radius: 0 0 10px 10px; + box-shadow: 0 3px 3px var(--controlsBoxShadowColor); + `, + top: css` + bottom: 100%; + right: 0; + border-radius: 10px 10px 0 0; + box-shadow: 0 -3px 3px var(--controlsBoxShadowColor); + `, + right: css` + top: 0; + left: 100%; + border-radius: 0 10px 10px 0; + box-shadow: 0 3px 3px var(--controlsBoxShadowColor); + `, + left: css` + top: 0; + right: 100%; + border-radius: 10px 0 0 10px; + box-shadow: 0 3px 3px var(--controlsBoxShadowColor); + `, + inside: css` + top: calc(100% - 35px); + right: 7px; + border-radius: 0 10px 10px 0; + box-shadow: 0 3px 3px var(--controlsBoxShadowColor); + `, +} + +const designs = { + default: css``, + separate: css` + border-radius: 0; + box-shadow: none; + background-color: inherit !important; + text-align: right; + width: 60px; + z-index: 4; + + .popoverWrapper, + ${DeclineButton}, ${ApplyButton} { + margin: 6px 3px; + height: 24px !important; + width: 24px !important; + } + + ${ApplyButton} { + margin-top: 0; + } + + svg { + width: 18px !important; + height: 18px !important; + } + `, +} + +export const ActionsWrapper = styled(FlexItem)<{ + $size?: { width: string; height: string } +}>` + width: ${({ $size }) => $size?.width ?? '24px'} !important; + height: ${({ $size }) => $size?.height ?? '24px'} !important; +` + +export const ActionsContainer = styled(Row)` + position: absolute; + background-color: ${({ theme }: { theme: Theme }) => + theme.semantic.color.background.primary200}; + width: 80px; + height: 33px; + padding: ${({ theme }: { theme: Theme }) => theme.core.space.space050}; + + z-index: 3; + ${({ $position }) => positions[$position || 'inside']} + ${({ $design }) => designs[$design || 'default']} +` diff --git a/redisinsight/ui/src/components/inline-item-editor/InlineItemEditor.tsx b/redisinsight/ui/src/components/inline-item-editor/InlineItemEditor.tsx index affd8d1b88..ad580dfa39 100644 --- a/redisinsight/ui/src/components/inline-item-editor/InlineItemEditor.tsx +++ b/redisinsight/ui/src/components/inline-item-editor/InlineItemEditor.tsx @@ -1,21 +1,29 @@ import React, { ChangeEvent, Ref, useEffect, useRef, useState } from 'react' -import { capitalize } from 'lodash' import cx from 'classnames' +import { useTheme } from '@redis-ui/styles' +import { EuiFieldText } from '@elastic/eui' + import * as keys from 'uiSrc/constants/keys' import { RiPopover, RiTooltip } from 'uiSrc/components/base' import { FlexItem } from 'uiSrc/components/base/layout/flex' import { WindowEvent } from 'uiSrc/components/base/utils/WindowEvent' import { FocusTrap } from 'uiSrc/components/base/utils/FocusTrap' import { OutsideClickDetector } from 'uiSrc/components/base/utils' -import { CancelSlimIcon, CheckThinIcon } from 'uiSrc/components/base/icons' -import { - DestructiveButton, - IconButton, -} from 'uiSrc/components/base/forms/buttons' +import { DestructiveButton } from 'uiSrc/components/base/forms/buttons' import { Text } from 'uiSrc/components/base/text' + +import { + ActionsContainer, + ActionsWrapper, + ApplyButton, + DeclineButton, + IIEContainer, +} from './InlineItemEditor.styles' + import { TextInput } from 'uiSrc/components/base/inputs' + import styles from './styles.module.scss' type Positions = 'top' | 'bottom' | 'left' | 'right' | 'inside' @@ -91,6 +99,9 @@ const InlineItemEditor = (props: Props) => { const [value, setValue] = useState(initialValue) const [isError, setIsError] = useState(false) const [isShowApprovePopover, setIsShowApprovePopover] = useState(false) + const theme = useTheme() + + const size = theme.components.iconButton.sizes[iconSize ?? 'M'] const inputRef: Ref = useRef(null) @@ -164,7 +175,7 @@ const InlineItemEditor = (props: Props) => { const ApplyBtn = ( { } data-testid="apply-tooltip" > - { children ) : ( -
+
{ )} -
- - {!approveByValidation && ApplyBtn} + + + + {!approveByValidation && ( + {ApplyBtn} + )} {approveByValidation && ( - setIsShowApprovePopover(false)} - anchorClassName={styles.popoverAnchor} - panelClassName={cx(styles.popoverPanel)} - button={ApplyBtn} - > -
+ setIsShowApprovePopover(false)} + anchorClassName={cx( + styles.popoverAnchor, + 'popoverAnchor', + )} + panelClassName={cx(styles.popoverPanel)} + button={ApplyBtn} > - - {!!approveText?.title && ( -

- {approveText?.title} -

- )} - - {approveText?.text} +
+ + {!!approveText?.title && ( +

+ {approveText?.title} +

+ )} + + {approveText?.text} +
- -
- - Save - +
+ + Save + +
-
-
+ + )} -
+ -
+
)} diff --git a/redisinsight/ui/src/components/inline-item-editor/styles.module.scss b/redisinsight/ui/src/components/inline-item-editor/styles.module.scss index 2657157e40..3287b9b47c 100644 --- a/redisinsight/ui/src/components/inline-item-editor/styles.module.scss +++ b/redisinsight/ui/src/components/inline-item-editor/styles.module.scss @@ -15,15 +15,7 @@ } .controls { - position: absolute; - background-color: var(--euiColorLightestShade); - width: 80px; - height: 33px; - - z-index: 3; - .tooltip, - .declineBtn, .popoverWrapper { width: 50% !important; height: 100% !important; diff --git a/redisinsight/ui/src/components/instance-header/styles.module.scss b/redisinsight/ui/src/components/instance-header/styles.module.scss index 7f5aad114e..5f1605a53d 100644 --- a/redisinsight/ui/src/components/instance-header/styles.module.scss +++ b/redisinsight/ui/src/components/instance-header/styles.module.scss @@ -69,6 +69,10 @@ .dbIndexInput { width: 60px !important; + height: 32px !important; + border-color: transparent !important; + border-bottom-right-radius: 0 !important; + border-top-right-radius: 0 !important; } .divider { diff --git a/redisinsight/ui/src/components/settings-item/SettingItem.tsx b/redisinsight/ui/src/components/settings-item/SettingItem.tsx index c54aa02a94..c72aa1d42b 100644 --- a/redisinsight/ui/src/components/settings-item/SettingItem.tsx +++ b/redisinsight/ui/src/components/settings-item/SettingItem.tsx @@ -74,8 +74,8 @@ const SettingItem = (props: Props) => { setHovering(true)} - onMouseLeave={() => setHovering(false)} + onMouseEnter={() => !isEditing && setHovering(true)} + onMouseLeave={() => !isEditing && setHovering(false)} onClick={() => setEditing(true)} style={{ width: '200px' }} > diff --git a/redisinsight/ui/src/components/settings-item/styles.module.scss b/redisinsight/ui/src/components/settings-item/styles.module.scss index e57002271c..7b9f693261 100644 --- a/redisinsight/ui/src/components/settings-item/styles.module.scss +++ b/redisinsight/ui/src/components/settings-item/styles.module.scss @@ -1,6 +1,8 @@ .input { height: 31px !important; font-family: 'Graphik', sans-serif !important; + border-bottom-right-radius: 0 !important; + border-top-right-radius: 0 !important; } .inputEditing { @@ -13,8 +15,7 @@ align-items: center; justify-content: space-between; padding-left: 10px; - padding-bottom: 5px; - + & > * { line-height: 3.1rem !important; }