Skip to content

Commit 78594d0

Browse files
feat(component): add Divider component (#2932)
* feat: first divider components implementation * fix: following LMP review * docs: update hr usage in docs * fix: final review --------- Co-authored-by: Louis-Maxime Piton <[email protected]>
1 parent 36af341 commit 78594d0

File tree

14 files changed

+134
-40
lines changed

14 files changed

+134
-40
lines changed

Diff for: scss/_variables.scss

+4-4
Original file line numberDiff line numberDiff line change
@@ -787,20 +787,20 @@ $blockquote-margin-y: $ouds-space-fixed-medium !default; // OUDS mod: in
787787
$blockquote-footer-color: var(--#{$prefix}color-content-muted) !default; // OUDS mod: instead of `$gray-600`
788788
// OUDS mod: no `$blockquote-footer-font-size`
789789

790-
$hr-margin-y: $ouds-space-fixed-medium !default;
791-
$hr-color: inherit !default;
790+
$hr-margin-y: $ouds-space-fixed-medium !default; // OUDS mod: instead of `$spacer !default;`
791+
$hr-color: $ouds-color-border-default !default; // OUDS mod: instead of `inherit !default;`
792792

793793
// fusv-disable
794794
$hr-bg-color: null !default; // Deprecated in Bootstrap v5.2.0
795795
$hr-height: null !default; // Deprecated in Bootstrap v5.2.0
796796
// fusv-enable
797797

798798
$hr-border-color: null !default; // Allows for inherited colors
799-
$hr-border-width: var(--#{$prefix}border-width) !default;
799+
$hr-border-width: $ouds-divider-border-width !default; // OUDS mod: instead of `var(--#{$prefix}border-width) !default;`
800800
$hr-opacity: null !default;
801801

802802
// scss-docs-start vr-variables
803-
$vr-border-width: 2px !default; // OUDS mod: instead of `var(--#{$prefix}border-width)`
803+
$vr-border-width: $ouds-divider-border-width !default; // OUDS mod: instead of `var(--#{$prefix}border-width)`
804804
// scss-docs-end vr-variables
805805

806806
$legend-margin-bottom: $spacer * .25 !default;

Diff for: scss/helpers/_vr.scss

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
.vr {
22
display: inline-block;
33
align-self: stretch;
4-
width: $vr-border-width;
4+
// OUDS mod: no width
55
min-height: 1em;
6-
background-color: currentcolor;
7-
opacity: $hr-opacity;
6+
margin: 0 $ouds-space-fixed-medium; // OUDS mod
7+
color: $hr-color; // OUDS mod
8+
// OUDS mod: no background color
9+
border: 0; // OUDS mod
10+
border-left: $vr-border-width solid currentcolor; // OUDS mod
11+
// OUDS mod: no opacity
812
}

Diff for: site/content/docs/0.3/content/reboot.md

+3-10
Original file line numberDiff line numberDiff line change
@@ -174,21 +174,14 @@ On colored backgrounds, links should have a different style. Visited links don't
174174

175175
## Horizontal rules
176176

177-
The `<hr>` element has been simplified. Similar to browser defaults, `<hr>`s are styled via `border-top`, have a default `opacity: .25`, and automatically inherit their `border-color` via `color`, including when `color` is set via the parent. They can be modified with text, border, and opacity utilities.
178-
179-
<!-- TODO: Check once the dividers have been designed -->
177+
The `<hr>` element has been simplified. Similar to browser defaults, `<hr>`s are styled via `border-top` and automatically inherit their `border-color` via `color`.
180178

181179
{{< example >}}
182180
<hr>
183-
184-
<div class="text-status-positive">
185-
<hr>
186-
</div>
187-
188-
<hr class="border border-emphasized border-medium opacity-medium">
189-
<hr class="border border-brand-primary border-thick opacity-strong">
190181
{{< /example >}}
191182

183+
The `<hr>` style can be modified with border utilities. See some customization examples in the [dividers helpers]({{< docsref "/helpers/dividers" >}}) documentation.
184+
192185
<!-- ## Lists
193186
194187
All lists—`<ul>`, `<ol>`, and `<dl>`—have their `margin-top` removed and a `margin-bottom: 16px`. Nested lists have no `margin-bottom`. We've also reset the `padding-left` on `<ul>` and `<ol>` elements.

Diff for: site/content/docs/0.3/customize/color-palette.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This section exposes all the existing colors inside the OUDS Web palette. These
4040
</button>
4141
<figcaption class="py-shortest">
4242
<code class="user-select-all">{{ $color.hex }}</code>
43-
<hr class="my-shortest border-top" style="border-color:{{ $color.hex }} !important">
43+
<hr class="my-shortest" style="border-color:{{ $color.hex }} !important">
4444
<var class="user-select-all">{{- $color.variable -}}</var>
4545
</figcaption>
4646
</figure>

Diff for: site/content/docs/0.3/helpers/dividers.md

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
layout: docs
3+
title: Dividers
4+
description: Use the horizontal or vertical rule helpers to create dividers. A divider can be used to visually structure an interface by clearly separating content sections.
5+
group: helpers
6+
aliases:
7+
- "/docs/helpers/dividers/"
8+
- "/docs/helpers/vertical-rule/"
9+
toc: true
10+
---
11+
12+
## Horizontal rules
13+
14+
Horizontal rules should use the `<hr>` tag, when the separator has semantic meaning (i.e., when it represents a topic change or a significant transition in the content). If the divider is purely decorative, prefer using a border CSS property on a `<div>` or our [border utilities]({{< docsref "/utilities/borders" >}}), or even ensure to hide it from assistive technologies (e.g., `aria-hidden="true"`).
15+
16+
{{< example >}}
17+
<hr>
18+
<hr class="border-brand-primary">
19+
<div class="border-top border-default my-medium"></div>
20+
<div class="border-top border-emphasized border-thick my-medium"></div>
21+
{{< /example >}}
22+
23+
The `<hr>` color is automatically adjusted according to the color modes or on colored backgrounds.
24+
25+
{{< example class="p-none">}}
26+
<div class="bg-brand-primary p-tall">
27+
<div data-bs-theme="light">
28+
<hr class="border-thick">
29+
</div>
30+
</div>
31+
<div class="bg-status-negative-emphasized p-tall">
32+
<div data-bs-theme="root-inverted">
33+
<hr class="border-thicker">
34+
</div>
35+
</div>
36+
{{< /example >}}
37+
38+
39+
{{< bootstrap-compatibility >}}
40+
The `<hr>` color can be set using [colors utilities]({{< docsref "/utilities/colors" >}})
41+
{{< example >}}
42+
<hr class="text-brand-primary">
43+
{{< /example >}}
44+
{{< /bootstrap-compatibility >}}
45+
46+
## Vertical rules
47+
48+
Vertical rules are inspired by the `<hr>` element, allowing you to create vertical dividers in common layouts. They're styled just like `<hr>` elements. They have `min-height` of `1em`.
49+
50+
{{< example >}}
51+
<div class="vr"></div>
52+
53+
{{< /example >}}
54+
55+
Vertical rules scale their height in flex layouts:
56+
57+
{{< example >}}
58+
<div class="d-flex" style="height: 200px;">
59+
<div class="vr"></div>
60+
<div class="vr border-brand-primary"></div>
61+
<div class="vr border-thicker"></div>
62+
</div>
63+
{{< /example >}}
64+
65+
The `.vr` color is automatically adjusted according to the color modes or on colored backgrounds.
66+
67+
{{< example class="p-none">}}
68+
<div class="bg-brand-primary p-tall">
69+
<div data-bs-theme="light">
70+
<div class="vr border-thick"></div>
71+
</div>
72+
</div>
73+
<div class="bg-status-negative-emphasized p-tall">
74+
<div data-bs-theme="root-inverted">
75+
<div class="vr border-thicker"></div>
76+
</div>
77+
</div>
78+
{{< /example >}}
79+
80+
{{< bootstrap-compatibility >}}
81+
The `.vr` color can be set using [colors utilities]({{< docsref "/utilities/colors" >}})
82+
{{< example >}}
83+
<div class="vr text-brand-primary"></div>
84+
{{< /example >}}
85+
{{< /bootstrap-compatibility >}}
86+

Diff for: site/content/docs/0.3/helpers/stacks.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Using horizontal margin utilities like `.ms-auto` as spacers:
4848
</div>
4949
{{< /example >}}
5050

51-
<!--And with [vertical rules]({{< docsref "/helpers/vertical-rule" >}}):
51+
And with [vertical rules]({{< docsref "/helpers/dividers" >}}):
5252

5353
{{< example class="bd-example-flex" >}}
5454
<div class="hstack gap-tall">
@@ -57,7 +57,7 @@ Using horizontal margin utilities like `.ms-auto` as spacers:
5757
<div class="vr"></div>
5858
<div class="p-short">Third item</div>
5959
</div>
60-
{{< /example >}}-->
60+
{{< /example >}}
6161

6262
## Examples
6363

Diff for: site/content/docs/0.3/helpers/vertical-rule.md

-11
This file was deleted.

Diff for: site/content/docs/0.3/migration-from-boosted.md

+8
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ See [our new Switch page]({{< docsref "/forms/switch" >}}) for more information.
274274

275275
- <span class="badge text-bg-status-negative-emphasized">Breaking</span> All colored links helpers are unstyled in OUDS Web. Classes still exist for Bootstrap compatibility.
276276

277+
### Dividers
278+
279+
- <span class="badge text-bg-status-positive-emphasized">New</span> Horizontal or vertical rule helpers to create dividers.
280+
277281
### Icon link
278282

279283
- <span class="badge text-bg-status-info-emphasized">Info</span> `.icon-link` and `.link-chevron` are now documented in link component. See [icon link]({{< docsref "/components/links/#icon-link" >}}) and [link chevron]({{< docsref "/components/links/#link-chevron" >}}).
@@ -293,6 +297,10 @@ See [our new Switch page]({{< docsref "/forms/switch" >}}) for more information.
293297

294298
- <span class="badge text-bg-status-positive-emphasized">New</span> Responsive sticky helpers: `.sticky-xs-{top|bottom}`, `.sticky-2xl-{top|bottom}` and `.sticky-3xl-{top|bottom}`.
295299

300+
### Vertical rule
301+
302+
- <span class="badge text-bg-status-warning-emphasized">Warning</span> The vertical rule documentation has been merged into the new [Dividers helper]({{< docsref "/helpers/dividers" >}}) documentation.
303+
296304
## Utilities
297305

298306
### Background

Diff for: site/content/docs/0.3/migration.md

+17-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ toc: true
1212

1313
## v0.4.0
1414

15+
<hr>
16+
1517
### Forms
1618

1719
#### Checkboxes
@@ -26,6 +28,11 @@ toc: true
2628

2729
- <span class="badge text-bg-status-positive-emphasized">New</span> Switch component has been implemented.
2830

31+
### Helpers
32+
33+
#### Dividers
34+
- <span class="badge text-bg-status-positive-emphasized">New</span> Horizontal and vertical rule helpers to create dividers.
35+
2936
### CSS and Sass variables
3037

3138
- <span class="badge text-bg-status-positive-emphasized">New</span> A new file containing composite tokens has been added. If you were using the Sass compilation, you must import the new Sass file between the semantic and component files.
@@ -66,6 +73,8 @@ toc: true
6673

6774
## v0.3.0
6875

76+
<hr>
77+
6978
### Content styles
7079

7180
#### Reboot
@@ -147,6 +156,8 @@ toc: true
147156

148157
## v0.2.0
149158

159+
<hr>
160+
150161
### Components
151162

152163
#### Buttons
@@ -303,6 +314,8 @@ toc: true
303314

304315
## v0.1.0
305316

317+
<hr>
318+
306319
### Foundations
307320

308321
- <span class="badge text-bg-status-warning-emphasized">Warning</span> The root selector have been tweaked for more flexibility on JS frameworks. Please don't hesitate to contact us if you find any issue with it.
@@ -1922,6 +1935,8 @@ toc: true
19221935

19231936
## v0.0.3
19241937

1938+
<hr>
1939+
19251940
### Pre-compiled versions
19261941

19271942
From now on, by default, OUDS Web won't embed Bootstrap elements (like helpers, utilities, variables, components variants, etc.) that do not comply with Orange Unified Design System. However, you can still use our Bootstrap compatibility mode by using `ouds-web-bootstrap.css` and `ouds-web-bootstrap.min.css`. [Learn more about Bootstrap compatibility]({{< docsref "/extend/approach/#bootstrap-compatibility" >}}).
@@ -1988,14 +2003,14 @@ From now on, by default, OUDS Web won't embed Bootstrap elements (like helpers,
19882003

19892004
## v0.0.1
19902005

1991-
<hr class="mb-tall">
2006+
<hr>
19922007

19932008
OUDS Web v0.0.1 has landed, and is based and compatible with Bootstrap v5.3.3.
19942009

19952010
If you need more details about the changes, please refer to the [v0.0.1 release](https://github.com/Orange-OpenSource/Orange-Boosted-Bootstrap/releases/tag/v0.0.1-ouds-web).
19962011

19972012
## v0.0.0
19982013

1999-
<hr class="mb-tall">
2014+
<hr>
20002015

20012016
OUDS Web v0.0.0 has landed, and is based and compatible with Bootstrap v5.3.3.

Diff for: site/data/sidebar.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,14 @@
171171
- title: Clearfix
172172
- title: Color & background
173173
- title: Colored links
174+
- title: Dividers
174175
- title: Focus ring
175176
draft: true
176177
- title: Position
177178
- title: Ratio
178179
- title: Stacks
179180
- title: Stretched link
180181
- title: Text truncation
181-
- title: Vertical rule
182-
draft: true
183182
- title: Visually hidden
184183

185184
- title: Utilities

Diff for: site/layouts/partials/home/css-variables.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<hr class="border-medium border-default m-none">
44
</div>
55
<div class="col-xl-4 pe-xl-jumbo">
6-
<hr class="d-xl-none border-medium border-default m-none pb-scaled-short">
6+
<hr class="d-xl-none border-medium m-none pb-scaled-short">
77
<h2 class="text-brand-primary mb-scaled-shorter">Build and extend in real-time with CSS&nbsp;variables</h2>
88
<p class="lead fw-bold bd-text-wrap-balance mb-scaled-shorter">
99
OUDS Web is evolving with each release to better utilize CSS variables for global theme styles, individual components, and even utilities. We provide dozens of variables for colors, font styles, and more at a <code>:root</code> level for use anywhere. On components and utilities, CSS variables are scoped to the relevant class and can easily be modified.

Diff for: site/layouts/partials/home/customize.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<hr class="border-medium border-default m-none">
44
</div>
55
<div class="col-xl-4 pe-xl-jumbo">
6-
<hr class="d-xl-none border-medium border-default m-none pb-scaled-short">
6+
<hr class="d-xl-none border-medium m-none pb-scaled-short">
77
<h2 class="text-brand-primary mb-scaled-shorter">Customize everything with&nbsp;Sass</h2>
88
<p class="lead fw-bold bd-text-wrap-balance mb-scaled-shorter">
99
OUDS Web utilizes Sass for a modular and customizable architecture. Import only the components you need, enable global options like gradients and shadows, and write your own CSS with our variables, maps, functions, and mixins.

Diff for: site/layouts/partials/home/get-started.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<hr class="border-medium border-default m-none">
44
</div>
55
<div class="col-xl-4 pe-xl-jumbo">
6-
<hr class="d-xl-none border-medium border-default m-none pb-scaled-short">
6+
<hr class="d-xl-none border-medium m-none pb-scaled-short">
77
<h2 class="text-brand-primary mb-scaled-shorter">Get started any way you&nbsp;want</h2>
88
<p class="lead fw-bold bd-text-wrap-balance mb-scaled-shorter">
99
Jump right into building with OUDS Web—use the CDN, install it via package manager, or download the source code.

Diff for: site/layouts/partials/home/masthead.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ <h1 class="display-medium text-brand-primary mb-scaled-short">OUDS Web</h1>
2020

2121
<div class="hstack gap-short">
2222
<p class="mb-none">Currently v{{ .Site.Params.current_version }}</p>
23-
<div class="vr"></div>
23+
<div class="vr m-none border-always-on-black"></div>
2424
<a href="/docs/{{ .Site.Params.docs_version }}/getting-started/download/" class="fw-bold">Download</a>
25-
<div class="vr"></div>
25+
<div class="vr m-none border-always-on-black"></div>
2626
<a href="/docs/versions/" class="text-nowrap fw-bold">All releases</a>
2727
</div>
2828
</div>

0 commit comments

Comments
 (0)