From 38d44c975eb14f43624ccfd9c6f714fc81b33745 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 06:28:23 +0100 Subject: [PATCH 1/6] chore(demo): Try to clarify how spinner should be used (#2594) --- .../spinner-demo-page.component.ts | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/demo/src/app/post-sample/components/spinner/spinner-demo-page/spinner-demo-page.component.ts b/packages/demo/src/app/post-sample/components/spinner/spinner-demo-page/spinner-demo-page.component.ts index d095b00980..7aaaa87aba 100644 --- a/packages/demo/src/app/post-sample/components/spinner/spinner-demo-page/spinner-demo-page.component.ts +++ b/packages/demo/src/app/post-sample/components/spinner/spinner-demo-page/spinner-demo-page.component.ts @@ -2,19 +2,17 @@ import { Component } from '@angular/core'; const codeTemplate = require('!!raw-loader!../spinner-mini-demo/spinner-mini-demo.component.html').default; -const spinner = `
-
-
-
-
+const spinner = ` +
+
+
`; -const spinnerSmall = `
-
-
-
-
-
+const spinnerSmall = ` +
+
+
+
`; @Component({ From dbc840875962a283ae63b3cd189a7f5956f3a722 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:18:42 +0100 Subject: [PATCH 2/6] fix(documentation): Context.name might be undefined (#2604) --- .../components/forms/radio/radio.stories.ts | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/packages/documentation/src/stories/components/forms/radio/radio.stories.ts b/packages/documentation/src/stories/components/forms/radio/radio.stories.ts index e947e62f6e..834d03ae4a 100644 --- a/packages/documentation/src/stories/components/forms/radio/radio.stories.ts +++ b/packages/documentation/src/stories/components/forms/radio/radio.stories.ts @@ -123,22 +123,12 @@ function render(args: Args, context: StoryContext) { const useAriaLabel = args.hiddenLabel; const label: TemplateResult | null = !useAriaLabel - ? html` - - ` + ? html` ` : null; const contextual: (TemplateResult | null)[] = [ - args.validation === 'is-valid' - ? html` -

Ggranda sukceso!

- ` - : null, - args.validation === 'is-invalid' - ? html` -

Eraro okazis!

- ` - : null, + args.validation === 'is-valid' ? html`

Ggranda sukceso!

` : null, + args.validation === 'is-invalid' ? html`

Eraro okazis!

` : 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 = () => ( Custom gutters - yes + + yes + 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` -
${story(args, context)}
+
+ ${story(args, context)} +
`, ], }; @@ -22,9 +24,15 @@ export const Basis: Story = { render: () => html`
-
Column
-
Column
-
Column
+
+
Column
+
+
+
Column
+
+
+
Column
+
`, @@ -34,11 +42,15 @@ export const SingleColumnOnly: Story = { render: () => html`
-
Don't do this!
+
+
Don't do this!
+

-
Nor this!
+
+
Nor this!
+

Instead, your content should go here!

@@ -49,14 +61,24 @@ export const SingleColumnOnly: Story = { export const EqualWidth: Story = { render: () => html`
-
-
1 of 2
-
2 of 2
+
+
+
1 of 2
+
+
+
2 of 2
+
-
-
1 of 3
-
2 of 3
-
3 of 3
+
+
+
1 of 3
+
+
+
2 of 3
+
+
+
3 of 3
+
`, @@ -65,15 +87,27 @@ export const EqualWidth: Story = { export const SettingOneColumnWidth: Story = { render: () => html`
-
-
1 of 3
-
2 of 3 (wider)
-
3 of 3
+
+
+
1 of 3
+
+
+
2 of 3 (wider)
+
+
+
3 of 3
+
-
-
1 of 3
-
2 of 3 (wider)
-
3 of 3
+
+
+
1 of 3
+
+
+
2 of 3 (wider)
+
+
+
3 of 3
+
`, @@ -82,15 +116,27 @@ export const SettingOneColumnWidth: Story = { export const VariableWidthContent: Story = { render: () => html`
-
-
1 of 3
-
Variable width content
-
3 of 3
+
+
+
1 of 3
+
+
+
Variable width content
+
+
+
3 of 3
+
-
-
1 of 3
-
Variable width content
-
3 of 3
+
+
+
1 of 3
+
+
+
Variable width content
+
+
+
3 of 3
+
`, @@ -99,15 +145,27 @@ export const VariableWidthContent: Story = { export const AllBreakpoints: Story = { render: () => html`
-
-
col
-
col
-
col
-
col
+
+
+
col
+
+
+
col
+
+
+
col
+
+
+
col
+
-
-
col-8
-
col-4
+
+
+
col-8
+
+
+
col-4
+
`, @@ -116,14 +174,24 @@ export const AllBreakpoints: Story = { export const StackedToHorizontal: Story = { render: () => html`
-
-
col-md-8
-
col-md-4
+
+
+
col-md-8
+
+
+
col-md-4
+
-
-
col-md
-
col-md
-
col-md
+
+
+
col-md
+
+
+
col-md
+
+
+
col-md
+
`, @@ -133,22 +201,36 @@ export const MixAndMatch: Story = { render: () => html`
-
-
.col-md-8
-
.col-6 .col-md-4
+
+
+
.col-md-8
+
+
+
.col-6 .col-md-4
+
-
-
.col-6 .col-md-4
-
.col-6 .col-md-4
-
.col-6 .col-md-4
+
+
+
.col-6 .col-md-4
+
+
+
.col-6 .col-md-4
+
+
+
.col-6 .col-md-4
+
-
-
.col-4
-
.col-8
+
+
+
.col-4
+
+
+
.col-8
+
`, @@ -157,51 +239,113 @@ export const MixAndMatch: Story = { export const RowColumns: Story = { render: () => html`
-
-
Column
-
Column
-
Column
-
Column
+
+
+
Column
+
+
+
Column
+
+
+
Column
+
+
+
Column
+

-
-
Column
-
Column
-
Column
-
Column
+
+
+
Column
+
+
+
Column
+
+
+
Column
+
+
+
Column
+

-
-
Column
-
Column
-
Column
-
Column
+
+
+
Column
+
+
+
Column
+
+
+
Column
+
+
+
Column
+

-
-
Column
-
Column
+
+
+
Column
+
+
+
Column
+
Column
-
Column
+
+
Column
+

-
-
Column
-
Column
-
Column
-
Column
+
+
+
Column
+
+
+
Column
+
+
+
Column
+
+
+
Column
+
+
+
+ `, +}; + +export const Gutters: Story = { + render: () => html` +
+
+
+
Column
+
+
+
Column
+
+
+
Column
+
+
+
Column
+
`, }; export const Nested: Story = { + args: { + additionalDecoratorsClasses: 'grid-nested-example', + }, render: () => html`
-
+
Level 1: .col-md-3
-
+
Level 2: .col-8 .col-md-6
Level 2: .col-4 .col-md-6
diff --git a/packages/documentation/src/stories/foundation/layout/grid/grid.styles.scss b/packages/documentation/src/stories/foundation/layout/grid/grid.styles.scss index 8d2a063355..8f1ef67556 100644 --- a/packages/documentation/src/stories/foundation/layout/grid/grid.styles.scss +++ b/packages/documentation/src/stories/foundation/layout/grid/grid.styles.scss @@ -3,8 +3,9 @@ .grid-example { font-size: post.$font-size-sm; - .row > * { - padding-block: 0.75rem; + &.grid-nested-example [class^="col"], + &:not(.grid-nested-example) .my-col-content-style { + padding: 0.75rem; background-color: lighten(post.$nightblue-bright, 60%); border: 1px solid lighten(post.$nightblue-dark, 60%); } diff --git a/packages/documentation/src/stories/foundation/layout/gutters/gutters.docs.mdx b/packages/documentation/src/stories/foundation/layout/gutters/gutters.docs.mdx deleted file mode 100644 index a442ba4410..0000000000 --- a/packages/documentation/src/stories/foundation/layout/gutters/gutters.docs.mdx +++ /dev/null @@ -1,15 +0,0 @@ -import { Meta } from '@storybook/blocks'; -import * as GuttersStories from './gutters.stories'; - - - -# Gutters - -
-

TODO

- -Document differences and link over to bootstrap for the rest - -Refer to the Figma Design as well: Figma - -
diff --git a/packages/documentation/src/stories/foundation/layout/gutters/gutters.stories.ts b/packages/documentation/src/stories/foundation/layout/gutters/gutters.stories.ts deleted file mode 100644 index c17defa932..0000000000 --- a/packages/documentation/src/stories/foundation/layout/gutters/gutters.stories.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Meta, StoryObj } from '@storybook/web-components'; -import { BADGE } from '../../../../../.storybook/constants'; - -const meta: Meta = { - title: 'Foundations/Layout/Gutters', - parameters: { - badges: [BADGE.TODO], - }, -}; - -export default meta; - -type Story = StoryObj; - -export const Default: Story = {}; From a5c990ca173310747541832837bf41355fb208ba 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 09:03:13 +0100 Subject: [PATCH 4/6] fix(documentation): Code smells nested template literals (#2605) --- .../button-group/button-group.stories.ts | 24 ++++++------- .../forms/textarea/textarea.stories.ts | 35 ++++--------------- .../background/background.stories.ts | 4 +-- 3 files changed, 18 insertions(+), 45 deletions(-) diff --git a/packages/documentation/src/stories/components/button-group/button-group.stories.ts b/packages/documentation/src/stories/components/button-group/button-group.stories.ts index 778f06bb1b..8a9c49f69f 100644 --- a/packages/documentation/src/stories/components/button-group/button-group.stories.ts +++ b/packages/documentation/src/stories/components/button-group/button-group.stories.ts @@ -23,13 +23,13 @@ const meta: Meta = { control: { type: 'select', labels: { - ' btn-sm': 'Small', - ' btn-rg': 'Regular', - ' btn-md': 'Medium', - ' btn-lg': 'Large', + 'btn-sm': 'Small', + 'btn-rg': 'Regular', + 'btn-md': 'Medium', + 'btn-lg': 'Large', }, }, - options: [' btn-sm', ' btn-rg', ' btn-md', ' btn-lg'], + options: ['btn-sm', 'btn-rg', 'btn-md', 'btn-lg'], table: { category: 'General', }, @@ -173,7 +173,7 @@ function createButtonTemplate(args: Args, context: StoryContext, index: number) updateArgs({ selected: isChecked }); }}" /> - + `; } case 'radio': { @@ -191,18 +191,14 @@ function createButtonTemplate(args: Args, context: StoryContext, index: number) updateArgs({ checked: position }); }}" /> - + `; } case 'link': - return html` - ${label} - `; + return html` ${label} `; case 'button': default: - return html` - - `; + return html` `; } } @@ -230,7 +226,7 @@ export const Sizing: Story = { }, }, args: { - size: ' btn-sm', + size: 'btn-sm', }, }; diff --git a/packages/documentation/src/stories/components/forms/textarea/textarea.stories.ts b/packages/documentation/src/stories/components/forms/textarea/textarea.stories.ts index 389f96d498..31e3423710 100644 --- a/packages/documentation/src/stories/components/forms/textarea/textarea.stories.ts +++ b/packages/documentation/src/stories/components/forms/textarea/textarea.stories.ts @@ -160,34 +160,16 @@ function renderTextarea(args: Args, context: StoryContext) { }); const useAriaLabel = !args.floatingLabel && args.hiddenLabel; const label = !useAriaLabel - ? html` - - ` + ? html` ` : null; - const contextuals = [ + const contextual = [ args.validation === 'is-valid' - ? html` -
Ggranda sukceso!
- ` + ? html`
Ggranda sukceso!
` : null, args.validation === 'is-invalid' - ? html` -
Eraro okazis!
- ` - : null, - args.hint !== '' - ? html` -
- ${html` - ${args.hint} - `} -
- ` + ? html`
Eraro okazis!
` : null, + args.hint !== '' ? html`
${args.hint}
` : null, ]; const control = html`