Skip to content

Commit

Permalink
SIKKA-5849[closed]
Browse files Browse the repository at this point in the history
  • Loading branch information
zaaakher committed Dec 4, 2023
1 parent 31aa8ed commit 0d6f888
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @sikka/hawa

## 0.21.2

### Patch Changes

- Added `chip` prop to `Accordion` item [#SIKKA-5849](https://app.clickup.com/t/613523/SIKKA-5849)

## 0.21.1

### Patch Changes
Expand Down
12 changes: 11 additions & 1 deletion components/elements/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import * as React from "react";

import * as AccordionPrimitive from "@radix-ui/react-accordion";

import { Chip, ChipTypes } from "@elements/index";

import { cn } from "../util";

export type AccordionItemProps = {
trigger: string;
content: string;
disabled?: boolean;
chip?: ChipTypes;
};

type AccordionProps = {
Expand Down Expand Up @@ -62,7 +65,14 @@ const Accordion = React.forwardRef<
triggerclassNames
)}
>
{item.trigger}
<span
className={cn(
"hawa-flex hawa-flex-row",
item.chip && "hawa-gap-2"
)}
>
{item.trigger} {item.chip && <Chip {...item.chip} />}
</span>
</AccordionTrigger>
<AccordionContent
aria-disabled={item.disabled || false}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sikka/hawa",
"version": "0.21.1",
"version": "0.21.2",
"description": "Modern UI Kit made with Tailwind",
"author": {
"name": "Sikka Software",
Expand Down
29 changes: 18 additions & 11 deletions stories/ElementsStories/Accordion.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { ArgsTable, Story, Title } from "@storybook/blocks";
import type { Meta, StoryObj } from "@storybook/react";

import {
Accordion,
AccordionRoot,
AccordionContent,
AccordionItem,
AccordionTrigger,
AccordionItemProps,
AccordionItemProps
} from "../../components/elements";
import { ArgsTable, Story, Title } from "@storybook/blocks";
import { setLocale, t } from "../translations/i18n";

const meta = {
Expand All @@ -20,10 +21,10 @@ const meta = {
<h1>{"<Accordion/>"}</h1>
<ArgsTable />
</>
),
},
)
}
},
tags: ["autodocs"],
tags: ["autodocs"]
} satisfies Meta<typeof Accordion>;

export default meta;
Expand All @@ -33,12 +34,18 @@ const accordionData: AccordionItemProps[] = [
{
trigger: "Another Question",
content: "Here's another answer.",
disabled: true,
disabled: true
},
{
trigger: "Another Question",
content: "Here's another answer.",
chip: {
label: "soon"
}
},
{ trigger: "Another Question", content: "Here's another answer." },
{ trigger: "Another Question", content: "Here's another answer." },
{ trigger: "Another Question", content: "Here's another answer." },
{ trigger: "Another Question", content: "Here's another answer." },
{ trigger: "Another Question", content: "Here's another answer." }
];
const Template = (args: any, globals: any) => {
const locale = globals.globals?.locale === "ar" ? "ar" : "en";
Expand All @@ -52,7 +59,7 @@ const Template = (args: any, globals: any) => {
);
};
export const Default: Story = {
render: Template.bind({}),
render: Template.bind({})
};
export const SeparatedVariant: Story = {
render: (args: any, globals: any) => {
Expand All @@ -70,7 +77,7 @@ export const SeparatedVariant: Story = {
/>
</div>
);
},
}
};
export const CustomMade: Story = {
render: (args: any, globals: any) => {
Expand All @@ -90,5 +97,5 @@ export const CustomMade: Story = {
</AccordionItem>
</AccordionRoot>
);
},
}
};

0 comments on commit 0d6f888

Please sign in to comment.