fix(ui): add right alignment support for table columns using align prop
This commit is contained in:
@@ -78,6 +78,7 @@ const RolesPageClient = () => {
|
||||
label: '',
|
||||
sortable: false,
|
||||
noWrap: true,
|
||||
align: 'right',
|
||||
render: (role) => (
|
||||
<div className="flex items-center gap-2">
|
||||
<Button
|
||||
|
||||
@@ -74,6 +74,7 @@ const UsersPageClient = () => {
|
||||
label: '',
|
||||
sortable: false,
|
||||
noWrap: true,
|
||||
align: 'right',
|
||||
render: (user) => (
|
||||
<Button
|
||||
variant="secondary"
|
||||
|
||||
@@ -272,12 +272,12 @@ const Table = ({
|
||||
{columns.map((column) => (
|
||||
<th
|
||||
key={column.key}
|
||||
className={`${sizeClasses.header} ${column.headerAlign === 'right' ? 'text-right' : 'text-left'} text-[11px] font-medium text-neutral-500 dark:text-neutral-400 uppercase tracking-[0.04em] ${
|
||||
className={`${sizeClasses.header} ${column.align === 'right' || column.headerAlign === 'right' ? 'text-right' : 'text-left'} text-[11px] font-medium text-neutral-500 dark:text-neutral-400 uppercase tracking-[0.04em] ${
|
||||
column.sortable ? 'cursor-pointer hover:text-neutral-900 dark:hover:text-white transition-colors' : ''
|
||||
}`}
|
||||
onClick={column.sortable && onSort ? () => onSort(column.key) : undefined}
|
||||
>
|
||||
<div className={`flex items-center ${column.headerAlign === 'right' ? 'justify-end' : ''}`}>
|
||||
<div className={`flex items-center ${column.align === 'right' || column.headerAlign === 'right' ? 'justify-end' : ''}`}>
|
||||
{column.label}
|
||||
{column.sortable && onSort && <SortIcon column={column} />}
|
||||
</div>
|
||||
@@ -302,7 +302,7 @@ const Table = ({
|
||||
{...rowExtraProps}
|
||||
>
|
||||
{columns.map((column, colIdx) => (
|
||||
<td key={column.key} className={`${sizeClasses.cell} ${column.noWrap !== false ? '' : 'whitespace-nowrap'} group-hover:bg-neutral-50 dark:group-hover:bg-neutral-950 transition-colors ${isLast && colIdx === 0 ? 'rounded-bl-xl' : ''} ${isLast && colIdx === columns.length - 1 ? 'rounded-br-xl' : ''}`}>
|
||||
<td key={column.key} className={`${sizeClasses.cell} ${column.noWrap !== false ? '' : 'whitespace-nowrap'} ${column.align === 'right' ? 'text-right' : ''} group-hover:bg-neutral-50 dark:group-hover:bg-neutral-950 transition-colors ${isLast && colIdx === 0 ? 'rounded-bl-xl' : ''} ${isLast && colIdx === columns.length - 1 ? 'rounded-br-xl' : ''}`}>
|
||||
{renderCellContent(item, column)}
|
||||
</td>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user