preserve tooltip css
This commit is contained in:
1 parent
9fb7bacee6
commit
4580cb6179
3 files changed
+45
-26
No files matched your search
@@ -37,21 +37,22 @@
|
|||||||
|
|
||||||
.note {
|
.note {
|
||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
max-height: min(280px, 50vh);
|
|
||||||
overflow-y: auto;
|
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.noteFull {
|
.noteFull {
|
||||||
display: block;
|
display: -webkit-box;
|
||||||
|
overflow: hidden;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.noteText {
|
.noteText {
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
-webkit-line-clamp: 3;
|
-webkit-line-clamp: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.moreButton {
|
.moreButton {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
|
import { Button, Column, Text, Tooltip, TooltipTrigger, useTheme } from '@umami/react-zen';
|
||||||
|
import { isSameDay } from 'date-fns';
|
||||||
|
import { useMemo } from 'react';
|
||||||
import { IconLabel } from '@/components/common/IconLabel';
|
import { IconLabel } from '@/components/common/IconLabel';
|
||||||
import { useLocale, useMessages } from '@/components/hooks';
|
import { useLocale, useMessages } from '@/components/hooks';
|
||||||
import { Maximize } from '@/components/icons';
|
import { Maximize } from '@/components/icons';
|
||||||
import { getThemeColors } from '@/lib/colors';
|
import { getThemeColors } from '@/lib/colors';
|
||||||
import { formatDate } from '@/lib/date';
|
import { formatDate } from '@/lib/date';
|
||||||
import { Button, Column, Text, Tooltip, TooltipTrigger, useTheme } from '@umami/react-zen';
|
|
||||||
import { isSameDay } from 'date-fns';
|
|
||||||
import { useMemo } from 'react';
|
|
||||||
import styles from './ChartAnnotationMarkers.module.css';
|
import styles from './ChartAnnotationMarkers.module.css';
|
||||||
|
|
||||||
const MAX_TOOLTIP_ANNOTATIONS = 3;
|
const MAX_TOOLTIP_ANNOTATIONS = 3;
|
||||||
@@ -78,35 +78,41 @@ export function ChartAnnotationMarkers({
|
|||||||
padding="1"
|
padding="1"
|
||||||
borderRadius="md"
|
borderRadius="md"
|
||||||
className={styles.note}
|
className={styles.note}
|
||||||
style={{ backgroundColor: 'rgba(0,0,0,0.2)', color: 'white' }}
|
style={{
|
||||||
|
backgroundColor: 'rgba(0,0,0,0.8)',
|
||||||
|
borderRadius: '5.25px',
|
||||||
|
color: 'white',
|
||||||
|
gap: '8px',
|
||||||
|
padding: '12px',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{visibleAnnotations.map(annotation => (
|
{visibleAnnotations.map(annotation => (
|
||||||
<Column key={annotation.id} gap="1">
|
<Column key={annotation.id} gap="1">
|
||||||
<Text size="sm" weight="bold">
|
<Text
|
||||||
|
size="sm"
|
||||||
|
weight="bold"
|
||||||
|
style={{ fontSize: '12.25px', lineHeight: '17.5px' }}
|
||||||
|
>
|
||||||
{formatAnnotationDate(annotation, locale)}
|
{formatAnnotationDate(annotation, locale)}
|
||||||
</Text>
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
size="sm"
|
size="sm"
|
||||||
className={annotations.length === 1 ? styles.noteFull : styles.noteText}
|
className={annotations.length === 1 ? styles.noteFull : styles.noteText}
|
||||||
|
style={{ fontSize: '12.25px', lineHeight: '17.5px' }}
|
||||||
>
|
>
|
||||||
{annotation.label}
|
{annotation.label}
|
||||||
</Text>
|
</Text>
|
||||||
</Column>
|
</Column>
|
||||||
))}
|
))}
|
||||||
{annotations.length > 1 &&
|
{onMoreClick && (
|
||||||
(onMoreClick ? (
|
<Button
|
||||||
<Button
|
variant="quiet"
|
||||||
variant="quiet"
|
className={styles.moreButton}
|
||||||
className={styles.moreButton}
|
onPress={() => onMoreClick(annotations)}
|
||||||
onPress={() => onMoreClick(annotations)}
|
>
|
||||||
>
|
<IconLabel icon={<Maximize />}>{t(labels.view)}</IconLabel>
|
||||||
<IconLabel icon={<Maximize />}>{t(labels.view)}</IconLabel>
|
</Button>
|
||||||
</Button>
|
)}
|
||||||
) : (
|
|
||||||
<IconLabel icon={<Maximize />} style={{ opacity: 0.8 }}>
|
|
||||||
{t(labels.view)}
|
|
||||||
</IconLabel>
|
|
||||||
))}
|
|
||||||
</Column>
|
</Column>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
|
|||||||
@@ -16,12 +16,24 @@ export function ChartTooltip({
|
|||||||
gap="3"
|
gap="3"
|
||||||
padding="4"
|
padding="4"
|
||||||
borderRadius="md"
|
borderRadius="md"
|
||||||
style={{ backgroundColor: 'rgba(0,0,0,0.8)', color: 'white' }}
|
style={{
|
||||||
|
backgroundColor: 'rgba(0,0,0,0.8)',
|
||||||
|
borderRadius: '5.25px',
|
||||||
|
color: 'white',
|
||||||
|
gap: '10.5px',
|
||||||
|
padding: '14px',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{title && <Text size="sm">{title}</Text>}
|
{title && (
|
||||||
|
<Text size="sm" style={{ fontSize: '12.25px', lineHeight: '17.5px' }}>
|
||||||
|
{title}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
<Row alignItems="center">
|
<Row alignItems="center">
|
||||||
<StatusLight color={color}>
|
<StatusLight color={color}>
|
||||||
<Text size="sm">{value}</Text>
|
<Text size="sm" style={{ fontSize: '12.25px', lineHeight: '17.5px' }}>
|
||||||
|
{value}
|
||||||
|
</Text>
|
||||||
</StatusLight>
|
</StatusLight>
|
||||||
</Row>
|
</Row>
|
||||||
</Column>
|
</Column>
|
||||||
|
|||||||
Reference in new issue
Block a user