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(site-status): add <rh-site-status> #1507

Merged
merged 58 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
13089d1
feat(site-status): add site-status
zeroedin Mar 28, 2024
6164e39
fix(site-status): add missing export
zeroedin Mar 28, 2024
0f9c293
chore(site-stutus): fix comment
zeroedin Mar 28, 2024
eaaeb48
fix(site-status): lint
zeroedin Mar 28, 2024
c11d438
fix(site-status): add color-context
zeroedin Mar 28, 2024
af69a63
test(site-staus): fix missing semi colon
zeroedin Mar 28, 2024
0c8fcd0
fix(site-status): remove errant import
zeroedin Mar 28, 2024
58ddfd5
fix(site-status): allow endpoint to be overridden
zeroedin Mar 29, 2024
9aa6c81
docs(site-status): add incorrect endpoint demo
zeroedin Mar 29, 2024
5f27e23
docs(site-status): correct auto generated template for demo
zeroedin Mar 29, 2024
ec1433c
test(site-status): improve tests
zeroedin Mar 29, 2024
f1cc5a3
fix(site-status): lint
zeroedin Mar 29, 2024
25401d8
fix(site-status): lint
zeroedin Mar 29, 2024
f281942
fix(site-status): ugh lint...
zeroedin Mar 29, 2024
d4c7625
fix(site-status): revert customizable endpoint, add href to status pa…
zeroedin Apr 1, 2024
dc580dd
test(site-status): improve tests
zeroedin Apr 1, 2024
0301f8b
docs(site-status): add status demos
zeroedin Apr 1, 2024
a691888
Merge branch 'staging/chansey' into feat/site-status
zeroedin Apr 1, 2024
3ec44e8
docs(site-status): stub docs
zeroedin Apr 1, 2024
33fe32b
docs(site-status): add jsdoc
zeroedin Apr 2, 2024
339629f
docs: add site-status to related items
zeroedin Apr 2, 2024
f62b047
fix(site-status): add type guard for api response
zeroedin Apr 4, 2024
1916723
docs(site-status): update readme
zeroedin Apr 10, 2024
5bed744
docs(site-status): imporove jsdoc
zeroedin Apr 11, 2024
3f5d67b
docs(site-status): add docs pages and images
zeroedin Apr 11, 2024
646dd8e
chore(site-status): add changeset
zeroedin Apr 11, 2024
e7761e1
chore(site-status): update changeset to include example
zeroedin Apr 11, 2024
1ec93f1
chore(site-status): remove unused demo files
zeroedin Apr 11, 2024
53d3db9
fix(site-status): remove unused part
zeroedin Apr 12, 2024
5b1412e
style(site-status): reorder type
zeroedin Apr 12, 2024
c7b264a
fix(site-status): make #isApiStatus static
zeroedin Apr 12, 2024
2a78dcc
fix(site-status): class decorators cant be use with static private id…
zeroedin Apr 12, 2024
db54625
fix(site-status): move getStatus to firstUpdated, remove extraneous t…
zeroedin Apr 12, 2024
80b08db
fix(site-status): handle capitalization in css
zeroedin Apr 12, 2024
082bfd5
fix(site-status): correct first letter uppercase style
zeroedin Apr 12, 2024
88ff1ff
fix(site-status): revert response error removal
zeroedin Apr 12, 2024
3903bfb
fix(site-status): remove status as statusText includes the 404 text.
zeroedin Apr 12, 2024
3dc5356
fix(site-status): correct viewbox attr
zeroedin Apr 12, 2024
339a018
Merge branch 'staging/chansey' into feat/site-status
zeroedin Apr 13, 2024
eef39fd
docs(site-status): add repoStatus
zeroedin Apr 13, 2024
3130696
test(site-status): use sinon for fetch stub
zeroedin Apr 15, 2024
8787c54
test(site-status): remove unused aTimeout
zeroedin Apr 15, 2024
2adc35b
Merge branch 'staging/chansey' into feat/site-status
zeroedin Apr 15, 2024
29694e1
fix(site-status): switch api call to a try catch
zeroedin Apr 16, 2024
f8106f4
fix(site-status): remove contextProvider not used in design spec
zeroedin Apr 16, 2024
24e29ea
fix(site-status): use block instead of display contents on host
zeroedin Apr 16, 2024
ad684b8
fix(site-status): move restore of fetch to top describes
zeroedin Apr 16, 2024
302d2b0
fix(site-status): implement loading-text slot for translations and ac…
zeroedin Apr 16, 2024
c6631ee
docs(site-status): improve demos with loading state demo
zeroedin Apr 16, 2024
57ca112
fix(site-status): add focus and hover states
zeroedin Apr 16, 2024
0c28434
docs(site-status): add if status is still loading to accessibility
zeroedin Apr 16, 2024
cb23515
Merge branch 'staging/chansey' into feat/site-status
zeroedin Apr 16, 2024
fd85451
fix(site-status): readding color context provider
zeroedin Apr 16, 2024
1ec825c
chore(site-status): lint
zeroedin Apr 16, 2024
3c312f4
fix(site-status): remove context provider add dark styles
zeroedin Apr 17, 2024
581e712
docs(site-status): readding arg check to fetch override
zeroedin Apr 17, 2024
0ff93cf
chore(site-status): lint
zeroedin Apr 17, 2024
e73ac83
Merge branch 'staging/chansey' into feat/site-status
zeroedin Apr 17, 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
11 changes: 11 additions & 0 deletions .changeset/hot-spiders-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@rhds/elements": minor
---

