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

feat(breadcrumb): add <rh-breadcrumb> #1535

Merged
merged 47 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c854b6f
feat(breadcrumb): add `<rh-breadcrumb>`
adamjohnson Apr 22, 2024
d159575
fix(breadcrumb): add breadcrumbs to elements nav
adamjohnson Apr 23, 2024
cee4dfc
fix(breadcrumb): rearrange dark selector in CSS
adamjohnson Apr 23, 2024
fedfe31
feat(breadcrumb): add new no link demo
adamjohnson Apr 23, 2024
bd88f24
chore(breadcrumb): lint `00-overview.md` list
adamjohnson Apr 23, 2024
b1d4a4c
docs(breadcrumb): fix sample element in docs
adamjohnson Apr 23, 2024
40d2c8f
feat(breadcrumb): add visited styling
adamjohnson Apr 24, 2024
7d23207
test(breadcrumb): add tests
adamjohnson Apr 24, 2024
6514085
test(breadcrumb): add more tests
adamjohnson Apr 25, 2024
07f23e5
Merge branch 'staging/charmander' into feat/breadcrumb
adamjohnson May 6, 2024
1be6f5f
Merge branch 'staging/charmander' into feat/breadcrumb
adamjohnson May 9, 2024
d80d346
Merge branch 'staging/charmander' into feat/breadcrumb
adamjohnson May 17, 2024
7ae500d
fix(breadcrumb): remove last `<li>` truncation
adamjohnson May 17, 2024
bafdc14
fix(breadcrumb): update breadcrumb demo html
adamjohnson May 20, 2024
928a71b
feat(breadcrumb): add subtle variant + dark theme
adamjohnson May 20, 2024
84c82e0
fix(breadcrumb): increase breadcrumb space on mobile
adamjohnson May 20, 2024
d9ca415
fix(breadcrumb): fix dark current page text color
adamjohnson May 21, 2024
bc2101a
fix(breadcrumb): change `href` value to `#`.
adamjohnson May 21, 2024
9889adf
fix(breadcrumb): use logical properties
adamjohnson May 21, 2024
84d0de0
fix(breadcrumb): remove more old truncation CSS
adamjohnson May 21, 2024
bdba76d
fix(breadcrumb): semantically rename vars
adamjohnson May 21, 2024
a933071
docs(breadcrumb): document @cssprops
adamjohnson May 21, 2024
1cd811e
Merge branch 'staging/charmander' into feat/breadcrumb
adamjohnson May 21, 2024
89f2111
fix(breadcrumb): link hover/focus/active color
adamjohnson May 22, 2024
0a61246
style(breadcrumb): alphabetize css properties
adamjohnson May 22, 2024
9a1c027
refactor(breadcrumb): rename last no link demo
adamjohnson May 22, 2024
f2389b9
fix(breadcrumb): add subtle variant to non-interactive last item demo
adamjohnson May 22, 2024
be76fff
fix(breadcrumb): remove interactivity of current page
adamjohnson May 31, 2024
864f756
fix(breadcrumbs): move vars to shadow host selector
adamjohnson Jun 17, 2024
2c93610
chore(breadcrumb): resolve typescript warning
adamjohnson Jun 17, 2024
92b41ba
feat(breadcrumb): add optional accessible label prop
adamjohnson Jun 17, 2024
fefa0f5
docs(breadcrumbs): add content to overview, style, guidelines, and ac…
marionnegp Jun 25, 2024
74af832
docs(breadcrumb): update keyboard interactions
marionnegp Jun 25, 2024
a244214
Merge branch 'staging/charmander' into feat/breadcrumb
zeroedin Jun 25, 2024
2d520ca
docs(breadcrumb): fix remaining shortcodes and repostatus data
zeroedin Jun 25, 2024
b9d8059
docs(breadcrumbs): update Style subpage with image and image sizes
marionnegp Jun 26, 2024
4a44807
docs: add space between alerts and grids
marionnegp Jun 26, 2024
d6d4f02
docs(breadcrumbs): add content and images to Guidelines and Accessibi…
marionnegp Jun 26, 2024
c04fa4e
docs(breadcrumbs): add missing keyboard interaction column text
marionnegp Jun 26, 2024
8408a51
fix(breadcrumb): remove unused `items` prop
adamjohnson Jun 28, 2024
f5e5fff
Merge branch 'staging/charmander' into feat/breadcrumb
adamjohnson Jun 28, 2024
83ace6d
Merge branch 'staging/charmander' into feat/breadcrumb
adamjohnson Jul 11, 2024
71b00d0
Merge branch 'staging/charmander' into feat/breadcrumb
zeroedin Jul 11, 2024
54985b8
docs(breadcrumb): remove playground demo from overview
zeroedin Jul 11, 2024
5f8c425
docs(breadcrumb): update anatomy to use figure
adamjohnson Jul 11, 2024
cea1ad3
docs(breadcrumbs): decrease docs CSS specificity
adamjohnson Jul 11, 2024
430047f
Merge branch 'staging/charmander' into feat/breadcrumb
adamjohnson Jul 15, 2024
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
19 changes: 19 additions & 0 deletions .changeset/metal-snakes-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
"@rhds/elements": minor
---

