diff --git a/src/components/Flex.tsx b/src/components/Flex.tsx index 2d8850bb..4d3a1f15 100644 --- a/src/components/Flex.tsx +++ b/src/components/Flex.tsx @@ -1,8 +1,8 @@ -// drop-in replacement for anywhere 'honorable' Flex is used. Moving forward a regular div or a styled component should just be used instead +// drop-in replacement for anywhere 'honorable' Flex is used import { type CSSProperties, - type ComponentProps, + type ReactNode, type Ref, forwardRef, memo, @@ -46,9 +46,11 @@ type FlexBaseProps = { | 'space-evenly' gap?: string + + children?: ReactNode } -type FlexProps = CSSProperties & ComponentProps<'div'> & FlexBaseProps +type FlexProps = Omit & FlexBaseProps function FlexRef(props: FlexProps, ref: Ref) { const { diff --git a/src/components/IconFrame.tsx b/src/components/IconFrame.tsx index 8fb9c4de..b23d6a78 100644 --- a/src/components/IconFrame.tsx +++ b/src/components/IconFrame.tsx @@ -1,3 +1,4 @@ +import { ButtonBase, Flex } from 'honorable' import { type ComponentProps, type ReactElement, @@ -5,11 +6,12 @@ import { cloneElement, forwardRef, } from 'react' -import { ButtonBase, Flex, type FlexProps } from 'honorable' import styled from 'styled-components' import { type styledTheme } from '../theme' +import { type SemanticColorKey } from '../theme/colors' + import Tooltip, { type TooltipProps } from './Tooltip' type Size = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' @@ -85,7 +87,7 @@ const sizeToFrameSize: Record = { xlarge: 48, } -type IconFrameProps = Omit & { +type IconFrameProps = { clickable?: boolean disabled?: boolean textValue?: string @@ -95,6 +97,7 @@ type IconFrameProps = Omit & { tooltipProps?: Partial type?: Type selected?: boolean + background?: SemanticColorKey } const IconFrameSC = styled(Flex)<{ @@ -102,14 +105,17 @@ const IconFrameSC = styled(Flex)<{ $clickable: boolean $selected: boolean $size: Size -}>(({ theme, $type, $clickable, $selected, $size }) => ({ + $background?: SemanticColorKey +}>(({ theme, $type, $clickable, $selected, $size, $background }) => ({ display: 'flex', alignItems: 'center', alignContent: 'center', justifyContent: 'center', width: sizeToFrameSize[$size], height: sizeToFrameSize[$size], - backgroundColor: $selected + backgroundColor: $background + ? theme.colors[$background] + : $selected ? typeToSelectedBG(theme)[$type] : typeToBG(theme)[$type], border: typeToBorder(theme)[$type], @@ -157,6 +163,7 @@ const IconFrame = forwardRef< tooltip, tooltipProps, type = 'tertiary', + background, as, ...props }, @@ -174,6 +181,7 @@ const IconFrame = forwardRef< $selected={selected} $type={type} $size={size} + $background={background} ref={ref} aria-label={textValue} disabled={(clickable && disabled) || undefined} diff --git a/src/theme/scrollBar.ts b/src/theme/scrollBar.ts index 92e4da3e..bda35cd2 100644 --- a/src/theme/scrollBar.ts +++ b/src/theme/scrollBar.ts @@ -7,14 +7,11 @@ import { type FillLevel } from '../components/contexts/FillLevelContext' import { semanticColorCssVars } from './colors' export const scrollBar = ({ fillLevel }: { fillLevel: FillLevel }) => { - const trackColor = - fillLevel >= 2 - ? semanticColorCssVars['fill-three'] - : semanticColorCssVars['fill-two'] + const trackColor = 'transparent' const barColor = fillLevel >= 2 ? semanticColorCssVars['text-xlight'] - : semanticColorCssVars['fill-three'] + : semanticColorCssVars['fill-three-hover'] const barWidth = 6 const barRadius = barWidth / 2