Skip to content

Commit

Permalink
Updating Tab to fit Figma (#2862)
Browse files Browse the repository at this point in the history
Co-authored-by: édouard wautier <[email protected]>
  • Loading branch information
Duncid and édouard wautier authored Dec 13, 2023
1 parent 929d776 commit 1b99ff6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 11 deletions.
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.54",
"version": "0.2.55",
"scripts": {
"build": "rm -rf dist && rollup -c",
"build:with-tw-base": "rollup -c --environment INCLUDE_TW_BASE:true",
Expand Down
5 changes: 2 additions & 3 deletions sparkle/src/components/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ export function Tab({ tabs, onTabClick, className = "" }: TabProps) {
: iconClasses.default;

const finalTabClasses = classNames(
"s-group s-justify-center s-flex s-text-sm s-font-semibold s-px-4 s-py-3 s-transition-all ease-out s-duration-400 s-whitespace-nowrap s-select-none s-border-b-2",
"s-group s-justify-center s-flex s-text-sm s-font-semibold s-py-3 s-transition-all ease-out s-duration-400 s-whitespace-nowrap s-select-none s-border-b-2",
tab.icon ? " s-pr-5 s-pl-4" : " s-px-5",
"s-group s-justify-center s-flex s-text-sm s-font-semibold s-py-2.5 s-transition-all ease-out s-duration-400 s-whitespace-nowrap s-select-none s-border-b-2",
tab.icon ? (tab.hideLabel ? "s-px-3" : "s-pr-3.5 s-pl-2.5") : "s-px-3",
tabStateClasses.base,
tabStateClasses.hover,
tabStateClasses.dark.base,
Expand Down
43 changes: 38 additions & 5 deletions sparkle/src/stories/Tab.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Meta, StoryObj } from "@storybook/react";
import React from "react";

import { Tab } from "../index_with_tw_base";
import { RobotIcon, Tab } from "../index_with_tw_base";
import {
ChatBubbleBottomCenterTextIcon,
Cog6ToothIcon,
TestTubeIcon,
} from "../index_with_tw_base";

const meta = {
Expand All @@ -15,19 +15,52 @@ const meta = {
export default meta;
type Story = StoryObj<typeof meta>;

export const ButtonExamples = () => (
<div className="s-w-[320px]">
<Tab
tabs={[
{
label: "Conversations",
current: true,
icon: ChatBubbleBottomCenterTextIcon,
sizing: "hug",
},
{
label: "Assistants",
current: false,
icon: RobotIcon,
sizing: "hug",
hasSeparator: true,
},
{
label: "Settings",
hideLabel: true,
current: false,
icon: Cog6ToothIcon,
},
]}
onTabClick={(tabName, event) => {
// add logic here
event.preventDefault();
console.log(tabName);
}}
/>
</div>
);

export const TabNavigation: Story = {
args: {
tabs: [
{
label: "Assistant",
label: "Conversations",
current: true,
icon: ChatBubbleBottomCenterTextIcon,
sizing: "hug",
},
{
label: "Lab",
label: "Assistants",
current: false,
icon: TestTubeIcon,
icon: RobotIcon,
sizing: "hug",
hasSeparator: true,
},
Expand Down

0 comments on commit 1b99ff6

Please sign in to comment.