Skip to content

Commit 1510c00

Browse files
committed
Dark theme updates to Callout component
1 parent 9448bf3 commit 1510c00

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

‎src/components/Callout/index.astro‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ const typeLabelMap = {
2121
const iconMap = {
2222
warning: 'warning',
2323
action: 'warning',
24-
info: 'info',
24+
info: 'info-circled',
2525
tip: 'lightbulb',
26-
note: 'info',
26+
note: 'info-circled',
2727
success: 'check',
2828
danger: 'warning',
2929
} as const
@@ -43,24 +43,32 @@ const typeAccentTextClassMap = {
4343
action: 'text-warning',
4444
info: 'text-info',
4545
tip: 'text-success',
46-
note: 'text-note',
46+
note: 'text-note-offset',
4747
success: 'text-success',
4848
danger: 'text-danger',
4949
} as const
5050
51+
const typeBodyTextClassMap = {
52+
warning: 'text-content',
53+
action: 'text-content',
54+
info: 'text-content',
55+
tip: 'text-content',
56+
note: 'text-note',
57+
success: 'text-content',
58+
danger: 'text-content',
59+
} as const
60+
5161
const icon = iconMap[type] ?? iconMap.info
5262
const typeLabel = typeLabelMap[type] ?? typeLabelMap.info
5363
const typeLabelUpper = typeLabel.toUpperCase()
5464
5565
const containerClasses = typeContainerClassMap[type] ?? typeContainerClassMap.info
5666
const accentTextClasses = typeAccentTextClassMap[type] ?? typeAccentTextClassMap.info
67+
const bodyTextClasses = typeBodyTextClassMap[type] ?? typeBodyTextClassMap.info
68+
const iconColor = accentTextClasses.startsWith('text-') ? accentTextClasses.slice(5) : 'inherit'
5769
---
5870

5971
<style>
60-
.callout__icon :global(svg) {
61-
fill: currentcolor;
62-
}
63-
6472
/* Spacing for nested elements */
6573
.callout__content > :not(.sr-only) + :not(.sr-only) {
6674
margin-top: 2rem;
@@ -90,7 +98,7 @@ const accentTextClasses = typeAccentTextClassMap[type] ?? typeAccentTextClassMap
9098
'-translate-y-0.5',
9199
]}
92100
>
93-
<Icon icon={icon} size={20} color="inherit" />
101+
<Icon icon={icon} size={5} color={iconColor} />
94102
</div>
95103
<div
96104
class:list={[
@@ -106,7 +114,7 @@ const accentTextClasses = typeAccentTextClassMap[type] ?? typeAccentTextClassMap
106114
</div>
107115
</div>
108116

109-
<div class="callout__content">
117+
<div class:list={[bodyTextClasses, 'callout__content']}>
110118
<span class="sr-only">{typeLabel} callout:</span>
111119
<slot />
112120
</div>

0 commit comments

Comments
 (0)