Skip to content

Commit e748eea

Browse files
committed
Drop List layout in favour of default Grid layout (#382)
1 parent 2b1996a commit e748eea

File tree

19 files changed

+63
-406
lines changed

19 files changed

+63
-406
lines changed

src/docs/contribute/composition.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ There are several types of composition approaches.
1515
outside their parent components.
1616

1717
- **Mandatory subcomponents:** subcomponent must be used at least once in
18-
order for the composition to work. E.g. `List` + `ListItem`, `Media` +
19-
`MediaObject` + `MediaBody`, `Tabs` + `TabsItem`, etc.
18+
order for the composition to work. E.g. `Media` + `MediaObject` +
19+
`MediaBody`, `Tabs` + `TabsItem`, etc.
2020

2121
- **Optional subcomponents:** optional subcomponents may be used to achieve
2222
special results. E.g. `FormLayout` + `FormLayoutCustomField` or `Grid` +

src/docs/customize/theming/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ for two main reasons:
1515
a thing, but it's not necessary to go as far as for CSS-in-JS to make a UI
1616
customizable.
1717

18-
2. Thanks to its JavaScript API, CSS custom properties are both **readable and
18+
2. Thanks to JavaScript API, CSS custom properties are both **readable and
1919
writable by JS**.
2020

2121
## Theming Options

src/docs/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ React UI consists of four building blocks:
4343
[Learn how to get started quickly.](/getting-started/installation)
4444

4545
2. **Components:** reusable and themeable React components and layouts:
46-
[buttons](/components/button), [cards](/components/card),
47-
[lists](/components/list), and more.
46+
[alerts](/components/alert), [buttons](/components/button),
47+
[cards](/components/card), and more.
4848

4949
3. **Theme:** a collection of CSS custom properties that define the visual
5050
appearance of the UI.

src/lib/components/FormLayout/README.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,9 @@ there are longer validation messages or help texts.
7575

7676
## Vertical Layout
7777

78-
Vertical FormLayout works similar to the [List](/components/list) layout
79-
except that no equivalent of ListItems is needed. It stacks the form fields
80-
vertically while it forces the vertical layout mode on them. To use this layout,
81-
simply wrap your form fields with the FormLayout component:
78+
Vertical FormLayout works similar to single-column [Grid](/components/grid)
79+
layout while it also forces vertical layout mode on form fields. To use this
80+
layout, simply wrap your form fields with the FormLayout component:
8281

8382
<Playground>
8483
<FormLayout>

src/lib/components/Grid/Grid.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
justify-items: var(--rui-local-justify-items, #{map.get(theme.$responsive-properties, justify-items)}); // 2.
4141
}
4242

43+
// stylelint-disable-next-line selector-max-universal -- Reset any previously added margins.
44+
.root > * {
45+
margin-block: 0;
46+
}
47+
4348
.span {
4449
$responsive-properties: (
4550
column-span: 1,
@@ -58,5 +63,6 @@ ol.root,
5863
ul.root {
5964
padding-left: 0;
6065
margin-left: 0;
66+
list-style: none;
6167
}
6268
// stylelint-enable selector-no-qualifying-type

src/lib/components/Grid/README.mdx

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ import { Grid } from '@react-ui-org/react-ui';
2727
And use it:
2828

2929
<Playground>
30-
<Grid columns="1fr 1fr 1fr">
31-
<Placeholder bordered>Grid item</Placeholder>
32-
<Placeholder bordered>Grid item</Placeholder>
33-
<Placeholder bordered>Grid item</Placeholder>
30+
<Grid>
3431
<Placeholder bordered>Grid item</Placeholder>
3532
<Placeholder bordered>Grid item</Placeholder>
3633
<Placeholder bordered>Grid item</Placeholder>
@@ -41,7 +38,7 @@ See [API](#api) for all available options.
4138

4239
## General Guidelines
4340

44-
- This component implements native [CSS grid layout][grid-layout], the right CSS
41+
- This component implements native [CSS grid layout][grid-layout], a powerful
4542
tool for two-dimensional layouts. You may use any value accepted by
4643
[grid-template-columns], [grid-template-rows], [grid-column-gap],
4744
[grid-row-gap], [grid-auto-flow], [align-content], [align-items],
@@ -53,20 +50,22 @@ See [API](#api) for all available options.
5350
markup** like GridItem or Cell is necessary for your items. But it's there
5451
when you really need it—see [Advanced Layouts](#advanced-layouts).
5552

53+
- For forms, use rather the [FormLayout](/components/form-layout) component
54+
which is designed specifically for that purpose.
55+
5656
- The Grid component is so powerful that it enables you to build even very
5757
advanced layouts **without** having to write **a single line of custom CSS.**
5858
See [Advanced Layouts](#advanced-layouts) for more.
5959

60-
👉 The default layout has one column, auto-sized rows and gaps of
61-
[size 4](/foundation/spacing). Defaults for all Grid API options can be
62-
[customized](/customize/theming/overview) with CSS custom properties.
60+
👉 Vertical margin of items inside Grid is reset to zero.
6361

64-
## Columns and Rows
62+
## Columns
6563

66-
Use `columns` and `rows` to specify your grid layout.
64+
Unless the defaults are modified, stack is the default outcome of Grid. Use the
65+
`columns` option to organize your items into grid.
6766

6867
<Playground>
69-
<Grid columns="1fr 2fr" rows="auto 200px auto">
68+
<Grid columns="1fr 1fr 1fr">
7069
<Placeholder bordered>Grid item</Placeholder>
7170
<Placeholder bordered>Grid item</Placeholder>
7271
<Placeholder bordered>Grid item</Placeholder>
@@ -106,6 +105,21 @@ responsive layouts. Resize the playground to see it in action.
106105
👉 If you need your items to have **equal height** even with content of varying
107106
length, it may be necessary to set `height: 100%` on them.
108107

108+
## Rows
109+
110+
Use `columns` and `rows` to specify a more complicated grid layout.
111+
112+
<Playground>
113+
<Grid columns="1fr 2fr" rows="auto 200px auto">
114+
<Placeholder bordered>Grid item</Placeholder>
115+
<Placeholder bordered>Grid item</Placeholder>
116+
<Placeholder bordered>Grid item</Placeholder>
117+
<Placeholder bordered>Grid item</Placeholder>
118+
<Placeholder bordered>Grid item</Placeholder>
119+
<Placeholder bordered>Grid item</Placeholder>
120+
</Grid>
121+
</Playground>
122+
109123
## Gaps
110124

111125
Both column and row gaps can be customized.
@@ -141,6 +155,25 @@ Individual items and the entire grid content can be aligned and along both axes.
141155
</Grid>
142156
</Playground>
143157

158+
## Custom HTML Tag
159+
160+
To render as list for example, just change the output `tag` to `ul` or `ol` and
161+
wrap your items with `<li>`.
162+
163+
<Playground>
164+
<Grid tag="ul">
165+
<li>
166+
<Placeholder bordered>List item</Placeholder>
167+
</li>
168+
<li>
169+
<Placeholder bordered>List item</Placeholder>
170+
</li>
171+
<li>
172+
<Placeholder bordered>List item</Placeholder>
173+
</li>
174+
</Grid>
175+
</Playground>
176+
144177
## Media Queries
145178

146179
If you need to build more complicated layouts, you have full control over the
@@ -253,7 +286,7 @@ Wrapper for content that should span multiple rows or columns.
253286
[grid-column-gap]: https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap
254287
[grid-row-gap]: https://developer.mozilla.org/en-US/docs/Web/CSS/row-gap
255288
[grid-auto-flow]: https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow
256-
[aling-content]: https://developer.mozilla.org/en-US/docs/Web/CSS/align-content
289+
[align-content]: https://developer.mozilla.org/en-US/docs/Web/CSS/align-content
257290
[align-items]: https://developer.mozilla.org/en-US/docs/Web/CSS/align-items
258291
[justify-content]: https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content
259292
[justify-items]: https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items

src/lib/components/List/List.jsx

Lines changed: 0 additions & 80 deletions
This file was deleted.

src/lib/components/List/List.scss

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/lib/components/List/ListItem.jsx

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)