Skip to content

Commit 0ec7189

Browse files
committed
style: subtle color and size adjustment for <details> in the readme
1 parent 5324b96 commit 0ec7189

File tree

1 file changed

+38
-13
lines changed

1 file changed

+38
-13
lines changed

app/components/Readme.vue

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,13 @@ function handleClick(event: MouseEvent) {
6060
</script>
6161

6262
<template>
63-
<article
64-
class="readme max-w-[70ch] lg:max-w-none px-1"
65-
dir="auto"
66-
v-html="html"
67-
:style="{
68-
'--i18n-note': '\'' + $t('package.readme.callout.note') + '\'',
69-
'--i18n-tip': '\'' + $t('package.readme.callout.tip') + '\'',
70-
'--i18n-important': '\'' + $t('package.readme.callout.important') + '\'',
71-
'--i18n-warning': '\'' + $t('package.readme.callout.warning') + '\'',
72-
'--i18n-caution': '\'' + $t('package.readme.callout.caution') + '\'',
73-
}"
74-
@click="handleClick"
75-
/>
63+
<article class="readme max-w-[70ch] lg:max-w-none px-1" dir="auto" v-html="html" :style="{
64+
'--i18n-note': '\'' + $t('package.readme.callout.note') + '\'',
65+
'--i18n-tip': '\'' + $t('package.readme.callout.tip') + '\'',
66+
'--i18n-important': '\'' + $t('package.readme.callout.important') + '\'',
67+
'--i18n-warning': '\'' + $t('package.readme.callout.warning') + '\'',
68+
'--i18n-caution': '\'' + $t('package.readme.callout.caution') + '\'',
69+
}" @click="handleClick" />
7670
</template>
7771

7872
<style scoped>
@@ -112,20 +106,25 @@ function handleClick(event: MouseEvent) {
112106
.readme :deep([data-level='1']) {
113107
font-size: 1.5rem;
114108
}
109+
115110
.readme :deep([data-level='2']) {
116111
font-size: 1.25rem;
117112
padding-bottom: 0.5rem;
118113
border-bottom: 1px solid var(--border);
119114
}
115+
120116
.readme :deep([data-level='3']) {
121117
font-size: 1.125rem;
122118
}
119+
123120
.readme :deep([data-level='4']) {
124121
font-size: 1rem;
125122
}
123+
126124
.readme :deep([data-level='5']) {
127125
font-size: 0.925rem;
128126
}
127+
129128
.readme :deep([data-level='6']) {
130129
font-size: 0.875rem;
131130
}
@@ -137,9 +136,11 @@ function handleClick(event: MouseEvent) {
137136
.readme :deep(a) {
138137
@apply underline-offset-[0.2rem] underline decoration-1 decoration-fg/30 font-mono text-fg transition-colors duration-200;
139138
}
139+
140140
.readme :deep(a:hover) {
141141
@apply decoration-accent text-accent;
142142
}
143+
143144
.readme :deep(a:focus-visible) {
144145
@apply decoration-accent text-accent;
145146
}
@@ -318,10 +319,12 @@ function handleClick(event: MouseEvent) {
318319
border-inline-start-color: var(--syntax-str);
319320
background: rgba(59, 130, 246, 0.05);
320321
}
322+
321323
.readme :deep(blockquote[data-callout='note']::before) {
322324
content: var(--i18n-note, 'Note');
323325
color: #3b82f6;
324326
}
327+
325328
.readme :deep(blockquote[data-callout='note']::after) {
326329
background-color: #3b82f6;
327330
-webkit-mask: icon('i-lucide:info') no-repeat;
@@ -333,10 +336,12 @@ function handleClick(event: MouseEvent) {
333336
border-inline-start-color: #22c55e;
334337
background: rgba(34, 197, 94, 0.05);
335338
}
339+
336340
.readme :deep(blockquote[data-callout='tip']::before) {
337341
content: var(--i18n-tip, 'Tip');
338342
color: #22c55e;
339343
}
344+
340345
.readme :deep(blockquote[data-callout='tip']::after) {
341346
background-color: #22c55e;
342347
-webkit-mask: icon('i-lucide:lightbulb') no-repeat;
@@ -348,10 +353,12 @@ function handleClick(event: MouseEvent) {
348353
border-inline-start-color: var(--syntax-fn);
349354
background: rgba(168, 85, 247, 0.05);
350355
}
356+
351357
.readme :deep(blockquote[data-callout='important']::before) {
352358
content: var(--i18n-important, 'Important');
353359
color: var(--syntax-fn);
354360
}
361+
355362
.readme :deep(blockquote[data-callout='important']::after) {
356363
background-color: var(--syntax-fn);
357364
-webkit-mask: icon('i-lucide:pin') no-repeat;
@@ -363,10 +370,12 @@ function handleClick(event: MouseEvent) {
363370
border-inline-start-color: #eab308;
364371
background: rgba(234, 179, 8, 0.05);
365372
}
373+
366374
.readme :deep(blockquote[data-callout='warning']::before) {
367375
content: var(--i18n-warning, 'Warning');
368376
color: #eab308;
369377
}
378+
370379
.readme :deep(blockquote[data-callout='warning']::after) {
371380
background-color: #eab308;
372381
-webkit-mask: icon('i-lucide:triangle-alert') no-repeat;
@@ -378,10 +387,12 @@ function handleClick(event: MouseEvent) {
378387
border-inline-start-color: #ef4444;
379388
background: rgba(239, 68, 68, 0.05);
380389
}
390+
381391
.readme :deep(blockquote[data-callout='caution']::before) {
382392
content: var(--i18n-caution, 'Caution');
383393
color: #ef4444;
384394
}
395+
385396
.readme :deep(blockquote[data-callout='caution']::after) {
386397
background-color: #ef4444;
387398
-webkit-mask: icon('i-lucide:circle-alert') no-repeat;
@@ -457,4 +468,18 @@ function handleClick(event: MouseEvent) {
457468
white-space: nowrap;
458469
border-width: 0;
459470
}
471+
472+
/* Details element */
473+
.readme :deep(details) {
474+
/**
475+
* same size as [data-level='5']
476+
*/
477+
font-size: 0.925rem;
478+
color: var(--fg-subtle);
479+
480+
summary {
481+
font-size: 1rem;
482+
color: var(--fg-muted);
483+
}
484+
}
460485
</style>

0 commit comments

Comments
 (0)