✨ Added `<rh-breadcrumb>`.

A breadcrumb navigation is a secondary navigation element consisting of a list
of links to the parent pages of the current page in hierarchical order. It
helps users find their place within a website or web application.

```html
<rh-breadcrumb>
<ol>
bennypowers marked this conversation as resolved.
Show resolved Hide resolved
<li><a href="../../../..">Home</a></li>
<li><a href="../../../">About</a></li>
<li><a href="#" aria-current="page">Our Team</a></li>
</ol>
</rh-breadcrumb>
```
1 change: 0 additions & 1 deletion docs/_data/comingSoonItems.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
- rh-breadcrumb
- rh-footnote
22 changes: 22 additions & 0 deletions elements/rh-breadcrumb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Breadcrumb

A breadcrumb trail consists of a list of links to the parent pages of
the current page in hierarchical order. It helps users find their
place within a website or web application. Breadcrumbs are often
placed horizontally before a page's main content.

## Usage

Place the following on your page with your site's breadcrumb
navigation inside as an ordered list:

```html
<rh-breadcrumb>
<ol>
<li><a href="../../../..">Home</a></li>
<li><a href="../../../">About</a></li>
<li><a href="../../">Our Team</a></li>
<li><a href="" aria-current="page">Jamie Simeon Walinsky-Choeffer</a></li>
</ol>
</rh-breadcrumb>
```
37 changes: 37 additions & 0 deletions elements/rh-breadcrumb/demo/color-context.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<rh-context-demo>
<rh-breadcrumb>
<ol>
<li><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Red Hat OpenShift on AWS</a></li>
<li><a href="#">4</a></li>
<li><a href="#">Introduction to ROSA</a></li>
<li><a href="#" aria-current="page">Chapter 1. Understanding ROSA</a></li>
</ol>
</rh-breadcrumb>

<h2 class="subtle-heading">Subtle:</h2>

<rh-breadcrumb variant="subtle">
<ol>
<li><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Red Hat OpenShift on AWS</a></li>
<li><a href="#">4</a></li>
<li><a href="#">Introduction to ROSA</a></li>
<li><a href="#" aria-current="page">Chapter 1. Understanding ROSA</a></li>
</ol>
</rh-breadcrumb>
</rh-context-demo>

<link rel="stylesheet" href="../../rh-breadcrumb-lightdom.css">
<script type="module">
import '@rhds/elements/lib/elements/rh-context-demo/rh-context-demo.js';
import '@rhds/elements/rh-breadcrumb/rh-breadcrumb.js';
</script>

