Skip to content

Commit

Permalink
refactor(web): datatables
Browse files Browse the repository at this point in the history
  • Loading branch information
paularmstrong authored and blakeblackshear committed Feb 20, 2021
1 parent 96f87ca commit e50cc59
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion web/src/Events.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default function Events({ path: pathname } = {}) {
const end = new Date(parseInt(endTime * 1000, 10));
const ref = i === events.length - 1 ? lastCellRef : undefined;
return (
<Tr key={id} index={i}>
<Tr key={id}>
<Td className="w-40">
<a href={`/events/${id}`} ref={ref} data-start-time={startTime} data-reached-end={reachedEnd}>
<img
Expand Down
4 changes: 3 additions & 1 deletion web/src/components/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export default function Box({
}) {
const Element = href ? 'a' : 'div';

const typeClasses = elevated ? 'shadow-md hover:shadow-lg transition-shadow' : 'border border-gray-200';
const typeClasses = elevated
? 'shadow-md hover:shadow-lg transition-shadow'
: 'border border-gray-200 dark:border-gray-700';

return (
<div className={`bg-white dark:bg-gray-800 rounded-lg overflow-hidden ${typeClasses} ${className}`}>
Expand Down
14 changes: 10 additions & 4 deletions web/src/components/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,27 @@ export function Tfoot({ children, className = '' }) {
return <tfoot className={`${className}`}>{children}</tfoot>;
}

export function Tr({ children, className = '', index }) {
return <tr className={`${index % 2 ? 'bg-gray-200 dark:bg-gray-600' : ''} ${className}`}>{children}</tr>;
export function Tr({ children, className = '' }) {
return (
<tr
className={`border-b border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-800 ${className}`}
>
{children}
</tr>
);
}

export function Th({ children, className = '', colspan }) {
return (
<th className={`border-b-2 border-gray-400 p-1 md:p-2 text-left ${className}`} colspan={colspan}>
<th className={`border-b border-gray-400 p-2 px-1 lg:p-4 text-left ${className}`} colspan={colspan}>
{children}
</th>
);
}

export function Td({ children, className = '', colspan }) {
return (
<td className={`p-1 md:p-2 ${className}`} colspan={colspan}>
<td className={`p-2 px-1 lg:p-4 ${className}`} colspan={colspan}>
{children}
</td>
);
Expand Down

0 comments on commit e50cc59

Please sign in to comment.