✨ Added `<rh-site-status>`

Website status communicates the operational status of a website or domain using a status icon and link. It is usually located in the Footer component.

```html
<rh-site-status></rh-site-status>
```
4 changes: 4 additions & 0 deletions docs/_data/relatedItems.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ rh-footer:
- rh-accordion
- rh-popover
- rh-tooltip
- rh-site-status
rh-jump-links:
- rh-pagination
- rh-progress-steps
Expand Down Expand Up @@ -68,6 +69,9 @@ rh-skip-link:
- rh-navigation
- rh-navigation-secondary
- rh-subnav
rh-site-status:
- rh-card
- rh-footer
rh-spinner:
- form
- search-bar
Expand Down
16 changes: 15 additions & 1 deletion docs/_data/repoStatus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,21 @@
- name: webRH
status: Planned
- name: Documentation
status: Ready
status: Ready
- name: "Site Status"
type: "Element"
overallStatus: "New"
libraries:
- name: Figma library
status: Ready
- name: Responsive
status: Ready
- name: RH Elements
status: Ready
- name: webRH
status: Planned
- name: Documentation
status: Ready
- name: "Spinner"
type: "Element"
overallStatus: "Available"
Expand Down
24 changes: 24 additions & 0 deletions elements/rh-site-status/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Site Status
Website status communicates the operational status of a website or domain using a status icon and link. It is usually located in the Footer component

## Installation

If using npm/bundlers:

```bash
npm install @rhds/elements
```

Then once installed, import it to your application:

```js
import '@rhds/elements/rh-site-status/rh-site-status.js';
```

## Usage
- When you need to communicate the operational status of a website or domain
- When you need to provide users with a link to a status page where they can learn more

```html
<rh-site-status></rh-site-status>
```
8 changes: 8 additions & 0 deletions elements/rh-site-status/demo/color-context.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<rh-context-demo>
<rh-site-status></rh-site-status>
</rh-context-demo>

<script type="module">
import '@rhds/elements/rh-site-status/rh-site-status.js';
import '@rhds/elements/lib/elements/rh-context-demo/rh-context-demo.js';
</script>
15 changes: 15 additions & 0 deletions elements/rh-site-status/demo/fetch-override.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export function overrideFetch(ok, status, statusText, json) {
window.fetch = new Proxy(window.fetch, {
apply: (target, thisArg, args) => {
if (args[0] === 'https://status.redhat.com/index.json') {
return Promise.resolve({
ok,
status,
statusText,
json
});
}
return target.apply(thisArg, args);
}
});
}
5 changes: 5 additions & 0 deletions elements/rh-site-status/demo/rh-site-status.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<rh-site-status></rh-site-status>

<script type="module">
import '@rhds/elements/rh-site-status/rh-site-status.js';
</script>
10 changes: 10 additions & 0 deletions elements/rh-site-status/demo/status-404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script type="module">
import { overrideFetch } from '../fetch-override.js';
overrideFetch(false, 404, 'Error: 404 Not Found');
</script>

<rh-site-status></rh-site-status>

<script type="module">
import '@rhds/elements/rh-site-status/rh-site-status.js';
</script>
15 changes: 15 additions & 0 deletions elements/rh-site-status/demo/status-critical.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script type="module">
import { overrideFetch } from '../fetch-override.js';
overrideFetch(
true,
200,
'Critical Outage',
() => Promise.resolve({ status: { indicator: 'critical', description: 'Critical Outage' } })
);
</script>

<rh-site-status></rh-site-status>

<script type="module">
import '@rhds/elements/rh-site-status/rh-site-status.js';
</script>
15 changes: 15 additions & 0 deletions elements/rh-site-status/demo/status-maintenance.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script type="module">
import { overrideFetch } from '../fetch-override.js';
overrideFetch(
true,
200,
'Maintenance',
() => Promise.resolve({ status: { indicator: 'maintenance', description: 'Status Maintenance' } })
);
</script>

<rh-site-status></rh-site-status>

<script type="module">
import '@rhds/elements/rh-site-status/rh-site-status.js';
</script>
15 changes: 15 additions & 0 deletions elements/rh-site-status/demo/status-major.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script type="module">
import { overrideFetch } from '../fetch-override.js';
overrideFetch(
true,
200,
'Major Outage',
() => Promise.resolve({ status: { indicator: 'major', description: 'Major Outage' } })
);
</script>

