Skip to content

Commit

Permalink
fix: table wrapperclassname
Browse files Browse the repository at this point in the history
  • Loading branch information
nahoc committed Oct 10, 2024
1 parent 570b14e commit bb7a5c5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ https://www.npmjs.com/package/@risc0/ui

| Statements | Branches | Functions | Lines |
| --------------------------- | ----------------------- | ------------------------- | ----------------- |
| ![Statements](https://img.shields.io/badge/statements-36.69%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-79.51%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-72%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-36.69%25-red.svg?style=flat) |
| ![Statements](https://img.shields.io/badge/statements-36.73%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-79.51%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-72%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-36.73%25-red.svg?style=flat) |
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@risc0/ui",
"version": "0.0.188",
"version": "0.0.189",
"private": false,
"sideEffects": false,
"type": "module",
Expand Down
12 changes: 7 additions & 5 deletions table.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { type HTMLAttributes, type TdHTMLAttributes, type ThHTMLAttributes, forwardRef } from "react";
import { cn } from "./cn";

const Table = forwardRef<HTMLTableElement, HTMLAttributes<HTMLTableElement>>(({ className, ...rest }, ref) => (
<div className="relative w-full overflow-auto">
<table ref={ref} className={cn("w-full caption-bottom text-sm", className)} {...rest} />
</div>
));
const Table = forwardRef<HTMLTableElement, HTMLAttributes<HTMLTableElement> & { wrapperClassName?: string }>(
({ wrapperClassName, className, ...rest }, ref) => (
<div className={cn("relative w-full overflow-auto", wrapperClassName)}>
<table ref={ref} className={cn("w-full caption-bottom text-sm", className)} {...rest} />
</div>
),
);

const TableHeader = forwardRef<HTMLTableSectionElement, HTMLAttributes<HTMLTableSectionElement>>(
({ className, ...rest }, ref) => <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...rest} />,
Expand Down

0 comments on commit bb7a5c5

Please sign in to comment.