Skip to content

Commit

Permalink
Fixed extra border in DataTable + cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
zaaakher committed Oct 12, 2023
1 parent 1aabb8a commit f0ca467
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const preview: Preview = {
"Introduction",
"Cards",
["Container"],
"Input",
"Inputs",
"Tables",
"Loading",
"Button",
"Cards",
Expand Down
9 changes: 6 additions & 3 deletions components/elements/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import { Skeleton } from "./Skeleton";
import { Button } from "./Button";
import { cn } from "../util";



type DataTableProps<DataProps = {}> = {
direction?: "rtl" | "ltr";
columns: ColumnDef<DataProps>[];
Expand Down Expand Up @@ -168,6 +166,7 @@ export const DataTable = <DataProps extends {}>({
let isSortable = header.column.columnDef.meta?.sortable;
return (
<TableHead
dir={props.direction}
condensed={props.condensed}
clickable={isSortable}
key={header.id}
Expand All @@ -193,7 +192,11 @@ export const DataTable = <DataProps extends {}>({
data-state={row.getIsSelected() && "selected"}
>
{row.getVisibleCells().map((cell) => (
<TableCell condensed={props.condensed} key={cell.id}>
<TableCell
dir={props.direction}
condensed={props.condensed}
key={cell.id}
>
{flexRender(
cell.column.columnDef.cell,
cell.getContext()
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.7.10",
"version": "0.7.11",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
Expand Down
3 changes: 2 additions & 1 deletion stories/ElementsStories/DataTable.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { setLocale, t } from "../translations/i18n";
import { ColumnDef } from "@tanstack/react-table";
import { useEffect, useState } from "react";
const meta = {
title: "Elements/DataTable",
title: "Elements/Tables/Data Table",
component: DataTable,
parameters: {
// layout: "centered",
Expand Down Expand Up @@ -426,6 +426,7 @@ const Template = (args: any, globals: any) => {
defaultSort="share_price"
columns={companiesColumns}
// data={[]}

data={companiesData}
condensed
direction={locale === "ar" ? "rtl" : "ltr"}
Expand Down
7 changes: 5 additions & 2 deletions stories/ElementsStories/Table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { ArgsTable, Story, Title } from "@storybook/blocks";
import { setLocale, t } from "../translations/i18n";

const meta = {
title: "Elements/Table",
title: "Elements/Tables/Simple Table",

component: Table,
parameters: {
// layout: "centered",
Expand Down Expand Up @@ -38,7 +39,9 @@ const Template = (args: any, globals: any) => {
columns={[
{ header: "Project", accessorKey: "project" },
{ header: "Version", accessorKey: "version" },
// { header: "Version", accessorKey: "version" },
{ header: "Version", accessorKey: "version" },
{ header: "Version", accessorKey: "version" },
{ header: "Version", accessorKey: "version" },
]}
data={[
{ project: "Hawa", version: "0.4.8" },
Expand Down

0 comments on commit f0ca467

Please sign in to comment.