<rh-site-status></rh-site-status>

<script type="module">
import '@rhds/elements/rh-site-status/rh-site-status.js';
</script>
15 changes: 15 additions & 0 deletions elements/rh-site-status/demo/status-minor.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script type="module">
import { overrideFetch } from '../fetch-override.js';
overrideFetch(
true,
200,
'Partially Degraded Service',
() => Promise.resolve({ status: { indicator: 'minor', description: 'Partially Degraded Service' } })
);
</script>

<rh-site-status></rh-site-status>

<script type="module">
import '@rhds/elements/rh-site-status/rh-site-status.js';
</script>
25 changes: 25 additions & 0 deletions elements/rh-site-status/docs/00-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Overview

{{ tagName | getElementDescription }}

{% example palette="darkest",
alt="Image of a site status element with a green checkmark and the text 'All systems operational'",
src="./site-status-sample.svg"
%}

{% repoStatusList %}

## Sample element

<rh-site-status></rh-site-status>

## Demo

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

## When to use
- When you need to communicate the operational status of a website or domain
- When you need to provide users with a link to a status page where they can learn more

{% repoStatusChecklist %}
123 changes: 123 additions & 0 deletions elements/rh-site-status/docs/10-style.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<style>
figure {
margin: 0;
}
figcaption ol {
font-size: var(--rh-font-size-body-text-sm, 0.875rem);
font-weight: var(--rh-font-weight-body-text-regular, 400);
line-height: var(--rh-line-height-heading, 1.3);
padding-inline-start: var(--rh-space-lg, 16px);
}
figure .example {
margin-bottom: var(--rh-space-lg, 16px);
}

figure .example + figcaption {
margin-bottom: var(--rh-space-4xl, 64px);
}

.grid {
display: grid;
grid-template-columns: 1fr;
gap: var(--rh-space-4xl, 64px);
}

.grid .example {
width: 100%;
}

.grid .example + .example {
margin-top: unset;
margin-block-start: unset;
}

@media (min-width: 992px) {
.grid {
grid-template-columns: repeat(2, 1fr);
}
}
</style>

## Styles

Website status is a combination of an icon and link within a very small card. It is designed to be understood immediately. Otherwise, a user can click on the link to learn more.

### Anatomy

<figure>
{% example palette="darkest",
alt="Image of a site status element with a green checkmark and the text 'All systems operational'",
src="../site-status-anatomy.svg"
%}
<figcaption>
<ol>
<li>Icon</li>
<li>Link</li>
<li>Container</li>
</ol>
</figcaption>
</figure>

## Theme

Currently, Website status is only available in the dark theme. You may use Website status in the light theme if necessary. If you need a separate light version designed instead, [contact us](https://github.com/RedHat-UX/red-hat-design-system/discussions).


<div class="grid">
{% example palette="darkest",
alt="Image of a site status element with a green checkmark and the text 'All systems operational on a dark background'",
src="../site-status-theme.svg"
%}

{% example palette="lightest",
alt="Image of a site status element with a green checkmark and the text 'All systems operational on a light background'",
src="../site-status-theme.svg"
%}
</div>

## Configuration

Website status has a fixed height and its width changes depending on the amount of link text. The icon and link are horizontally aligned to the card as well.

{% example palette="darkest",
alt="Image of a site status element with a green checkmark and the text 'All systems operational' with fixed height, width and horizontal alignment indicators.",
src="../site-status-configuration.svg"
%}

## Icons

Website status includes three icons that also indicate the severity of the status.

{% example palette="darkest",
alt="Three images of site status elements, one with a green checkmark and the text 'All systems operational', the second with a yellow exclamation point and the text 'Partial system outage', and the third with a red exclamation point and the text 'Major system outage'.",
src="../site-status-icons.svg"
%}

## Space

Space values remain the same at all viewport sizes.

{% example palette="darkest",
alt="Image of a site status element with a green checkmark and the text 'All systems operational' with space indicators.",
src="../site-status-space.svg"
%}

{% example palette="none",
alt="Image of a site status element with a green checkmark and the text 'All systems operational' in a footer element with space indicators.",
src="../site-status-footer.svg"
%}

{% example palette="none",
alt="Image of a site status element with a green checkmark and the text 'All systems operational' in a footer element with space indicators at a small viewport size.",
src="../site-status-footer-mobile.svg"%}


## Interaction states

Only the link is selectable and it should be underlined in all interaction states.

{% example palette="darkest",
alt="Three images of a site status element with a green checkmark and the text 'All systems operational' first one displaying the mouse hover state, the second the keyboard state, the third a combination of hover and focus.",
src="../site-status-interaction-states.svg"
%}

Loading
Loading