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

Layout::Grid - documentation (HDS-4650) #2772

Open
wants to merge 30 commits into
base: hds-4532-grid-component
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
460aa28
HDS-4650 Add first draft of documentation
KristinLBradley Mar 15, 2025
ba29d6a
HDS-4650 Add examples patterns using Grid, fix linting for spelling
KristinLBradley Mar 17, 2025
409ad2b
HDS-4650 Clean up TODOs in docs
KristinLBradley Mar 17, 2025
72ea1ac
HDS-4650 Delete TODO text
KristinLBradley Mar 18, 2025
911e5a5
HDS-4650 Update colspan & rowspan docs to match component implementation
KristinLBradley Mar 18, 2025
e4ef63a
HDS-4650 Update docs to mention stretched content issue & fix example
KristinLBradley Mar 18, 2025
c7d9f5e
HDS-4650 Clean up old comment, update row & colspan example
KristinLBradley Mar 18, 2025
822213f
HDS-4650 Update rowspan colspan example code
KristinLBradley Mar 18, 2025
9e33c8d
HDS-4650 Update example to combine rowspan and colspan on one Item
KristinLBradley Mar 18, 2025
8614a2a
Apply suggestions from code review
KristinLBradley Mar 18, 2025
b7b0107
HDS-4650 Reduce size of simulated mobile layout, update docs on gap f…
KristinLBradley Mar 18, 2025
c1be967
HDS-4650 Refactor Grid::Item section of docs to follow Flex docs more…
KristinLBradley Mar 18, 2025
2c95215
HDS-4650 Tweaks to Grid docs
KristinLBradley Mar 18, 2025
3dd96f2
Apply suggestions from code review
KristinLBradley Mar 18, 2025
845fab6
HDS-4650 Remove unneeded words from list of words for linter
KristinLBradley Mar 18, 2025
9c1877a
HDS-4650 Update wording
KristinLBradley Mar 18, 2025
89f8caf
HDS-4650 Remove isInline docs, clean up commented out section
KristinLBradley Mar 19, 2025
c6fc606
HDS-4650 Update label of Layout::Flex to remove Layout prefix in side…
KristinLBradley Mar 19, 2025
5ef2b9c
HDS-4650 Updates to docs from feedback
KristinLBradley Mar 19, 2025
07a6508
Apply suggestions from code review
KristinLBradley Mar 19, 2025
0704920
HDS-4650 Add a dash for clarity
KristinLBradley Mar 19, 2025
52ff46e
HDS-4650 Add more explanatory text and tweak colspan, rowspan example
KristinLBradley Mar 19, 2025
ed4ac33
HDS-4650 Fix label
KristinLBradley Mar 19, 2025
19bcfb9
HDS-4650 Add missing article
KristinLBradley Mar 19, 2025
2ff2cfc
HDS-4650 Add insight banner regarding HTML tag usage
KristinLBradley Mar 19, 2025
ed690fd
Apply suggestions from code review
KristinLBradley Mar 19, 2025
e40c7d3
HDS-4650 Delete unneeded version file
KristinLBradley Mar 19, 2025
e5d2032
HDS-4650 Delete stray spaces
KristinLBradley Mar 19, 2025
b4cd0fb
HDS-4650 Delete reference to deleted version file
KristinLBradley Mar 19, 2025
4ce9e81
Apply suggestions from code review
KristinLBradley Mar 19, 2025
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
4 changes: 2 additions & 2 deletions packages/components/src/styles/components/layout/grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// Note: The gap style is defined here to avoid setting it repeatedly for the gap size variants defined below.
// For the gap size variants, we override the value of the gap custom properties to set the desired sizes.
// These variables can be used by the consumers as an escape hatch if they need to set non-standard gap values (but adds a bit of friction to it)
gap:
gap:
var(--hds-layout-grid-row-gap, 0)
var(--hds-layout-grid-column-gap, 0);
}
Expand Down Expand Up @@ -64,7 +64,7 @@
.hds-layout-grid-item {
--hds-layout-grid-row-span: 1;
--hds-layout-grid-column-span: 1;

grid-row-start: span var(--hds-layout-grid-row-span);
grid-column-start: span var(--hds-layout-grid-column-span);
}
1 change: 1 addition & 0 deletions website/app/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
@use "pages/components/table" as components-table;
@use "pages/components/tabs" as components-tabs;
@use "pages/layouts/app-frame" as layouts-app-frame;
@use "pages/layouts/grid" as layouts-grid;
@use "pages/whats-new/changelog" as whats-new-changelog;
@use "pages/patterns/table-multi-select" as patterns-table-multi-select;
@use "pages/patterns/filter-patterns" as patterns-filter-patterns;
Expand Down
36 changes: 36 additions & 0 deletions website/app/styles/pages/layouts/grid.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/

