Skip to content

Commit 5609806

Browse files
committed
article styling
1 parent 6953a50 commit 5609806

File tree

2 files changed

+64
-13
lines changed

2 files changed

+64
-13
lines changed

src/routes/blog/posts/layout.svelte

+56-13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
<script module>
2+
import table from "./table.svelte";
3+
export { table };
4+
</script>
5+
16
<script lang="ts">
27
import type { Snippet } from "svelte";
38
import { format } from "date-fns";
@@ -27,12 +32,60 @@
2732

2833
<style>
2934
.article {
30-
display: flex;
31-
flex-direction: column;
32-
gap: 2rem;
3335
max-width: 67ch;
36+
width: 100%;
3437
font-size: 1.125rem;
3538
}
39+
.article :global(h1) {
40+
margin-block: 0.67em;
41+
}
42+
.article :global(h2) {
43+
margin-block: 0.83em;
44+
}
45+
.article :global(h3) {
46+
margin-block: 1em;
47+
}
48+
.article :global(p) {
49+
margin-block: 1em;
50+
}
51+
.article :global(ul),
52+
.article :global(ol) {
53+
margin-block: 1em;
54+
}
55+
.article :global(pre) {
56+
overflow-x: auto;
57+
padding: 0.5rem;
58+
}
59+
.article :global(blockquote) {
60+
border-left: 0.5rem solid var(--color-primary);
61+
padding: 1rem;
62+
background-color: color-mix(in srgb, var(--color-primary) 10%, white);
63+
}
64+
.article :global(table) {
65+
overflow-x: auto;
66+
width: 100%;
67+
max-width: 100%;
68+
border-collapse: collapse;
69+
}
70+
.article :global(thead) {
71+
display: table-header-group;
72+
vertical-align: middle;
73+
}
74+
.article :global(tr) {
75+
display: table-row;
76+
vertical-align: inherit;
77+
}
78+
.article :global(th) {
79+
vertical-align: bottom;
80+
border-bottom: 2px solid #dee2e6;
81+
text-align: inherit;
82+
}
83+
.article :global(th),
84+
.article :global(td) {
85+
vertical-align: top;
86+
padding: 0.75rem;
87+
border-top: 1px solid #dee2e6;
88+
}
3689
.byline {
3790
font-style: italic;
3891
font-size: 1rem;
@@ -44,14 +97,4 @@
4497
flex-direction: column;
4598
align-items: center;
4699
}
47-
48-
:global(pre) {
49-
overflow-x: auto;
50-
padding: 0.5rem;
51-
}
52-
:global(blockquote) {
53-
border-left: 0.5rem solid var(--color-primary);
54-
padding: 1rem;
55-
background-color: color-mix(in srgb, var(--color-primary) 10%, white);
56-
}
57100
</style>

src/routes/blog/posts/table.svelte

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<div class="table-wrapper"><table><slot /></table></div>
2+
3+
<style>
4+
.table-wrapper {
5+
width: 100%;
6+
overflow-x: auto;
7+
}
8+
</style>

0 commit comments

Comments
 (0)