Skip to content

Commit 75ce8fe

Browse files
authored
Merge pull request #110 from techniq/tooltip-theme-variant
[Tooltip] Change variant `light`/`dark` (default: `dark`) to `default` / `invert` and base on theme colors
2 parents d380d1a + fb33426 commit 75ce8fe

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

.changeset/soft-points-deliver.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"layerchart": patch
3+
---
4+
5+
[Tooltip] Change variant `light`/`dark` (default: `dark`) to `default` / `invert` and base on theme colors

packages/layerchart/src/lib/components/Tooltip.svelte

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
3333
export let contained: 'container' | false = 'container'; // TODO: Support 'window' using getBoundingClientRect()
3434
export let animate = true;
35-
export let variant: 'dark' | 'light' | 'none' = 'dark';
35+
export let variant: 'default' | 'invert' | 'none' = 'default';
3636
3737
export let header: ((data: any) => any) | undefined = undefined;
3838
@@ -159,13 +159,13 @@
159159
['[&_.value]:text-sm [&_.value]:tabular-nums'],
160160
],
161161
{
162-
dark: [
163-
'bg-gray-900/90 backdrop-filter backdrop-blur-[2px] text-white',
164-
'[&_.label]:text-white/75',
162+
default: [
163+
'bg-surface-100/90 dark:bg-surface-300/90 backdrop-filter backdrop-blur-[2px] text-surface-content',
164+
'[&_.label]:text-surface-content/75',
165165
],
166-
light: [
167-
'bg-white text-gray-800 border border-gray-500',
168-
'[&_.label]:text-surface-content/50',
166+
invert: [
167+
'bg-surface-content/90 backdrop-filter backdrop-blur-[2px] text-surface-100 border border-surface-content',
168+
'[&_.label]:text-surface-100/50',
169169
],
170170
none: '',
171171
}[variant],

packages/layerchart/src/routes/docs/components/Tooltip/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
</div>
179179
</Preview>
180180

181-
<h2>Light variant</h2>
181+
<h2>invert variant</h2>
182182

183183
<Preview data={dateSeries}>
184184
<div class="h-[300px] p-4 border rounded">
@@ -202,7 +202,7 @@
202202
<Area class="fill-primary/30" line={{ class: 'stroke-primary stroke-2' }} />
203203
<Highlight points lines />
204204
</Svg>
205-
<Tooltip variant="light" let:data>
205+
<Tooltip variant="invert" let:data>
206206
<div slot="header" class="font-semibold text-center" let:data>
207207
{format(data.date, 'eee, MMMM do')}
208208
</div>

0 commit comments

Comments
 (0)