// COMPONENTS > GRID

#show-content-layouts-grid {
.doc-grid-mobile-view {
position: relative;
max-width: 280px;
padding: 16px 16px 65px;
background: #fff;
border: 1px solid;
border-radius: 16px;
aspect-ratio: 9 / 16;

// home button
&::before {
position: absolute;
inset: auto 0 15px 0;
width: 40px;
height: 40px;
margin: 0 auto;
background: var(--token-color-palette-neutral-200);
border-radius: 50%;
content: "";
}
}

.doc-grid-plain-list {
margin: 0;
padding: 0;
list-style-type: none;
}
}
16 changes: 16 additions & 0 deletions website/docs/layouts/grid/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Layout::Grid
description: A component used to implement layouts based on CSS grid
caption: A layout-only component for the organization of content based on the CSS grid model
links:
github: https://github.com/hashicorp/design-system/tree/main/packages/components/src/components/hds/layout/grid
previewImage: assets/illustrations/layouts/grid.jpg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This image is currently broken

Screenshot 2025-03-18 at 11 33 50 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll ask for design help with creating one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LilithJames-HDS Has tickets to create illustrations. :)

navigation:
keywords: ['layout', 'grid', 'columns', 'rows', 'spacing']
label: "Grid"
---

<section data-tab="Code">
@include "partials/code/how-to-use.md"
@include "partials/code/component-api.md"
</section>
49 changes: 49 additions & 0 deletions website/docs/layouts/grid/partials/code/component-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## Component API

### Layout::Grid

<Doc::ComponentApi as |C|>
<C.Property @name="tag" @type="HTMLElementTagName" @default="div">
A valid HTML tag name to be used to render the grid element.
</C.Property>
<C.Property @name="columnMinWidth" @type="string" @default="0px">
Set any valid CSS dimension as a minimum width for the grid columns. If the total width of columns in a row exceeds 100% of the parent, columns will begin to wrap to the next row as necessary to fit. The column gap size is subtracted from this minimum width.
<br><br>
<em>Note: With the default min-width of 0px, the columns will never wrap.</em>
</C.Property>
<C.Property @name="align" @type="enum" @values={{array "start" "center" "end" "stretch"}}>
The value of the CSS `align-items` property, which controls the alignment of the grid items on the block axis within their grid areas (for a technical explanation: [see MDN reference](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items)).
<br/><br/>
<em>Note: we only expose a subset of the values allowed for this property, which cover the most common use cases.</em>
</C.Property>
<C.Property @name="gap" @type="enum" @values={{array "4" "8" "12" "16" "32" "48"}}>
The gap spacing between rows and columns of the grid. Specify as either a single value or array of two values for setting the row and column spacing separately.
</C.Property>
<C.Property @name="...attributes">
This component supports use of [`...attributes`](https://guides.emberjs.com/release/in-depth-topics/patterns-for-components/#toc_attribute-ordering).
</C.Property>
</Doc::ComponentApi>

### Contextual components

#### [LG].Item

The `Layout::Grid::Item` component, yielded as contextual component, to be used as child of the `grid` element to control its `colspan/rowspan` values (and other properties).

<Doc::ComponentApi as |C|>
<C.Property @name="tag" @type="string" @default="div">
HTML tag to be used to render the grid item element.
</C.Property>
<C.Property @name="colspan" @type="number">
The number of columns an item should span.
</C.Property>
<C.Property @name="rowspan" @type="number">
The number of rows an item should span.
</C.Property>
<C.Property @name="yield">
Elements passed as children are yielded as inner content of the element.
</C.Property>
<C.Property @name="...attributes">
This component supports use of [`...attributes`](https://guides.emberjs.com/release/in-depth-topics/patterns-for-components/#toc_attribute-ordering).
</C.Property>
</Doc::ComponentApi>
Loading