Skip to content

Commit 156101b

Browse files
committed
Add tooltip on header
1 parent bb20d57 commit 156101b

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

sparkle/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sparkle/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dust-tt/sparkle",
3-
"version": "0.2.311",
3+
"version": "0.2.312",
44
"scripts": {
55
"build": "rm -rf dist && npm run tailwind && npm run build:esm && npm run build:cjs",
66
"tailwind": "tailwindcss -i ./src/styles/tailwind.css -o dist/sparkle.css",

sparkle/src/components/BarHeader.tsx

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22

3+
import { Tooltip } from "@sparkle/components/Tooltip";
34
import {
45
ArrowUpOnSquareIcon,
56
ChevronLeftIcon,
@@ -12,13 +13,15 @@ import { Button } from "./Button";
1213

1314
interface BarHeaderProps {
1415
title: string;
16+
tooltip?: string;
1517
leftActions?: React.ReactNode;
1618
rightActions?: React.ReactNode;
1719
className?: string;
1820
}
1921

2022
export function BarHeader({
2123
title,
24+
tooltip,
2225
leftActions,
2326
rightActions,
2427
className = "",
@@ -39,7 +42,17 @@ export function BarHeader({
3942
)}
4043
>
4144
{leftActions && <div className={buttonBarClasses}>{leftActions}</div>}
42-
<div className={titleClasses}>{title}</div>
45+
<div className={titleClasses}>
46+
{tooltip ? (
47+
<Tooltip
48+
tooltipTriggerAsChild
49+
trigger={<span>{title}</span>}
50+
label={tooltip}
51+
></Tooltip>
52+
) : (
53+
title
54+
)}
55+
</div>
4356
{rightActions && <div className={buttonBarClasses}>{rightActions}</div>}
4457
</div>
4558
);

sparkle/src/stories/BarHeader.stories.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export const BasicBarHeaderConversation = () => (
146146
<div className="s-mt-16 s-h-full s-w-full">
147147
<BarHeader
148148
title="Knowledge Base"
149+
tooltip="This is a tooltip"
149150
rightActions={<BarHeader.ButtonBar variant="conversation" />}
150151
/>
151152
<div className="s-flex s-flex-col s-gap-16 s-overflow-auto">

0 commit comments

Comments
 (0)