Skip to content

Commit

Permalink
remove last fill level
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Nov 19, 2024
1 parent 17070cd commit 23fadfb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
11 changes: 6 additions & 5 deletions src/components/table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { useVirtualizer } from '@tanstack/react-virtual'
import styled, { useTheme } from 'styled-components'
import { isEmpty, isNil } from 'lodash-es'

import { type FillLevel, InfoOutlineIcon, Tooltip } from '../../index'
import { InfoOutlineIcon, Tooltip } from '../../index'

import Button from '../Button'
import CaretUpIcon from '../icons/CaretUpIcon'
Expand All @@ -43,6 +43,7 @@ import EmptyState, { type EmptyStateProps } from '../EmptyState'
import { Spinner } from '../Spinner'

import {
type TableFillLevel,
tableFillLevelToBg,
tableFillLevelToBorder,
tableFillLevelToBorderColor,
Expand All @@ -61,7 +62,7 @@ export type TableProps = DivProps & {
columns: any[]
hideHeader?: boolean
padCells?: boolean
fillLevel?: FillLevel
fillLevel?: TableFillLevel
rowBg?: 'base' | 'raised' | 'stripes'
highlightedRowId?: string
getRowCanExpand?: any
Expand Down Expand Up @@ -151,7 +152,7 @@ const Tbody = styled(TbodyUnstyled)(() => ({
}))

export const Tr = styled.tr<{
$fillLevel: FillLevel
$fillLevel: TableFillLevel
$highlighted?: boolean
$selected?: boolean
$selectable?: boolean
Expand Down Expand Up @@ -192,7 +193,7 @@ export const Tr = styled.tr<{
)

const Th = styled.th<{
$fillLevel: FillLevel
$fillLevel: TableFillLevel
$stickyColumn: boolean
$highlight?: boolean
$cursor?: CSSProperties['cursor']
Expand Down Expand Up @@ -266,7 +267,7 @@ const Th = styled.th<{

// TODO: Set vertical align to top for tall cells (~3 lines of text or more). See ENG-683.
export const Td = styled.td<{
$fillLevel: FillLevel
$fillLevel: TableFillLevel
$firstRow?: boolean
$loose?: boolean
$padCells?: boolean
Expand Down
30 changes: 11 additions & 19 deletions src/components/table/colors.ts
Original file line number Diff line number Diff line change
@@ -1,67 +1,59 @@
import type { FillLevel } from '../contexts/FillLevelContext'

export type TableFillLevel = Exclude<FillLevel, 3>

export const tableFillLevelToBorder = {
0: 'default',
1: 'fill-one',
2: 'fill-two',
3: 'fill-three',
} as const satisfies Record<FillLevel, string>
} as const satisfies Record<TableFillLevel, string>

export const tableFillLevelToBorderColor = {
0: 'border-fill-two',
1: 'border-fill-three',
2: 'border-fill-three',
3: 'border-fill-three',
} as const satisfies Record<FillLevel, string>
} as const satisfies Record<TableFillLevel, string>

export const tableFillLevelToBg = {
0: 'fill-zero',
1: 'fill-one',
2: 'fill-two',
3: 'fill-three',
} as const satisfies Record<FillLevel, string>
} as const satisfies Record<TableFillLevel, string>

export const tableFillLevelToHeaderBg = {
0: 'fill-one',
1: 'fill-two',
2: 'fill-three',
3: 'fill-three',
} as const satisfies Record<FillLevel, string>
} as const satisfies Record<TableFillLevel, string>

export const tableFillLevelToCellBg = {
0: 'fill-zero',
1: 'fill-one',
2: 'fill-two',
3: 'fill-three',
} as const satisfies Record<FillLevel, string>
} as const satisfies Record<TableFillLevel, string>

export const tableFillLevelToRaisedCellBg = {
0: 'fill-zero-selected',
1: 'fill-one-selected',
2: 'fill-two-selected',
3: 'fill-three-selected',
} as const satisfies Record<FillLevel, string>
} as const satisfies Record<TableFillLevel, string>

export const tableFillLevelToSelectedCellBg = {
0: 'fill-zero-hover',
1: 'fill-one-hover',
2: 'fill-two-hover',
3: 'fill-three-hover',
} as const satisfies Record<FillLevel, string>
} as const satisfies Record<TableFillLevel, string>

export const tableFillLevelToHoverCellBg = {
0: 'fill-zero-hover',
1: 'fill-one-hover',
2: 'fill-two-hover',
3: 'fill-three-hover',
} as const satisfies Record<FillLevel, string>
} as const satisfies Record<TableFillLevel, string>

export const tableFillLevelToHighlightedCellBg = {
0: 'fill-two',
1: 'fill-three',
2: 'fill-three',
3: 'fill-three',
} as const satisfies Record<FillLevel, string>
} as const satisfies Record<TableFillLevel, string>

// TODO: Color getters.
// TODO: Ask Nick for verification.

0 comments on commit 23fadfb

Please sign in to comment.