<style>
.subtle-heading {
margin-block-start: 100px;
}
</style>
34 changes: 34 additions & 0 deletions elements/rh-breadcrumb/demo/non-interactive-last-item.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<rh-breadcrumb>
<ol>
<li><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Red Hat OpenShift on AWS</a></li>
<li><a href="#">4</a></li>
<li><a href="#">Introduction to ROSA</a></li>
<li>Chapter 1. Understanding ROSA</li>
</ol>
</rh-breadcrumb>

<h2 class="subtle-heading">Subtle:</h2>

<rh-breadcrumb variant="subtle">
<ol>
<li><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Red Hat OpenShift on AWS</a></li>
<li><a href="#">4</a></li>
<li><a href="#">Introduction to ROSA</a></li>
<li>Chapter 1. Understanding ROSA</li>
</ol>
</rh-breadcrumb>

<link rel="stylesheet" href="../../rh-breadcrumb-lightdom.css">
<script type="module">
import '@rhds/elements/rh-breadcrumb/rh-breadcrumb.js';
</script>

<style>
.subtle-heading {
margin-block-start: 100px;
}
</style>
15 changes: 15 additions & 0 deletions elements/rh-breadcrumb/demo/rh-breadcrumb.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<rh-breadcrumb>
<ol>
<li><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Red Hat OpenShift on AWS</a></li>
<li><a href="#">4</a></li>
<li><a href="#">Introduction to ROSA</a></li>
<li><a href="#" aria-current="page">Chapter 1. Understanding ROSA</a></li>
</ol>
</rh-breadcrumb>

<link rel="stylesheet" href="../rh-breadcrumb-lightdom.css">
<script type="module">
import '@rhds/elements/rh-breadcrumb/rh-breadcrumb.js';
</script>
15 changes: 15 additions & 0 deletions elements/rh-breadcrumb/demo/subtle.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<rh-breadcrumb variant="subtle">
<ol>
<li><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Red Hat OpenShift on AWS</a></li>
<li><a href="#">4</a></li>
<li><a href="#">Introduction to ROSA</a></li>
<li><a href="#" aria-current="page">Chapter 1. Understanding ROSA</a></li>
</ol>
</rh-breadcrumb>

<link rel="stylesheet" href="../../rh-breadcrumb-lightdom.css">
<script type="module">
import '@rhds/elements/rh-breadcrumb/rh-breadcrumb.js';
</script>
27 changes: 27 additions & 0 deletions elements/rh-breadcrumb/docs/00-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<link rel="stylesheet" type="text/css" href="/assets/packages/@rhds/elements/elements/rh-breadcrumb/rh-breadcrumb-lightdom.css">

## Overview

{{ tagName | getElementDescription }}

## Sample element

<rh-breadcrumb>
<ol>
<li><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Red Hat OpenShift on AWS</a></li>
<li><a href="#">4</a></li>
<li><a href="#">Introduction to ROSA</a></li>
<li><a href="#" aria-current="page">Chapter 1. Understanding ROSA</a></li>
</ol>
</rh-breadcrumb>

## Demo

{% playground tagName=tagName %}{% endplayground %}
{% cta href="./demo/", target="_blank" %}View the demo{% endcta %}

## When to use

- When a user needs to know where they are within a site
14 changes: 14 additions & 0 deletions elements/rh-breadcrumb/docs/10-style.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Style

## Theme

## Configuration

## Placement

## Space

## Interaction States



8 changes: 8 additions & 0 deletions elements/rh-breadcrumb/docs/20-guidelines.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Usage

## Behavior

## Writing Content

## Best Practices

18 changes: 18 additions & 0 deletions elements/rh-breadcrumb/docs/30-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% renderInstall %}{% endrenderInstall %}

## Usage

```html
<rh-breadcrumb>
<ol>
<li><a href="#">Home</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Red Hat OpenShift on AWS</a></li>
<li><a href="#">4</a></li>
<li><a href="#">Introduction to ROSA</a></li>
<li><a href="#" aria-current="page">Chapter 1. Understanding ROSA</a></li>
</ol>
</rh-breadcrumb>
```

