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
22 changes: 8 additions & 14 deletions redisinsight/ui/src/components/base/text/text.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,27 +92,20 @@
export const StyledColorText = styled(Typography.Body)<MapProps>`
${useColorTextStyles}
`

export const StyledText = styled(Typography.Body)<MapProps>`
${useColorTextStyles};
${({ $align }) => getAlignValue($align)};
`
export const Indicator = styled.div<
{
$color: ColorType
} & CommonProps
>`
width: 0.8rem;
height: 0.8rem;
border-radius: 50%;
background-color: ${({ $color }) => $color || 'inherit'};
`

const useStatusColorStyles = ({ $color }: MapProps = {}) => {
const theme = useTheme()
const colors = theme.semantic.color

const getColorValue = (color?: ColorType) => {
switch (color) {
case 'informative':
return colors.text.informative400

Check warning on line 108 in redisinsight/ui/src/components/base/text/text.styles.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 108 in redisinsight/ui/src/components/base/text/text.styles.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
case 'danger':
return colors.text.danger500
case 'warning':
Expand All @@ -129,16 +122,17 @@
`
}

export const StatusIndicator = styled.div<
export const Indicator = styled.div<
{
$color: ColorType
} & CommonProps
>`
${useStatusColorStyles};
width: 1rem;
height: 1rem;
width: 0.8rem;
height: 0.8rem;
border-radius: 50%;
${useStatusColorStyles};
`

export const mapSize = (size: TextSizeType): BodyProps['size'] => {
if (size === 'm') {
return 'M'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
StyledRdiAnalyticsTable,
StyledRdiStatisticsSectionBody,
} from 'uiSrc/pages/rdi/statistics/styles'
import { StatusIndicator } from 'uiSrc/components/base/text/text.styles'
import { Indicator } from 'uiSrc/components/base/text/text.styles'
import { Row } from 'uiSrc/components/base/layout/flex'

type ConnectionData = {
Expand Down Expand Up @@ -49,7 +49,7 @@ const columns: ColumnDefinition<ConnectionData>[] = [
}) => (
<Row align="center" justify="center">
<RiTooltip content={status}>
<StatusIndicator $color={getStatusColor(status)} />
<Indicator $color={getStatusColor(status)} />
</RiTooltip>
</Row>
),
Expand Down
Loading