Skip to content

Commit d02754e

Browse files
Apply suggestions from code review
Co-authored-by: Kristin Bradley <kristin.bradley@hashicorp.com>
1 parent 164795c commit d02754e

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

website/docs/layouts/flex/partials/code/how-to-use.md

+24-24
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ To specify which HTML tag to use to render the flex container and/or item(s), us
5858

5959
!!! Insight
6060

61-
While by default the component renders a `<div>`, we invite consumers to consider which semantic HTML tag is the correct one for the context in which the text is used to meet WCAG Success Criterion [1.3.1 Info and Relationships](https://www.w3.org/WAI/WCAG22/Understanding/info-and-relationships.html) as the visual experience should match what is presented to the user with assistive technology.
61+
While, by default, the component renders a `<div>`, we invite consumers to consider which semantic HTML tag is the correct one for the context in which the text is used to meet WCAG Success Criterion [1.3.1 Info and Relationships](https://www.w3.org/WAI/WCAG22/Understanding/info-and-relationships.html) as the visual experience should match what is presented to the user with assistive technology.
6262

6363
!!!
6464

6565
### Direction
6666

67-
To specify which in which [direction](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction) the flex items are laid out, use the `@direction` argument:
67+
To specify in which [direction](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction) the flex items are laid out, use the `@direction` argument:
6868

6969
```handlebars{data-execute=false}
7070
<Hds::Layout::Flex @direction="column" as |LF|>
@@ -88,7 +88,7 @@ To specify how the flex items are spaced and aligned, use the `@justify` and `al
8888

8989
These arguments correspond to the [`justify-content`](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) and [`align-items`](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) flexbox properties in CSS.
9090

91-
_Note: we don't expose all the possible values for `justify-content`/`align-items`, only to the most commonly used ones. Refer to the [Component API](#component-api) section for details on which values are accepted._
91+
_Note: we don't expose all the possible values for `justify-content`/`align-items`, only the most commonly used ones. Refer to the [Component API](#component-api) section for details on which values are accepted._
9292

9393
📚 Refer to the ["Recipes"](#flexbox-layout-recipes) and [Patterns](#common-layout-patterns) sections below for practical examples of how the Flexbox `justify-content`/`align-items` properties can be used to implement specific layouts.
9494

@@ -122,7 +122,7 @@ To differentiate the vertical and horizontal spacing between items when they wra
122122
<Hds::Layout::Flex @wrap={{true}} @gap={{array "16" "48"}}>
123123
{{!
124124
multiple flex items appearing on multiple rows
125-
with a vertical gap of 16px and an horizontal one of 48px
125+
with a vertical gap of 16px and a horizontal one of 48px
126126
}}
127127
</Hds::Layout::Flex>
128128
```
@@ -159,7 +159,7 @@ If you absolutely have to use non-standard spacing value(s) for the flex `gap`,
159159

160160
In this case we're overwriting only the "column" gap value via the custom CSS class.
161161

162-
If the flex items are wrapping on multiple lines, you have to overwrite both the "row" and "column" gap values:
162+
If the flex items are wrapping to multiple lines, you have to overwrite both the "row" and "column" gap values:
163163

164164
```handlebars{data-execute=false}
165165
<Hds::Layout::Flex
@@ -197,19 +197,19 @@ To control the relative sizing of the flex items, use the `@basis`, `@grow`, and
197197
</Hds::Layout::Flex>
198198
```
199199

200-
How these three properties impact on the (relative) size of a flex item is not trivial, we suggest to look at the introduction to flexbox guide linked at the top of this page.
200+
How these three properties impact the (relative) size of a flex item is not trivial, we suggest consulting the MDN flexbox guide linked at the top of this page.
201201

202202
📚 Refer to the ["Recipes"](#flexbox-layout-recipes) and [Patterns](#common-layout-patterns) sections below for practical examples of how the Flexbox `flex-basis`/`flex-grow`/`flex-shrink` properties can be used to implement specific layouts.
203203

204204
---
205205

206206
## Flexbox layout "recipes"
207207

208-
Below some examples of common generic layouts that can be achieved using CSS `flexbox`, and therefore the `Layout::Flex` component.
208+
Below are some examples of common generic layouts that can be achieved using CSS `flexbox`, and therefore the `Layout::Flex` component.
209209

210210
### Alignment
211211

212-
Using `flexbox`/`Layout::Flex` is one of the simplest way to control the alignment of lists of items.
212+
Using `flexbox`/`Layout::Flex` is one of the simplest ways to control the alignment of lists of items.
213213

214214
#### Evenly spaced items
215215

@@ -244,7 +244,7 @@ In this case:
244244

245245
- by applying a `margin-left: auto` to the last flex item, the flexbox layout engine pushes it completely to the right (because implicitly it has `margin-right: 0`)
246246

247-
The same technique can also be applied when there are multiple elements that need to be aligned on the right:
247+
The same technique can also be applied when there are multiple elements that need to be aligned to the right:
248248

249249
```handlebars
250250
<Hds::Layout::Flex @gap="16" class="doc-flex-outlined-container">
@@ -257,11 +257,11 @@ The same technique can also be applied when there are multiple elements that nee
257257

258258
In this case:
259259

260-
- the `margin-left: auto` is applied only to the first item that is flushed to the right; all the other items are automatically pushed to the right by the first flushed item
260+
- the `margin-left: auto` is applied only to the first item that is flushed to the right; all the other items are automatically pushed to the right by the first flushed right item
261261

262262
#### Vertical centering
263263

264-
For a long time, this has been one classic problem in CSS: how to vertically center two or more items? The more reliable solution is to use flexbox's alignment:
264+
A classic CSS problem: how to vertically center two or more items? A reliable solution is to use flexbox alignment:
265265

266266
```handlebars
267267
<Hds::Layout::Flex @align="center" @gap="8">
@@ -273,11 +273,11 @@ For a long time, this has been one classic problem in CSS: how to vertically cen
273273

274274
In this case:
275275

276-
- the `@align="center"` applied to the flex container forces the flex items to vertically align their centers along what is called the "cross axis"
276+
- the `@align="center"` applied to the flex container forces the flex items to vertically align their centers along the "cross axis"
277277

278278
#### Both horizontal and vertical centering
279279

280-
This has also been another classic CSS problem: how to center _both_ horizontally and vertically some content, inside a larger container? Again, the solution relies in using flexbox's alignment:
280+
Another classic CSS problem: how to center content _both_ horizontally and vertically inside a larger container? Again, the solution is to use flexbox alignment:
281281

282282
```handlebars
283283
<Hds::Layout::Flex @justify="center" @align="center" class="doc-flex-fixed-height-container doc-flex-outlined-container">
@@ -287,7 +287,7 @@ This has also been another classic CSS problem: how to center _both_ horizontall
287287

288288
In this case:
289289

290-
- the `@justify="center"` and `@align="stretch"` applied to the flex container force the flex item to be centered both horizontally and vertically (_note: we have applied an outline and a fixed height to the flex container to demonstrate the behavior_)
290+
- the `@justify="center"` and `@align="stretch"` arguments applied to the flex container force the flex item to be centered both horizontally and vertically (_note: we have applied an outline and a fixed height to the flex container to demonstrate the behavior_)
291291

292292
### Sizing
293293

@@ -321,7 +321,7 @@ If we want an item to to grow and occupy the available space, we have to use its
321321

322322
In this case:
323323

324-
- we have applied `@grow=\{{true}}` to the wrapping `Flex::Item`, forcing it to use all the available extra space inside the flexbox container
324+
- we have applied `@grow=\{{true}}` to the wrapping `Flex::Item`, forcing it to use all the available space inside the flexbox container
325325

326326
#### Prevent collapsing of content
327327

@@ -388,7 +388,7 @@ An alternative solution is to wrap the element that shouldn't stretch with a fle
388388

389389
### Wrapping
390390

391-
One of the useful functionalities of the flexbox layout model is that it allows the items to wrap along multiple rows when there is not enough space in the container to fit them all in a single line:
391+
One useful function of the flexbox layout model is that it allows items to wrap along multiple rows when there is not enough space in the container to fit them all in a single line:
392392

393393
```handlebars
394394
<Hds::Layout::Flex @gap={{array "8" "24"}} @wrap={{true}} class="doc-flex-outlined-container">
@@ -424,31 +424,31 @@ It's possible to nest flexbox containers to achieve more complex layouts:
424424
In this case:
425425

426426
- the outer container is a column-based flexbox layout, with three child items
427-
- the second item is a row-based flexbox layout, used to create two side-by side content blocks; of these two the first has a fixed width, while the second fills the remaining area thanks to the `@grow=\{{true}}` attribute
427+
- the second item is a row-based flexbox layout, used to create two side-by-side content blocks; of these two the first has a fixed width, while the second fills the remaining area thanks to the `@grow=\{{true}}` attribute
428428

429429
!!! Insight
430430

431-
Depending on the complexity of the design you need to implement, you may want to consider using a CSS `grid` layout, instead of a `flex` layout.
431+
Depending on the complexity and type of design you need to implement, you may want to consider using a CSS `grid` layout, instead of a `flex` layout.
432432

433433
!!!
434434

435435
---
436436

437437
## Common layout patterns
438438

439-
Below some more realistic examples of common layouts that can be achieved using the `Layout::Flex` component, in composition with other HDS components.
439+
Below are some more realistic examples of common layouts that can be achieved using the `Layout::Flex` component, in composition with other HDS components.
440440

441441
!!! Warning
442442

443443
**Important**
444444

445-
The examples below are meant to show how one _could_ use the `Layout::Flex` component to implement certain common/standard UI patterns. They're **not** meant to be taken literally as they are and be used in production code. Also, some of these patterns are already implemented directly in HDS components that are ready to use.
445+
The examples below are meant to show how one _could_ use the `Layout::Flex` component to implement certain common/standard UI patterns. They're **not** meant to be taken literally as they are and be used in production code. Also, some of these patterns may already implemented directly in HDS components that are ready to use.
446446

447447
!!!
448448

449449
### Media + Text/Content
450450

451-
This is a classic layout, where a "media" element (it could be an image, an icon, an avatar, etc) is laid out next to a block of text (but could be more complex content). The two elements are visually centered along their horizontal axis.
451+
This is a classic layout, where a "media" element (it could be an image, an icon, an avatar, etc) is laid out next to a block of text (but could be more complex content). The two elements are either visually centered along their horizontal axis, or aligned to their top.
452452

453453

454454
```handlebars
@@ -502,7 +502,7 @@ Using the automatic layout offered by flexbox, it's extremely easy to create a g
502502

503503
!!! Warning
504504

505-
A responsive implementation of this UI pattern is a bit more complex, and requires to use `min-max/max-width` values for the cards, and allow wrapping of the flex item elements. It may also require changing direction of the flex container at a certain breakpoint.
505+
A responsive implementation of this UI pattern is a bit more complex and requires usage of `min-max/max-width` values for the cards and allowing wrapping of the flex item elements. It may also require changing the direction of the flex container at a certain breakpoint.
506506

507507
!!!
508508

@@ -541,7 +541,7 @@ as |LF|>
541541

542542
### Right aligned actions
543543

544-
Using the `margin-left: auto` trick described above, one can achieve the following layout, where one of the flex items is flushed on the right:
544+
Using the `margin-left: auto` trick described above, one can achieve the following layout, where one of the flex items is flushed to the right:
545545

546546
```handlebars
547547
<Hds::Layout::Flex @align="start" @gap="16" class="doc-flex-outlined-container">
@@ -556,7 +556,7 @@ Using the `margin-left: auto` trick described above, one can achieve the followi
556556
</Hds::Layout::Flex>
557557
```
558558

559-
If needed, multiple items can be flushed on the right:
559+
If needed, multiple items can be flushed to the right:
560560

561561
```handlebars
562562
<Hds::Layout::Flex @align="start" @gap="16" class="doc-flex-outlined-container">

0 commit comments

Comments
 (0)