` : null,
];
const control = html`
@@ -168,7 +158,7 @@ export const Default: Story = {};
export function renderInline(args: Args, context: Partial) {
const [_, updateArgs] = useArgs();
- const baseId = `${context.viewMode}_${context.name.replace(/\s/g, '-')}_ExampleRadio`;
+ const baseId = `${context.viewMode}_${context.name?.replace(/\s/g, '-')}_ExampleRadio`;
const id1 = baseId + '1';
const id2 = baseId + '2';
const id3 = baseId + '3';
From 9657a0265b41d992af4ccf5adb26258ebdc1fa42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20F=C3=BCrhoff?=
<12294151+imagoiq@users.noreply.github.com>
Date: Mon, 5 Feb 2024 08:28:10 +0100
Subject: [PATCH 3/6] feat(documentation): Add example and explanation for grid
gutters and remove unneeded page (#2589)
### What
- Add Gutters example
- Rework how we style the column in the documentation, I'm not sure if
it's the best way.
The Bootstrap documentation is confusing:
There is a gutter by default to 24px (check `.row` CSS rule.
--bs-gutter-x: equals 1.5rem;). But if you look at [the examples on the
column page](https://getbootstrap.com/docs/5.2/layout/columns/). The
gutter is not displayed (nor removed with `.g-0`). The gutter is not
visible because the applied style (background, padding, border) is on
the `.col`.
Meanwhile, if you look at the [examples on the gutters
page](https://getbootstrap.com/docs/5.2/layout/gutters/), the styles are
applied on a child element of the column (try to remove `.gx-5` from the
first example, and you still get a gutter, the default one).
So I decided to remove gutters with the `.g-0` class in our examples to
match the previous documentation (except for the first example to
highlight the default gutter). And to highlight how nesting works, I
made an exception on the style to match the column instead of the child
element.
---
.../foundation/layout/grid/grid.blocks.tsx | 4 +-
.../foundation/layout/grid/grid.docs.mdx | 12 +-
.../foundation/layout/grid/grid.stories.ts | 306 +++++++++++++-----
.../foundation/layout/grid/grid.styles.scss | 5 +-
.../layout/gutters/gutters.docs.mdx | 15 -
.../layout/gutters/gutters.stories.ts | 15 -
6 files changed, 241 insertions(+), 116 deletions(-)
delete mode 100644 packages/documentation/src/stories/foundation/layout/gutters/gutters.docs.mdx
delete mode 100644 packages/documentation/src/stories/foundation/layout/gutters/gutters.stories.ts
diff --git a/packages/documentation/src/stories/foundation/layout/grid/grid.blocks.tsx b/packages/documentation/src/stories/foundation/layout/grid/grid.blocks.tsx
index 0eeacc165d..a33a97a009 100644
--- a/packages/documentation/src/stories/foundation/layout/grid/grid.blocks.tsx
+++ b/packages/documentation/src/stories/foundation/layout/grid/grid.blocks.tsx
@@ -34,7 +34,9 @@ export const GridTable = () => (
diff --git a/packages/documentation/src/stories/foundation/layout/grid/grid.docs.mdx b/packages/documentation/src/stories/foundation/layout/grid/grid.docs.mdx
index 883790de95..a616412af9 100644
--- a/packages/documentation/src/stories/foundation/layout/grid/grid.docs.mdx
+++ b/packages/documentation/src/stories/foundation/layout/grid/grid.docs.mdx
@@ -1,4 +1,4 @@
-import { Meta, Canvas, Source } from '@storybook/blocks';
+import { Canvas, Meta, Source } from '@storybook/blocks';
import { formatAsMap } from '../../../../utils/sass-export';
import { GridTable, SCSS_VARIABLES } from './grid.blocks';
import * as GridStories from './grid.stories';
@@ -41,7 +41,7 @@ Breaking it down, here’s how the grid system comes together:
- **Rows are wrappers for columns.** Each column has horizontal `padding` (called a gutter) for controlling the space between them. This `padding` is then counteracted on the rows with negative margins to ensure the content in your columns is visually aligned down the left side. Rows also support modifier classes to uniformly apply column sizing and gutter classes to change the spacing of your content.
- **Columns are incredibly flexible.** There are 12 template columns available per row, allowing you to create different combinations of elements that span any number of columns. Column classes indicate the number of template columns to span (e.g., `.col-4` spans four). Widths are set in percentages so you always have the same relative sizing.
-- **Gutters are also responsive and customizable.** Gutter classes are available across all breakpoints, with all the same sizes as our `margin` and `padding` spacing. Change horizontal gutters with `.gx-*` classes, vertical gutters with `.gy-*`, or all gutters with `.g-\*` classes. `.g-0` is also available to remove gutters.
+- **Gutters are also responsive and customizable.** Gutter classes are available across all breakpoints, with all the same sizes as our `margin` and `padding` spacing. Change horizontal gutters with `.gx-*` classes, vertical gutters with `.gy-*`, or all gutters with `.g-*` classes. `.g-0` is also available to remove gutters.
- **Sass variables, maps, and mixins power the grid.** If you don’t want to use the predefined grid classes, you can use the grid’s source Sass to create your own with more semantic markup. We also include some CSS custom properties to consume these Sass variables for even greater flexibility for you.
## Grid options
@@ -103,10 +103,18 @@ Use these row columns classes to quickly create basic grid layouts or to control
+## Gutters
+
+To control the space between your columns, add either `.g-*` (horizontal and vertical) `.gx-*` (horizontal) or `.gy-*` (vertical) classes on the element containing the `.row` class.
+
+
+
## Nesting
To nest your content with the default grid, add a new `.row` and set of `.col-*` columns within an existing `.col-*` column. Nested rows should include a set of columns that add up to 12 or fewer.
+Note: the style in this example is applied to the column to visually better understand nesting. However, it's recommended to apply the style on a child element of the column.
+
## CSS
diff --git a/packages/documentation/src/stories/foundation/layout/grid/grid.stories.ts b/packages/documentation/src/stories/foundation/layout/grid/grid.stories.ts
index 34585ac825..c10ab175b0 100644
--- a/packages/documentation/src/stories/foundation/layout/grid/grid.stories.ts
+++ b/packages/documentation/src/stories/foundation/layout/grid/grid.stories.ts
@@ -1,4 +1,4 @@
-import { Meta, StoryFn, StoryObj, StoryContext } from '@storybook/web-components';
+import { Meta, StoryContext, StoryFn, StoryObj } from '@storybook/web-components';
import { BADGE } from '../../../../../.storybook/constants';
import { html } from 'lit';
@@ -9,7 +9,9 @@ const meta: Meta = {
},
decorators: [
(story: StoryFn, { args, context }: StoryContext) => html`
-