Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

feat(styles): add prose component styles for improved typography and layout (#20)

Corentin Thomasset5d22fe6e4bfa
diff --git a/src/styles/app.css b/src/styles/app.css
index a4e26192..040a87da 100644
--- a/src/styles/app.css
+++ b/src/styles/app.css
@@ -72,4 +72,98 @@
}
body {
@apply bg-background text-foreground;
+ }
+
+
+ /* inspired by Astro blog https://github.com/withastro/astro.build/blob/cc7df140766a6c60ec54284593ea8ea940604dd5/src/styles/prose.css */
+ @layer components {
+ .prose {
+ @apply mx-auto w-full tracking-wide lg:text-lg;
+ line-height: 1.75em;
+ }
+
+ .prose > p,
+ .prose > blockquote > p {
+ @apply my-4;
+ }
+ .prose > blockquote {
+ padding-left: 2rem;
+ border-left: 1px solid;
+ }
+
+ .prose > hr {
+ @apply my-8;
+ }
+
+ .prose > img {
+ @apply my-4;
+ }
+
+ .prose strong {
+ @apply font-medium text-white;
+ }
+
+ .prose ul {
+ @apply my-4 pl-8;
+ }
+
+ .prose ol {
+ @apply my-4 list-inside list-decimal pl-4;
+ }
+ .prose ol ::marker {
+ @apply font-mono inline-block font-bold text-muted-foreground;
+ }
+
+ /* Workaround for when li first node is wrapped in a p */
+ .prose li > p:first-child {
+ @apply inline-block;
+ }
+
+ .prose li {
+ @apply my-0.5;
+ }
+
+ .prose :where(a) {
+ @apply text-primary! underline underline-offset-3 hover:text-foreground! transition-colors;
+ }
+
+ .prose :where(code):not(:where(pre, h1, h2, h3, h4, h5, h6) code) {
+ @apply mx-0.5! inline-block rounded-md! bg-muted! px-2 align-baseline text-sm! leading-6!;
+ }
+
+ .prose :where(:not(pre) > code):not(:where(.not-prose,.not-prose *))::before,
+ .prose :where(:not(pre) > code):not(:where(.not-prose,.not-prose *))::after {
+ @apply content-['']!;
+ }
+
+ .prose > p a > code {
+ @apply text-inherit;
+ text-decoration: inherit;
+ }
+
+ .prose .expressive-code {
+ @apply my-6;
+ }
+
+ .prose table {
+ @apply overflow-auto border-spacing-0 text-sm sm:text-base w-full;
+ }
+ .prose tr {
+ @apply w-full;
+ }
+ .prose :is(th, td) {
+ @apply border-b py-2 px-4 align-baseline;
+ }
+ .prose :is(th, td):first-child {
+ @apply pl-0;
+ }
+ .prose :is(th, td):last-child {
+ @apply pr-0;
+ }
+ .prose th {
+ @apply text-white font-medium;
+ }
+ .prose th:not([align]) {
+ @apply text-start;
+ }
}
\ No newline at end of file