Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] chore(storage-browser) - add correct table cell truncation styling to text cells #5683

Draft
wants to merge 2 commits into
base: feat-storage-browser/main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ import { capitalize } from '@aws-amplify/ui';
import {
DataTable,
TABLE_DATA_BUTTON_CLASS,
// TABLE_DATA_TEXT_CLASS_NAME,
TABLE_HEADER_BUTTON_CLASS_NAME,
TABLE_HEADER_CLASS_NAME,
} from '../../../components/DataTable';
import { useControl } from '../../../context/controls';
import { useLocationsData } from '../../../context/actions';
import { LocationAccess } from '../../../context/types';
import { compareStrings } from '../../../context/controls/Table';
import { ButtonElement, IconElement } from '../../../context/elements';
import {
ButtonElement,
IconElement,
// SpanElement,
} from '../../../context/elements';

export type SortDirection = 'ascending' | 'descending' | 'none';

Expand Down Expand Up @@ -113,8 +118,14 @@ const getLocationsData = ({
</ButtonElement>
),
},
{ key: `td-type-${index}`, children: location.type },
{ key: `td-permission-${index}`, children: location.permission },
{
key: `td-type-${index}`,
children: location.type,
},
{
key: `td-permission-${index}`,
children: location.permission,
},
]);

return { columns, rows };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const TABLE_HEADER_CLASS_NAME = `${TABLE_CLASS_NAME}__header`;
export const TABLE_HEADER_BUTTON_CLASS_NAME = `${TABLE_CLASS_NAME}__header__button`;
export const TABLE_ROW_CLASS_NAME = `${TABLE_CLASS_NAME}__row`;
export const TABLE_DATA_CLASS_NAME = `${TABLE_CLASS_NAME}__data`;
export const TABLE_DATA_TEXT_CLASS_NAME = `${TABLE_CLASS_NAME}__data__text`;
calebpollman marked this conversation as resolved.
Show resolved Hide resolved
export const TABLE_DATA_BUTTON_CLASS = `${TABLE_CLASS_NAME}__data__button`;

export interface ColumnHeaderItemProps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ const TableHead = React.forwardRef<HTMLTableSectionElement, TableHeadProps>(

const TableData = React.forwardRef<HTMLTableCellElement, TableCellProps>(
function TableData(props, ref) {
return <_TableCell padding="xxxs" {...props} ref={ref} />;
return <_TableCell {...props} ref={ref} />;
}
);

Expand All @@ -185,7 +185,7 @@ const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(

const TableHeader = React.forwardRef<HTMLTableCellElement, TableHeadProps>(
function TableHeader(props, ref) {
return <_TableCell padding="xxxs" as="th" {...props} ref={ref} />;
return <_TableCell as="th" {...props} ref={ref} />;
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export {
ButtonElementProps,
MessageVariant,
PaginateVariant,
SpanElement,
StorageBrowserElements,
TableBodyElement,
TableDataElement,
Expand Down
18 changes: 13 additions & 5 deletions packages/react-storage/src/styles/storage-browser.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.storage-browser {
--storage-browser-gap-small: 0.375rem;
--storage-browser-gap-small: 0.3rem;
--storage-browser-gap: 0.6rem;
--storage-browser-status-error: hsl(0, 95%, 30%);
--storage-browser-status-success: hsl(130, 33%, 37%);
Expand Down Expand Up @@ -161,6 +161,7 @@
}

.storage-browser__table__header {
padding: var(--storage-browser-gap-small);
text-align: start;
}
.storage-browser__table__header__button {
Expand All @@ -169,17 +170,24 @@
align-items: center;
}

.storage-browser__table__data__text,
.storage-browser__table__data:not(:has(.storage-browser__table__data__button)),
.storage-browser__table__data__button {
display: inline-block;
width: 100%;
padding: var(--storage-browser-gap-small);
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
text-align: start;
}

.storage-browser__table__data:not(:has(.storage-browser__table__data__button)) {
padding: var(--storage-browser-gap);
}

.storage-browser__table__data__button {
display: inline-block;
width: 100%;
padding: var(--storage-browser-gap-small);
}

.storage-browser__table__data__icon,
.storage-browser__action-status {
vertical-align: middle;
Expand Down
Loading