diff --git a/packages/code-studio/src/styleguide/ListViews.tsx b/packages/code-studio/src/styleguide/ListViews.tsx index 5085ecf994..27e42746d6 100644 --- a/packages/code-studio/src/styleguide/ListViews.tsx +++ b/packages/code-studio/src/styleguide/ListViews.tsx @@ -1,4 +1,4 @@ -import React, { ReactNode, useCallback, useState } from 'react'; +import React, { ChangeEvent, ReactNode, useCallback, useState } from 'react'; import type { StyleProps } from '@react-types/shared'; import { Grid, @@ -10,13 +10,15 @@ import { Text, Flex, Checkbox, + ListViewProps, + RadioGroup, + RadioItem, } from '@deephaven/components'; import { vsAccount, vsPerson } from '@deephaven/icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { generateNormalizedItems, sampleSectionIdAndClasses } from './utils'; // Generate enough items to require scrolling -const itemsSimple = [...generateNormalizedItems(52)]; const itemsWithIcons = [...generateNormalizedItems(52, { icons: true })]; function AccountIllustration(): JSX.Element { @@ -32,13 +34,25 @@ function AccountIllustration(): JSX.Element { interface LabeledProps extends StyleProps { label: string; + direction?: 'row' | 'column'; children: ReactNode; } -function LabeledFlexColumn({ label, children, ...styleProps }: LabeledProps) { +function LabeledFlexContainer({ + label, + direction = 'column', + children, + ...styleProps +}: LabeledProps) { return ( - // eslint-disable-next-line react/jsx-props-no-spreading - + {label} {children} @@ -50,6 +64,15 @@ export function ListViews(): JSX.Element { [] ); + const [density, setDensity] = useState('compact'); + + const onDensityChange = useCallback( + (event: ChangeEvent) => { + setDensity(event.currentTarget.value as ListViewProps['density']); + }, + [] + ); + const [showIcons, setShowIcons] = useState(true); const onChange = useCallback((keys: 'all' | Iterable): void => { @@ -62,20 +85,32 @@ export function ListViews(): JSX.Element {

List View

- + + + Compact + Regular + Spacious + + + + Aaa - + - + @@ -99,12 +134,12 @@ export function ListViews(): JSX.Element { Item with icon E - + - + Description - + - + - - - - - + ); diff --git a/packages/components/src/spectrum/listView/ListViewWrapper.scss b/packages/components/src/spectrum/listView/ListViewWrapper.scss index d3895c8f77..636d00060b 100644 --- a/packages/components/src/spectrum/listView/ListViewWrapper.scss +++ b/packages/components/src/spectrum/listView/ListViewWrapper.scss @@ -1,4 +1,4 @@ -.dh-list-view-wrapper-scale-medium { +.dh-list-view-wrapper { --dh-list-view-item-icon-compact: 24px; --dh-list-view-item-icon-regular: 26px; --dh-list-view-item-icon-spacious: 32px; @@ -15,11 +15,13 @@ height: var(--dh-list-view-item-icon-compact); } } + .dh-list-view-wrapper-density-regular { svg[class*='react-spectrum-ListViewItem-thumbnail'] { height: var(--dh-list-view-item-icon-regular); } } + .dh-list-view-wrapper-density-spacious { svg[class*='react-spectrum-ListViewItem-thumbnail'] { height: var(--dh-list-view-item-icon-spacious);