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

docs: pattern for sorry pages #2676

Merged
merged 11 commits into from
Mar 27, 2024
6 changes: 6 additions & 0 deletions .changeset/swift-dragons-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@swisspost/design-system-documentation': minor
'@swisspost/design-system-styles': minor
---

Added a pattern for error pages with an image. Currently available is a graphic for "404 not found" errors. More error types may be supported in the future.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Meta, Canvas } from '@storybook/blocks';
import * as ErrorPageStories from './error-page.stories';

<Meta of={ErrorPageStories} />

<div className="container">
# Error page template

A generic error page pattern with an image. The image can be exchanged based on the type of error.

## Assets

- <a download href="/images/content/404.png">Download "404 not found" image</a>

</div>

<Canvas of={ErrorPageStories.Default} sourceState='shown' />
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { Args, Meta, StoryObj } from '@storybook/web-components';
import { html } from 'lit';

const meta: Meta = {
id: 'a536a61d-cac2-4f39-adbf-092bdd445ce5',
title: 'Patterns/Error page',
parameters: {
layout: 'fullscreen',
},
render,
};

function render(_args: Args) {
return html`
<div class="bg-light error-container">
<div class="container">
<div class="row">
<div class="col-rg-8 py-huge">
<h2>
This page could not be found.
<br />
<span class="fw-light">A reasons for this could be a misspelled URL.</span>
</h2>
<p class="mt-3">
We kindly ask you to review this once again. It is also possible that we have moved,
archived, or renamed the relevant page. Perhaps you can find the content you're
looking for on our homepage. Or use the search on our portal to locate the desired
page.
</p>
<div class="d-flex gap-3 mt-4">
<a class="btn btn-primary" href="/" @click="${(e: Event) => e.preventDefault()}"
>Home page</a
>
<a
class="btn btn-secondary"
href="https://www.post.ch/de/pages/suche#t=AllTab"
@click="${(e: Event) => e.preventDefault()}"
>
Search
</a>
</div>
</div>
<div class="col-6 offset-3 offset-rg-0 col-rg-4 align-self-end">
<img class="error-container--image" src="/images/content/404.png" alt="" />
oliverschuerch marked this conversation as resolved.
Show resolved Hide resolved
</div>
</div>
</div>
</div>
`;
}

export default meta;

type Story = StoryObj;

export const Default: Story = {};
1 change: 1 addition & 0 deletions packages/styles/src/components/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@use 'carousel';
@use 'close';
@use 'elevation';
@use 'error-container';
@use 'form-range';
@use 'form-select';
@use 'form-textarea';
Expand Down
9 changes: 9 additions & 0 deletions packages/styles/src/components/error-container.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.error-container {
overflow-x: hidden;
}

.error-container--image {
max-width: 150%;
margin: 10vw 0 0 3rem;
object-fit: contain;
}
Loading