-
Notifications
You must be signed in to change notification settings - Fork 14
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
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8588ee7
feat: add error page template
gfellerph 2105d23
Merge branch 'main' into 1429-template-for-sorry-pages
gfellerph 393b759
update responsive behaviour
gfellerph 40f91a3
add download link
gfellerph 6769b7c
add uid
gfellerph e77f5c4
add changeset
gfellerph dd14812
fix linting error
gfellerph 44d87a2
Merge branch 'main' into 1429-template-for-sorry-pages
gfellerph 82a99a7
fix: update format and remove invalid download attr value
gfellerph bf63c86
fix: remove explicit light font on body text
gfellerph 0617ad8
fix: simplify the docs
gfellerph File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
14 changes: 14 additions & 0 deletions
14
packages/documentation/src/stories/templates/error-page/error-page.docs.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Meta, Canvas } from '@storybook/blocks'; | ||
import * as ErrorPageStories from './error-page.stories'; | ||
|
||
<Meta of={ErrorPageStories} /> | ||
|
||
<div class="container"> | ||
# Error page template | ||
|
||
A generic error page pattern with an image. The image can be exchanged based on the type of error. | ||
|
||
- 404 not found: <a download href="/images/content/404.png">Download "404 not found" image</a> | ||
</div> | ||
|
||
<Canvas of={ErrorPageStories.Default} /> |
62 changes: 62 additions & 0 deletions
62
packages/documentation/src/stories/templates/error-page/error-page.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { Args, Meta, StoryObj } from '@storybook/web-components'; | ||
import { BADGE } from '../../../../.storybook/constants'; | ||
import { html } from 'lit'; | ||
|
||
const meta: Meta = { | ||
id: 'a536a61d-cac2-4f39-adbf-092bdd445ce5', | ||
title: 'Patterns/Error page', | ||
parameters: { | ||
badges: [BADGE.NEEDS_REVISION], | ||
layout: 'fullscreen', | ||
}, | ||
render, | ||
decorators: [ | ||
story => html` | ||
<swisspost-internet-header project="test"></swisspost-internet-header> | ||
<div class="container my-4"> | ||
<swisspost-internet-breadcrumbs hide-buttons></swisspost-internet-breadcrumbs> | ||
</div> | ||
${story()} | ||
<swisspost-internet-footer></swisspost-internet-footer> | ||
`, | ||
], | ||
}; | ||
|
||
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="/">Home page</a> | ||
<a class="btn btn-secondary" href="https://www.post.ch/de/pages/suche#t=AllTab"> | ||
Search | ||
</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add some click event listeners ( |
||
</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 = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The preceding text "404 not found:" is kind of irritating me. Wouldn't it be enough to just leave the text inside of the link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example is very large and therefore (even if I now storybook probably pretty well) I was thinking about how to get the necessary code from the example.
It could be a good idea to add a note, and to tell visitors how to do this here.