@ducor/react
Version:
admin template ui interface
43 lines (42 loc) • 1.6 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { twJoin } from "tailwind-merge";
// Table component with static properties
var Table = function (_a) {
var isLoading = _a.isLoading, children = _a.children;
if (isLoading) {
return (_jsx("div", { className: 'flex items-center justify-center', children: _jsx("div", { className: 'animate-spin rounded-full h-20 w-20 border-t-2 border-b-2 border-gray-900' }) }));
}
return (_jsx("table", { className: 'w-full divide-y divide-gray-200 border my-4', children: children }));
};
// Thead component
var TableThead = function (_a) {
var children = _a.children;
return (_jsx("thead", { className: 'bg-white', children: children }));
};
// Tbody component
var TableTbody = function (_a) {
var children = _a.children;
return (_jsx("tbody", { className: 'bg-white divide-y divide-gray-200', children: children }));
};
// Th component
var TableTh = function (_a) {
var children = _a.children;
return (_jsx("th", { className: 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase', children: children }));
};
// Tr component
var TableTr = function (_a) {
var children = _a.children;
return (_jsx("tr", { children: children }));
};
// Td component
var TableTd = function (_a) {
var children = _a.children, className = _a.className;
return (_jsx("td", { className: twJoin("px-6 py-4 whitespace-nowrap", className), children: children }));
};
export default Object.assign(Table, {
Thead: TableThead,
Tbody: TableTbody,
Th: TableTh,
Tr: TableTr,
Td: TableTd,
});