Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sparkle] Add tooltip on header #8667

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sparkle/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sparkle/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dust-tt/sparkle",
"version": "0.2.311",
"version": "0.2.312",
"scripts": {
"build": "rm -rf dist && npm run tailwind && npm run build:esm && npm run build:cjs",
"tailwind": "tailwindcss -i ./src/styles/tailwind.css -o dist/sparkle.css",
Expand Down
15 changes: 14 additions & 1 deletion sparkle/src/components/BarHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";

import { Tooltip } from "@sparkle/components/Tooltip";
import {
ArrowUpOnSquareIcon,
ChevronLeftIcon,
Expand All @@ -12,13 +13,15 @@ import { Button } from "./Button";

interface BarHeaderProps {
title: string;
tooltip?: string;
leftActions?: React.ReactNode;
rightActions?: React.ReactNode;
className?: string;
}

export function BarHeader({
title,
tooltip,
leftActions,
rightActions,
className = "",
Expand All @@ -39,7 +42,17 @@ export function BarHeader({
)}
>
{leftActions && <div className={buttonBarClasses}>{leftActions}</div>}
<div className={titleClasses}>{title}</div>
<div className={titleClasses}>
{tooltip ? (
<Tooltip
tooltipTriggerAsChild
trigger={<span>{title}</span>}
label={tooltip}
></Tooltip>
) : (
title
)}
</div>
{rightActions && <div className={buttonBarClasses}>{rightActions}</div>}
</div>
);
Expand Down
1 change: 1 addition & 0 deletions sparkle/src/stories/BarHeader.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export const BasicBarHeaderConversation = () => (
<div className="s-mt-16 s-h-full s-w-full">
<BarHeader
title="Knowledge Base"
tooltip="This is a tooltip"
rightActions={<BarHeader.ButtonBar variant="conversation" />}
/>
<div className="s-flex s-flex-col s-gap-16 s-overflow-auto">
Expand Down
Loading