mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-31 17:20:44 +08:00
- Move all global typography styles to its own file. This makes it easier to find all the typography related definitions for newcomers. - Prefix all typography related global CSS classes with a unique prefix `.txt-`. This allows us to grep the codebase and see exactly where they are applied. Another benefit of this convention is that it helps to avoid accidentally mixing global and local styles. Having global CSS classes that sometimes overlap with component CSS classes makes it very hard to reason about the resulting visuals and making changes unpredictable. - Introduce CSS variables for standardised typography sizes and apply them to the whole codebase consistently. This way we can adjust the size in one place and it will be applied everywhere. - Avoid using predefined HTML tags which might have differing styling from browser to browser, e.g. `<h1>`, `<strong>`. We should stick to applying styling either by adding a specific global CSS class or using the predefined CSS variables, this way we can be sure that the styles won't be overridden by browser defaults. - Have a minimal set of modifiers `.txt-monospace` and `.txt-bold` and apply them consistently. Since `.txt-monospace` is defined via a CSS variable, we'll be able to switch out fonts via a user setting in the future. Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
49 lines
1.0 KiB
Svelte
49 lines
1.0 KiB
Svelte
<script lang="ts">
|
|
import type { Err } from "@app/error";
|
|
|
|
import { createEventDispatcher } from "svelte";
|
|
import Modal from "@app/Modal.svelte";
|
|
import Button from "@app/Button.svelte";
|
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
export let error: Err | null = null;
|
|
export let title = "Error";
|
|
export let emoji = "";
|
|
export let subtitle = "";
|
|
export let message = "";
|
|
export let floating = false;
|
|
export let subtle = false;
|
|
export let action = floating ? "Close" : "Back";
|
|
|
|
const body = message || (error && error.message) || "";
|
|
</script>
|
|
|
|
<Modal on:close error {floating} {subtle}>
|
|
<span slot="title">
|
|
{#if emoji}
|
|
<div>{emoji}</div>
|
|
{/if}
|
|
{title}
|
|
</span>
|
|
|
|
<span slot="subtitle">
|
|
{subtitle}
|
|
</span>
|
|
|
|
<span slot="body">
|
|
<slot>
|
|
<span class="txt-bold">Error:</span>
|
|
{body}
|
|
</slot>
|
|
</span>
|
|
|
|
<span slot="actions">
|
|
<slot name="actions">
|
|
<Button variant="negative" on:click={() => dispatch("close")}>
|
|
{action}
|
|
</Button>
|
|
</slot>
|
|
</span>
|
|
</Modal>
|