Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import styled from 'styled-components'

export const Container = styled.div<React.HTMLAttributes<HTMLDivElement>>`
height: 36px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image Please use some of the theme values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the style of the container from the sass file; I simply turned it into a styled components to get rid of the unused styles

width: 200px;
min-width: 80px;
overflow: hidden;
position: relative;
flex-shrink: 0;
`
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import cx from 'classnames'
import React, { useEffect, useState } from 'react'
import { isString } from 'lodash'
import { useDispatch, useSelector } from 'react-redux'
Expand Down Expand Up @@ -32,14 +31,15 @@ import { localStorageService } from 'uiSrc/services'
import { BrowserStorageItem } from 'uiSrc/constants'

import { IconButton } from 'uiSrc/components/base/forms/buttons'
import { ResetIcon } from 'uiSrc/components/base/icons'
import { PlusIcon, ResetIcon } from 'uiSrc/components/base/icons'
import { RiTooltip } from 'uiSrc/components'
import {
RiSelect,
SelectValueRenderParams,
} from 'uiSrc/components/base/forms/select/RiSelect'
import { Text } from 'uiSrc/components/base/text'
import styles from './styles.module.scss'
import { Row } from 'uiSrc/components/base/layout/flex'
import * as S from './RediSearchIndexesList.styles'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is single component there, why this obscurity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SM's style guide https://github.com/redislabsdev/cloud-ui/blob/master/style-guide/styling-themes.md#-good

THis is a scalable solution - does not changes imports in case of multiple components

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we adopt it officially? Since this was merged, the discussion is pointless, but I disagree with the points it makes regarding imports. When I type in the editor, it does not suggest me to import S from './styles.ts', it suggests Container.
Also in the same file there is https://github.com/redislabsdev/cloud-ui/blob/master/style-guide/styling-themes.md#-good-2 and you violate it on the spot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re 2nd paragraph - as I said, I just moved sass styles to styled components 1:1. Both values you provided (32, 40) are different than what we had - 36. We need to come up with a solution separately regarding these values and usage across codebase.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import * as S from './RediSearchIndexesList.styles'
import { Container } from './RediSearchIndexesList.styles'


export const CREATE = 'create'

Expand Down Expand Up @@ -98,29 +98,31 @@ const RediSearchIndexesList = (props: Props) => {
return {
value: JSON.stringify(index),
inputDisplay: (
<Text component="span" data-test-subj={`mode-option-type-${value}`}>
{value}
</Text>
<Text data-test-subj={`mode-option-type-${value}`}>{value}</Text>
),
dropdownDisplay: (
<Text component="span" data-test-subj={`mode-option-type-${value}`}>
<Text color="primary" data-test-subj={`mode-option-type-${value}`}>
{value}
</Text>
),
}
})

options.unshift({
options.push({
value: JSON.stringify(CREATE),
inputDisplay: <span>CREATE</span>,
dropdownDisplay: (
<Text
size="M"
className={cx(styles.createIndexBtn)}
data-testid="create-index-btn"
>
Create Index
</Text>
<Row align="center" justify="start" gap="xs">
<PlusIcon size="M" />
<Text
size="M"
variant="semiBold"
color="primary"
data-testid="create-index-btn"
>
Create Index
</Text>
</Row>
),
})

Expand Down Expand Up @@ -181,7 +183,7 @@ const RediSearchIndexesList = (props: Props) => {
}

return (
<div className={cx(styles.container)}>
<S.Container>
<RiSelect.Compose
disabled={loading}
options={options}
Expand Down Expand Up @@ -212,7 +214,7 @@ const RediSearchIndexesList = (props: Props) => {
</RiSelect.Trigger.Compose>
<RiSelect.Content optionValueRender={selectValueRender} />
</RiSelect.Compose>
</div>
</S.Container>
)
}

Expand Down

This file was deleted.

Loading