From 98e50682251e0583588a7ae37470140c514b09b4 Mon Sep 17 00:00:00 2001 From: Aram Limpens Date: Wed, 7 Feb 2024 10:04:15 +0100 Subject: [PATCH] Implement compact grid --- packages/css/src/components/grid/grid.scss | 8 ----- packages/react/src/Grid/Grid.test.tsx | 30 ++----------------- packages/react/src/Grid/Grid.tsx | 10 +------ .../amsterdam/grid.compact.tokens.json | 14 +++++++++ .../src/components/amsterdam/grid.tokens.json | 24 ++++----------- .../components/amsterdam/header.tokens.json | 2 +- .../amsterdam/mega-menu.tokens.json | 4 +-- 7 files changed, 27 insertions(+), 65 deletions(-) create mode 100644 proprietary/tokens/src/components/amsterdam/grid.compact.tokens.json diff --git a/packages/css/src/components/grid/grid.scss b/packages/css/src/components/grid/grid.scss index 3505afb737..64939ac993 100644 --- a/packages/css/src/components/grid/grid.scss +++ b/packages/css/src/components/grid/grid.scss @@ -6,9 +6,6 @@ @import "../../common/breakpoint"; .amsterdam-grid { - --amsterdam-grid-gap: var(--amsterdam-grid-spacious-gap); - --amsterdam-grid-padding-inline: var(--amsterdam-grid-spacious-padding-inline); - display: grid; gap: var(--amsterdam-grid-gap); grid-template-columns: repeat(var(--amsterdam-grid-column-count), 1fr); @@ -23,11 +20,6 @@ } } -.amsterdam-grid--compact { - --amsterdam-grid-gap: var(--amsterdam-grid-compact-gap); - --amsterdam-grid-padding-inline: var(--amsterdam-grid-compact-padding-inline); -} - .amsterdam-grid--gap-vertical--none { row-gap: initial; } diff --git a/packages/react/src/Grid/Grid.test.tsx b/packages/react/src/Grid/Grid.test.tsx index 01198dec8b..37e279419f 100644 --- a/packages/react/src/Grid/Grid.test.tsx +++ b/packages/react/src/Grid/Grid.test.tsx @@ -24,48 +24,24 @@ describe('Grid', () => { expect(component).toHaveClass('amsterdam-grid') }) - it('renders the compact class name', () => { - const { container } = render() - const component = container.querySelector(':only-child') - expect(component).toHaveClass('amsterdam-grid--compact') - }) - - it('renders a medium vertical spacing class name for a spacious grid', () => { + it('renders a medium vertical spacing class name', () => { const { container } = render() const component = container.querySelector(':only-child') expect(component).toHaveClass('amsterdam-grid--padding-vertical--medium') }) - it('renders a medium vertical spacing class name for a compact grid', () => { - const { container } = render() - const component = container.querySelector(':only-child') - expect(component).toHaveClass('amsterdam-grid--padding-vertical--medium') - }) - - it('renders a small top class name for a spacious grid', () => { + it('renders a small top class name', () => { const { container } = render() const component = container.querySelector(':only-child') expect(component).toHaveClass('amsterdam-grid--padding-top--small') }) - it('renders a small top class name for a compact grid', () => { - const { container } = render() - const component = container.querySelector(':only-child') - expect(component).toHaveClass('amsterdam-grid--padding-top--small') - }) - - it('renders a large bottom class name for a spacious grid', () => { + it('renders a large bottom class name', () => { const { container } = render() const component = container.querySelector(':only-child') expect(component).toHaveClass('amsterdam-grid--padding-bottom--large') }) - it('renders a large bottom class name for a compact grid', () => { - const { container } = render() - const component = container.querySelector(':only-child') - expect(component).toHaveClass('amsterdam-grid--padding-bottom--large') - }) - it('renders a class name for a vertical gap', () => { const { container } = render() const component = container.querySelector(':only-child') diff --git a/packages/react/src/Grid/Grid.tsx b/packages/react/src/Grid/Grid.tsx index 7220bc11b5..bc27e2955b 100644 --- a/packages/react/src/Grid/Grid.tsx +++ b/packages/react/src/Grid/Grid.tsx @@ -34,13 +34,6 @@ type GridPaddingTopAndBottomProps = { } export type GridProps = { - /** - * Opts in to a less spacious layout. - * Decreases whitespace between columns and to the sides of the grid. - * This usually works well for applications. - * @todo Implement more generally – it will be moved into a theme soon. - */ - compact?: boolean /** The amount of vertical whitespace between rows of the grid. */ gapVertical?: 'none' | 'small' | 'large' } & (GridPaddingVerticalProp | GridPaddingTopAndBottomProps) & @@ -74,7 +67,7 @@ type GridComponent = { export const Grid = forwardRef( ( - { children, className, compact, gapVertical, paddingBottom, paddingTop, paddingVertical, ...restProps }: GridProps, + { children, className, gapVertical, paddingBottom, paddingTop, paddingVertical, ...restProps }: GridProps, ref: ForwardedRef, ) => (