diff --git a/src/components/Tracker/Tracker.tsx b/src/components/Tracker/Tracker.tsx index b430879..aabeb7d 100644 --- a/src/components/Tracker/Tracker.tsx +++ b/src/components/Tracker/Tracker.tsx @@ -1,4 +1,4 @@ -// Tremor Raw Tracker [v0.0.1] +// Tremor Raw Tracker [v0.1.0] import React from "react" import * as HoverCardPrimitives from "@radix-ui/react-hover-card" @@ -9,15 +9,16 @@ interface TrackerBlockProps { key?: string | number color?: string tooltip?: string + hoverEffect?: boolean + defaultBackgroundColor?: string } const Block = ({ color, tooltip, defaultBackgroundColor, -}: TrackerBlockProps & { - defaultBackgroundColor?: string -}) => { + hoverEffect, +}: TrackerBlockProps) => { const [open, setOpen] = React.useState(false) return ( setOpen(true)} asChild> -
+
+
+
{ data: TrackerBlockProps[] defaultBackgroundColor?: string + hoverEffect?: boolean } const Tracker = React.forwardRef( @@ -67,6 +72,7 @@ const Tracker = React.forwardRef( data = [], defaultBackgroundColor = "bg-gray-400 dark:bg-gray-400", className, + hoverEffect, ...props }, forwardedRef, @@ -74,16 +80,14 @@ const Tracker = React.forwardRef( return (
{data.map((props, index) => ( ))} @@ -92,6 +96,6 @@ const Tracker = React.forwardRef( }, ) -Block.displayName = "Tracker" +Tracker.displayName = "Tracker" export { Tracker, type TrackerBlockProps } diff --git a/src/components/Tracker/changelog.md b/src/components/Tracker/changelog.md index 4d2537e..9e3e2a4 100644 --- a/src/components/Tracker/changelog.md +++ b/src/components/Tracker/changelog.md @@ -1,5 +1,13 @@ # Tremor Raw Tracker Changelog +## 0.1.0 + +### Changes + +- Feat: Hover effect prop +- Fix: Smooth transition between hover cards +- Fix: Switched padding between bars from gap to px. + ## 0.0.1 ### Changes diff --git a/src/components/Tracker/tracker.spec.ts b/src/components/Tracker/tracker.spec.ts index f9f8096..3f1ec97 100644 --- a/src/components/Tracker/tracker.spec.ts +++ b/src/components/Tracker/tracker.spec.ts @@ -23,7 +23,7 @@ test.describe("Expect tracker default", () => { await expect( page .frameLocator('iframe[title="storybook-preview-iframe"]') - .locator(".h-full") + .locator(".size-full > .size-full") .first(), ).toBeVisible() }) @@ -39,12 +39,13 @@ test.describe("Expect tracker default", () => { await expect( page .frameLocator('iframe[title="storybook-preview-iframe"]') - .locator(".h-full") + .locator(".size-full > .size-full") .first(), ).toBeVisible() + page page .frameLocator('iframe[title="storybook-preview-iframe"]') - .locator(".h-full") + .locator(".size-full > .size-full") .first() .hover() await expect( diff --git a/src/components/Tracker/tracker.stories.tsx b/src/components/Tracker/tracker.stories.tsx index 687efb9..374ab83 100644 --- a/src/components/Tracker/tracker.stories.tsx +++ b/src/components/Tracker/tracker.stories.tsx @@ -3,60 +3,60 @@ import type { Meta, StoryObj } from "@storybook/react" import { Tracker, TrackerBlockProps } from "./Tracker" const data: TrackerBlockProps[] = [ - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-red-600", tooltip: "Error" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-red-600", tooltip: "Error" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-yellow-600", tooltip: "Warn" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-red-600 dark:bg-red-500", tooltip: "Error" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-red-600 dark:bg-red-500", tooltip: "Error" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-yellow-600 dark:bg-yellow-500", tooltip: "Warn" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, { tooltip: "Tracker Info" }, { tooltip: "Tracker Info" }, { tooltip: "Tracker Info" }, @@ -64,35 +64,35 @@ const data: TrackerBlockProps[] = [ { tooltip: "Tracker Info" }, { tooltip: "Tracker Info" }, { tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-yellow-600", tooltip: "Warn" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-red-600", tooltip: "Error" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, - { color: "bg-emerald-600", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-yellow-600 dark:bg-yellow-500", tooltip: "Warn" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-red-600 dark:bg-red-500", tooltip: "Error" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, + { color: "bg-emerald-600 dark:bg-emerald-500", tooltip: "Tracker Info" }, ] const meta: Meta = { @@ -111,6 +111,14 @@ type Story = StoryObj export const Default: Story = {} +export const WithHoverEffect: Story = { + args: { + hoverEffect: true, + className: "mt-56", + data: data.slice(0, 40), + }, +} + export const Breakpoints: Story = { render: () => ( <>