Skip to content

Commit

Permalink
explorer: Refactor error state page
Browse files Browse the repository at this point in the history
  • Loading branch information
deuch13 committed Jun 26, 2024
1 parent 8ce38ce commit fe511f1
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 26 deletions.
22 changes: 16 additions & 6 deletions explorer/src/routes/+error.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,32 @@

<script>
import { page } from "$app/stores";
import { Card } from "$lib/dusk/components";
const { error, status } = $page;
</script>

<section class="error-message">
<h2>Error - {status}</h2>
<p>{error?.message ?? ""}</p>
<Card className="error-message__card">
<p class="error-message__card-content">
Error {status}<br />
{error?.message ?? ""}
</p>
</Card>
</section>

<style lang="postcss">
.error-message {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
:global(.error-message__card) {
border: var(--control-border-size) solid var(--error-color);
width: 100%;
}
:global(.error-message__card-content) {
font-size: 1.75rem;
}
</style>
52 changes: 34 additions & 18 deletions explorer/src/routes/__tests__/__snapshots__/error.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,49 @@
exports[`Error page > should be able to render the error page even without an error 1`] = `
<body>
<section
class="error-message svelte-1wuvb8w"
class="error-message svelte-xa69t0"
>
<h2>
Error -
200
</h2>
<p>
</p>
<div
class="dusk-card error-message__card"
>
<p
class="error-message__card-content"
>
Error
200
<br />
</p>
</div>
</section>
</body>
`;

exports[`Error page > should render the error page 1`] = `
<body>
<section
class="error-message svelte-1wuvb8w"
class="error-message svelte-xa69t0"
>
<h2>
Error -
500
</h2>
<p>
some error message
</p>
<div
class="dusk-card error-message__card"
>
<p
class="error-message__card-content"
>
Error
500
<br />
some error message
</p>
</div>
</section>
</body>
`;
11 changes: 9 additions & 2 deletions explorer/src/style/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,16 @@ html {
letter-spacing: 0.06125rem;
}

main {
#app-container {
display: flex;
flex-direction: column;
min-height: 100%;
}

#app-container > main {
flex: 1;
padding: 1.25rem 0;
overflow-x: hidden;
overflow: hidden;
}

svg {
Expand Down

0 comments on commit fe511f1

Please sign in to comment.