Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[grid] Fix QA + max-width #3042

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/scss/src/components/grid/component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

// workaround for Angular replacing CamelCase by kebab-case
// max-width: var(--grid-max-width, var(--grid-maxWidth));
width: var(--grid-max-width, var(--grid-maxWidth));
max-width: 100%;
max-width: var(--grid-max-width, var(--grid-maxWidth));

@at-root ($atRoot) {
.grid-containerWrapper {
Expand Down
131 changes: 39 additions & 92 deletions stories/qa/grid/grid.stories.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,157 +5,104 @@ <h1>Grids</h1>
<h2>Grid</h2>
<div class="grid">
<div class="grid-column" style="--grid-colspan: 6">
<div class="grid-demo">--grid-colspan: 6</div>
<div class="gridDemo">--grid-colspan: 6</div>
</div>
<div class="grid-column" style="--grid-colspan: 6">
<div class="grid-demo">--grid-colspan: 6</div>
<div class="gridDemo">--grid-colspan: 6</div>
</div>
</div>
<div class="grid">
<div class="grid-column" style="--grid-colspan: 12; --grid-colspanAtMediaMinXS: 4">
<div class="grid-demo">--grid-colspan: 12; --grid-colspanAtMediaMinXS: 4</div>
<div class="gridDemo">--grid-colspan: 12; --grid-colspanAtMediaMinXS: 4</div>
</div>
<div class="grid-column" style="--grid-colspan: 12; --grid-colspanAtMediaMinXS: 8">
<div class="grid-demo">--grid-colspan: 12; --grid-colspanAtMediaMinXS: 8</div>
<div class="gridDemo">--grid-colspan: 12; --grid-colspanAtMediaMinXS: 8</div>
</div>
</div>
<div class="grid">
<div class="grid-column" style="--grid-colspan: 12; --grid-colspanAtMediaMinS: 7"><div class="grid-demo">grid-7AtmediaMinS</div></div>
<div class="grid-column" style="--grid-colspan: 12; --grid-colspanAtMediaMinS: 5"><div class="grid-demo">grid-5AtmediaMinS</div></div>
<div class="grid-column" style="--grid-colspan: 12; --grid-colspanAtMediaMinS: 7">
<div class="gridDemo">grid-colspanAtMediaMinS: 7</div>
</div>
<div class="grid-column" style="--grid-colspan: 12; --grid-colspanAtMediaMinS: 5">
<div class="gridDemo">grid-colspanAtMediaMinS: 5</div>
</div>
</div>
<div class="grid">
<div class="grid-column" style="--grid-colspan: 12; --grid-colspanAtMediaMinS: 6; --grid-colspanAtMediaMinM: 3">
<div class="grid-demo">--grid-colspan: 12; --grid-colspanAtMediaMinS: 6; --grid-colspanAtMediaMinM: 3</div>
<div class="gridDemo">--grid-colspan: 12; --grid-colspanAtMediaMinS: 6; --grid-colspanAtMediaMinM: 3</div>
</div>
<div class="grid-column" style="--grid-colspan: 12; --grid-colspanAtMediaMinS: 6; --grid-colspanAtMediaMinM: 3">
<div class="grid-demo">--grid-colspan: 12; --grid-colspanAtMediaMinS: 6; --grid-colspanAtMediaMinM: 3</div>
<div class="gridDemo">--grid-colspan: 12; --grid-colspanAtMediaMinS: 6; --grid-colspanAtMediaMinM: 3</div>
</div>
<div class="grid-column" style="--grid-colspan: 12; --grid-colspanAtMediaMinS: 6; --grid-colspanAtMediaMinM: 3">
<div class="grid-demo">--grid-colspan: 12; --grid-colspanAtMediaMinS: 6; --grid-colspanAtMediaMinM: 3</div>
<div class="gridDemo">--grid-colspan: 12; --grid-colspanAtMediaMinS: 6; --grid-colspanAtMediaMinM: 3</div>
</div>
<div class="grid-column" style="--grid-colspan: 12; --grid-colspanAtMediaMinS: 6; --grid-colspanAtMediaMinM: 3">
<div class="grid-demo">--grid-colspan: 12; --grid-colspanAtMediaMinS: 6; --grid-colspanAtMediaMinM: 3</div>
</div>
</div>
<code class="code mod-block"
>&lt;div class="grid"&gt; &lt;div class="grid-6AtmediaMinXXXS"&gt;...&lt;/div&gt; &lt;div
class="grid-6AtmediaMinXXXS"&gt;...&lt;/div&gt; &lt;/div&gt;
</code>
</section>

<!-- Offsets -->
<section class="contentSection">
<h2>Offsets</h2>
<div class="grid">
<div class="grid-8AtmediaMinXXXS grid-offset4AtmediaMinXXXS">
<div class="demo-grid">grid-8AtmediaMinXXXS grid-offset4AtmediaMinXXXS</div>
</div>
</div>
<div class="grid">
<div class="grid-6AtmediaMinXXXS grid-offset3AtmediaMinXXXS">
<div class="demo-grid">grid-6AtmediaMinXXXS grid-offset3AtmediaMinXXXS</div>
<div class="gridDemo">--grid-colspan: 12; --grid-colspanAtMediaMinS: 6; --grid-colspanAtMediaMinM: 3</div>
</div>
<div class="grid-3AtmediaMinXXXS"><div class="demo-grid">grid-3AtmediaMinXXXS</div></div>
</div>
<code class="code mod-block"
>&lt;div class="grid"&gt; &lt;div class="grid-8AtmediaMinXXXS grid-offset4AtmediaMinXXXS"&gt;...&lt;/div&gt; &lt;/div&gt;
</code>
</section>

<!-- Auto width -->
<section class="contentSection">
<h2>Auto width</h2>
<div class="grid mod-auto">
<div class="grid-column"><div class="grid-demo">grid mod-auto</div></div>
<div class="grid-column"><div class="grid-demo">grid mod-auto</div></div>
<div class="grid-column"><div class="grid-demo">grid mod-auto</div></div>
<div class="grid-column"><div class="grid-demo">grid mod-auto</div></div>
<div class="grid-column"><div class="grid-demo">grid mod-auto</div></div>
<div class="grid-column"><div class="gridDemo">grid mod-auto</div></div>
<div class="grid-column"><div class="gridDemo">grid mod-auto</div></div>
<div class="grid-column"><div class="gridDemo">grid mod-auto</div></div>
<div class="grid-column"><div class="gridDemo">grid mod-auto</div></div>
<div class="grid-column"><div class="gridDemo">grid mod-auto</div></div>
</div>
<code class="code mod-block"
>&lt;div class="grid"&gt; &lt;div class="gridAtmediaMinS"&gt;...&lt;/div&gt; &lt;div class="gridAtmediaMinS"&gt;...&lt;/div&gt; ...
&lt;/div&gt;
</code>
<em
><b>Tip:</b> It will also work with <code class="code">XXS</code>, <code class="code">XS</code>, <code class="code">S</code>,
<code class="code">M</code>, <code class="code">L</code>, <code class="code">XL</code>, <code class="code">XXL</code> and
<code class="code">XXXL</code></em
>
</section>
<!-- Horizontal alignment -->
<section class="contentSection">
<h2>Horizontal alignment</h2>
<p>You can align the content horizontaly inside the column:</p>
<div class="grid" style="--grid-columns: 1">
<div class="grid-column" style="--grid-justify: start"><div class="grid-demo"></div></div>
<div class="grid-column" style="--grid-justify: start"><div class="gridDemo"></div></div>
</div>
<div class="grid" style="--grid-columns: 1">
<div class="grid-column" style="--grid-justify: center"><div class="grid-demo"></div></div>
<div class="grid-column" style="--grid-justify: center"><div class="gridDemo"></div></div>
</div>
<div class="grid" style="--grid-columns: 1">
<div class="grid-column" style="--grid-justify: end"><div class="grid-demo"></div></div>
<div class="grid-column" style="--grid-justify: end"><div class="gridDemo"></div></div>
</div>
<code class="code mod-block">&lt;div class="grid mod-startAtmediaMinXXXS"&gt; ... </code>
<code class="code mod-block">&lt;div class="grid mod-centerAtmediaMinXXXS"&gt; ... </code>
<code class="code mod-block">&lt;div class="grid mod-endAtmediaMinXXXS"&gt; ... </code>
<em
><b>Tip:</b> It will also work with <code class="code">XXS</code>, <code class="code">XS</code>, <code class="code">S</code>,
<code class="code">M</code>, <code class="code">L</code>, <code class="code">XL</code>, <code class="code">XXL</code> and
<code class="code">XXXL</code></em
>
</section>

<!-- Vertical alignment -->
<section class="contentSection">
<h2>Vertical alignment</h2>
<p>You can align columns verticaly inside the grid:</p>
<div class="grid mod-topAtmediaMinXXXS">
<div class="grid-6AtmediaMinXXXS"><div class="demo-grid" style="height: 100px"></div></div>
<div class="grid-6AtmediaMinXXXS"><div class="demo-grid"></div></div>
<div class="grid mod-topAtMediaMinXXXS">
<div class="grid-6atMediaMinXXXS"><div class="gridDemo" style="height: 100px"></div></div>
<div class="grid-6atMediaMinXXXS"><div class="gridDemo"></div></div>
</div>
<div class="grid mod-middleAtmediaMinXXXS">
<div class="grid-6AtmediaMinXXXS"><div class="demo-grid" style="height: 100px"></div></div>
<div class="grid-6AtmediaMinXXXS"><div class="demo-grid"></div></div>
<div class="grid mod-middleAtMediaMinXXXS">
<div class="grid-6atMediaMinXXXS"><div class="gridDemo" style="height: 100px"></div></div>
<div class="grid-6atMediaMinXXXS"><div class="gridDemo"></div></div>
</div>
<div class="grid mod-bottomAtmediaMinXXXS">
<div class="grid-6AtmediaMinXXXS"><div class="demo-grid" style="height: 100px"></div></div>
<div class="grid-6AtmediaMinXXXS"><div class="demo-grid"></div></div>
<div class="grid mod-bottomAtMediaMinXXXS">
<div class="grid-6atMediaMinXXXS"><div class="gridDemo" style="height: 100px"></div></div>
<div class="grid-6atMediaMinXXXS"><div class="gridDemo"></div></div>
</div>
<code class="code mod-block">&lt;div class="grid mod-topAtmediaMinXXXS"&gt; ... </code>
<code class="code mod-block">&lt;div class="grid mod-middleAtmediaMinXXXS"&gt; ... </code>
<code class="code mod-block">&lt;div class="grid mod-bottomAtmediaMinXXXS"&gt; ... </code>
<em
><b>Tip:</b> It will also work with <code class="code">XXS</code>, <code class="code">XS</code>, <code class="code">S</code>,
<code class="code">M</code>, <code class="code">L</code>, <code class="code">XL</code>, <code class="code">XXL</code> and
<code class="code">XXXL</code></em
>
</section>

<!-- Reorder -->
<section class="contentSection">
<h2>Reorder</h2>
<p>You can reorder columns with utilities:</p>
<div class="grid mod-dense" style="--grid-columns: 4">
<div class="grid-column" style="--grid-column: 2"><div class="grid-demo">1 --grid-column: 2</div></div>
<div class="grid-column" style="--grid-column: 3"><div class="grid-demo">2 --grid-column: 3</div></div>
<div class="grid-column" style="--grid-column: 1"><div class="grid-demo">3 --grid-column: 1</div></div>
<div class="grid-column"><div class="grid-demo">4</div></div>
<div class="grid-column" style="--grid-column: 2"><div class="gridDemo">1 --grid-column: 2</div></div>
<div class="grid-column" style="--grid-column: 3"><div class="gridDemo">2 --grid-column: 3</div></div>
<div class="grid-column" style="--grid-column: 1"><div class="gridDemo">3 --grid-column: 1</div></div>
<div class="grid-column"><div class="gridDemo">4</div></div>
</div>
<div class="grid mod-dense" style="--grid-columns: 4">
<div class="grid-column"><div class="grid-demo">1</div></div>
<div class="grid-column" style="--grid-columnAtMediaMinM: 4"><div class="grid-demo">2 --grid-columnAtMediaMinM: 4</div></div>
<div class="grid-column"><div class="grid-demo">3</div></div>
<div class="grid-column"><div class="grid-demo">4</div></div>
<div class="grid-column"><div class="gridDemo">1</div></div>
<div class="grid-column" style="--grid-columnAtMediaMinM: 4"><div class="gridDemo">2 --grid-columnAtMediaMinM: 4</div></div>
<div class="grid-column"><div class="gridDemo">3</div></div>
<div class="grid-column"><div class="gridDemo">4</div></div>
</div>
<code class="code mod-block"
>&lt;div class="grid"&gt; &lt;div class="grid-6AtmediaMinXXXS u-lastAtmediaMinXS"&gt;...&lt;/div&gt; &lt;div class="grid-6AtmediaMinXXXS
u-firstAtmediaMinXS"&gt;...&lt;/div&gt; &lt;/div&gt;
</code>
<em
><b>Tip:</b> It will also work with <code class="code">XXS</code>, <code class="code">XS</code>, <code class="code">S</code>,
<code class="code">M</code>, <code class="code">L</code>, <code class="code">XL</code>, <code class="code">XXL</code> and
<code class="code">XXXL</code></em
>
</section>

<!-- To tell the ui-diff tool that the page has finished rendering -->
Expand Down
14 changes: 13 additions & 1 deletion stories/qa/grid/grid.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@ import { Meta, StoryFn } from '@storybook/angular';
standalone: true,
selector: 'grid-stories',
templateUrl: './grid.stories.html',
styles: ['.grid-demo { background: #eee; border-radius: 3px; min-height: 2.7rem; padding: .6rem var(--pr-t-spacings-200);} .grid + .grid { margin-top: var(--pr-t-spacings-200) }'],
styles: [
`
.gridDemo {
background-color: #eee;
border-radius: 3px;
min-height: 2.7rem;
padding: 0.6rem var(--pr-t-spacings-200);
}
.grid + .grid {
margin-top: var(--pr-t-spacings-200);
}
`,
],
})
class GridStory {}

Expand Down