-
Notifications
You must be signed in to change notification settings - Fork 831
/
nested-tooltip.tsx
59 lines (57 loc) · 1.71 KB
/
nested-tooltip.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import * as React from 'react';
import {StatefulTooltip} from 'baseui/tooltip';
import {useStyletron} from 'baseui';
import Link from 'next/link';
const NestedTooltip: React.FC<{name: string; nestedName: string}> = ({
name,
nestedName,
}) => {
const [css, theme] = useStyletron();
return (
<StatefulTooltip
content={() => (
<div
className={css({
padding: theme.sizing.scale600,
maxWidth: '400px',
})}
>
<p>
<b>{nestedName}</b> is a nested override of <b>{name}</b>. It means
that {name} component is using another base web component{' '}
{nestedName} as its sub-component.
</p>
<p>
Since {nestedName} has its own set of overrides, you have to target
nested sub-component to change relevant styles. You can utilize this
interactive playground and see the resulting code bellow.
</p>
<p>
<Link href="/guides/understanding-overrides#override-nested-components">
<a
className={css({color: theme.colors.primaryB})}
href="/guides/understanding-overrides#override-nested-components"
>
Learn more about nested overrides.
</a>
</Link>
</p>
</div>
)}
returnFocus
showArrow
>
<span
className={css({
marginLeft: theme.sizing.scale400,
color: theme.colors.accent,
borderBottom: `1px ${theme.colors.accent} dashed`,
...theme.typography.LabelXSmall,
})}
>
nested
</span>
</StatefulTooltip>
);
};
export default NestedTooltip;