{% renderCodeDocs hideDescription=true %}{% endrenderCodeDocs %}
4 changes: 4 additions & 0 deletions elements/rh-breadcrumb/docs/40-accessibility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Keyboard navigation

## Focus order

Binary file modified elements/rh-breadcrumb/docs/screenshot.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
121 changes: 121 additions & 0 deletions elements/rh-breadcrumb/rh-breadcrumb-lightdom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
rh-breadcrumb {
adamjohnson marked this conversation as resolved.
Show resolved Hide resolved
/* stylelint-disable-next-line max-line-length */
--_breadcrumb-caret-image-default: var(--rh-breadcrumb-caret-image, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='15' viewBox='0 0 10 15' fill='none'%3E%3Cg clip-path='url(%23clip0_232_19576)'%3E%3Cpath d='M2.5 14.5L0.5 12.5L5.5 7.5L0.5 2.5L2.5 0.5L9.5 7.5L2.5 14.5Z' fill='%23000000'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_232_19576'%3E%3Crect width='10' height='14' fill='white' transform='matrix(-1 0 0 1 10 0.5)'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E"));
/* stylelint-disable-next-line max-line-length */
--_breadcrumb-caret-image-subtle: var(--rh-breadcrumb-caret-image-subtle, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='15' viewBox='0 0 10 15' fill='none'%3E%3Cg clip-path='url(%23clip0_232_19576)'%3E%3Cpath d='M2.5 14.5L0.5 12.5L5.5 7.5L0.5 2.5L2.5 0.5L9.5 7.5L2.5 14.5Z' fill='%23707070'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_232_19576'%3E%3Crect width='10' height='14' fill='white' transform='matrix(-1 0 0 1 10 0.5)'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E"));
--_breadcrumb-link-color:
var(
--rh-breadcrumb-link-color,
var(--rh-color-interactive-blue-darker, #0066cc)
);
--_breadcrumb-link-color-current-page:
var(
--rh-breadcrumb-link-color-current-page,
var(--rh-color-text-primary-on-light, #151515)
);
--_breadcrumb-link-color-current-page-subtle:
var(
--rh-breadcrumb-link-color-current-page-subtle,
var(--rh-color-text-secondary-on-light, #4d4d4d)
);
--_breadcrumb-link-color-hover:
var(
--rh-breadcrumb-link-color-hover,
var(--rh-color-interactive-blue-darkest, #003366)
);
--_breadcrumb-link-color-visited:
var(
--rh-breadcrumb-link-color-visited,
var(--rh-color-interactive-purple-darker, #5e40be)
);
--_breadcrumb-link-color-visited-hover:
var(
--rh-breadcrumb-link-color-visited-hover,
var(--rh-color-interactive-purple-darkest, #21134d)
);
--_breadcrumb-link-focus-outline-color:
var(
--rh-breadcrumb-link-focus-outline-color,
var(--rh-color-border-interactive-on-light, #0066cc)
);

display: block;
}

rh-breadcrumb ol {
container-type: inline-size;
container-name: breadcrumbs-list;
font-size: var(--rh-font-size-body-text-sm, 0.875rem);
line-height: var(--rh-line-height-body-text, 1.5);
margin-block: 0;
padding-inline-start: 0;
}

rh-breadcrumb > ol > li {
background-image: var(--_breadcrumb-caret-image-default);
background-position: calc(100% - 14px) center;
background-repeat: no-repeat;
background-size: 10px;
display: inline-block;
margin-block-end: var(--rh-space-md, 8px);
padding-inline-end: var(--rh-breadcrumb-li-padding-inline-end, 42px);
vertical-align: bottom;
}

rh-breadcrumb[variant="subtle"] > ol > li {
background-image: var(--_breadcrumb-caret-image-subtle);
}

rh-breadcrumb > ol > li:first-child {
padding-inline-start: 0;
}

rh-breadcrumb > ol > li:last-child {
background-image: none;
}

rh-breadcrumb > ol > li,
rh-breadcrumb > ol > li > a {
color: var(--_breadcrumb-link-color);
}

rh-breadcrumb > ol > li > a {
text-decoration: none;
}

rh-breadcrumb > ol > li > a:is(:hover, :focus, :active) {
color: var(--_breadcrumb-link-color-hover);
text-decoration: underline;
}

rh-breadcrumb > ol > li > a:is(:focus, :focus-visible) {
border-radius: var(--rh-border-radius-default, 3px);
outline: 2px solid var(--_breadcrumb-link-focus-outline-color);
}

rh-breadcrumb > ol > li:first-child > a {
margin-inline-start: 0;
}

rh-breadcrumb > ol > li > a:visited {
color: var(--_breadcrumb-link-color-visited);
}

rh-breadcrumb > ol > li > a:visited:hover {
color: var(--_breadcrumb-link-color-visited-hover);
}

rh-breadcrumb > ol > li:last-child,
rh-breadcrumb > ol > li > a[aria-current="page"] {
color: var(--_breadcrumb-link-color-current-page);
}

rh-breadcrumb > ol > li > a[aria-current="page"] {
cursor: default;
pointer-events: none;
}

rh-breadcrumb[variant="subtle"] > ol > li:last-child,
rh-breadcrumb[variant="subtle"] > ol > li > a[aria-current="page"] {
color: var(--_breadcrumb-link-color-current-page-subtle);
}
45 changes: 45 additions & 0 deletions elements/rh-breadcrumb/rh-breadcrumb.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
:host {
display: block;
}

#container.dark {
/* stylelint-disable-next-line max-line-length */
--_breadcrumb-caret-image-default: var(--rh-breadcrumb-caret-image, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='15' viewBox='0 0 10 15' fill='none'%3E%3Cg clip-path='url(%23clip0_232_19576)'%3E%3Cpath d='M2.5 14.5L0.5 12.5L5.5 7.5L0.5 2.5L2.5 0.5L9.5 7.5L2.5 14.5Z' fill='%23ffffff'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_232_19576'%3E%3Crect width='10' height='14' fill='white' transform='matrix(-1 0 0 1 10 0.5)'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E"));
/* stylelint-disable-next-line max-line-length */
--_breadcrumb-caret-image-subtle: var(--rh-breadcrumb-caret-image-subtle, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='15' viewBox='0 0 10 15' fill='none'%3E%3Cg clip-path='url(%23clip0_232_19576)'%3E%3Cpath d='M2.5 14.5L0.5 12.5L5.5 7.5L0.5 2.5L2.5 0.5L9.5 7.5L2.5 14.5Z' fill='%23a3a3a3'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_232_19576'%3E%3Crect width='10' height='14' fill='white' transform='matrix(-1 0 0 1 10 0.5)'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E"));
--_breadcrumb-link-color:
var(
--rh-breadcrumb-link-color,
var(--rh-color-interactive-blue-lighter, #92c5f9)
);
--_breadcrumb-link-color-current-page:
var(
--rh-breadcrumb-link-color-current-page,
var(--rh-color-text-primary-on-dark, #ffffff)
);
--_breadcrumb-link-color-current-page-subtle:
var(
--rh-breadcrumb-link-color-current-page-subtle,
var(--rh-color-text-secondary-on-dark, #c7c7c7)
);
--_breadcrumb-link-color-hover:
var(
--rh-breadcrumb-link-color-hover,
var(--rh-color-interactive-blue-lightest, #b9dafc)
);
--_breadcrumb-link-color-visited:
var(
--rh-breadcrumb-link-color-visited,
var(--rh-color-interactive-purple-lighter, #b6a6e9)
);
--_breadcrumb-link-color-visited-hover:
var(
--rh-breadcrumb-link-color-visited-hover,
var(--rh-color-interactive-purple-lightest, #ece6ff)
);
--_breadcrumb-link-focus-outline-color:
var(
--rh-breadcrumb-link-focus-outline-color,
var(--rh-color-border-interactive-on-dark, #92c5f9)
);
}
Loading
Loading