Skip to content

Commit

Permalink
fix: fix default props & links in tables
Browse files Browse the repository at this point in the history
  • Loading branch information
OliwiaGowor committed Nov 7, 2024
1 parent a6c5967 commit 5618570
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
border-radius: 5px;
}
}

&::part(fit-content) {
padding: 0;
}
}

.header-wrapper {
Expand Down
27 changes: 9 additions & 18 deletions src/shared/components/GenericList/GenericList.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import React, { useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useRecoilState, useRecoilValue } from 'recoil';
import { Table, TableCell, TableRow } from '@ui5/webcomponents-react';
import { Table } from '@ui5/webcomponents-react';
import { useNavigate } from 'react-router-dom';
import {
BodyFallback,
Expand Down Expand Up @@ -45,19 +45,19 @@ const defaultSearch = {
};

export const GenericList = ({
entries,
actions,
entries = [],
actions = [],
extraHeaderContent,
title,
headerRenderer,
rowRenderer,
testid,
serverDataError,
serverDataLoading,
serverDataError = null,
serverDataLoading = false,
pagination,
sortBy,
notFoundMessage,
searchSettings,
notFoundMessage = 'components.generic-list.messages.not-found',
searchSettings = defaultSearch,
disableMargin,
emptyListProps = null,
columnLayout = null,
Expand Down Expand Up @@ -394,7 +394,7 @@ export const GenericList = ({
headerActions={!headerActionsEmpty && headerActions}
data-testid={testid}
disableMargin
className={className}
className={`${className} ${disableMargin ? {} : 'sap-margin-small'}`}
>
<Table
className={`ui5-generic-list ${
Expand All @@ -411,7 +411,7 @@ export const GenericList = ({
() => handleRowClick(e),
);
}}
columns={
headerRow={
<HeaderRenderer
actions={actions}
headerRenderer={headerRenderer}
Expand Down Expand Up @@ -482,12 +482,3 @@ GenericList.propTypes = {
noHideFields: PropTypes.arrayOf(PropTypes.string),
customRowClick: PropTypes.func,
};

GenericList.defaultProps = {
entries: [],
actions: [],
serverDataError: null,
serverDataLoading: false,
notFoundMessage: 'components.generic-list.messages.not-found',
searchSettings: defaultSearch,
};
4 changes: 4 additions & 0 deletions src/shared/components/GenericList/GenericList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
ui5-table-row:last-of-type {
border-bottom: none;
}

p {
margin: 0;
}
}

.cursor-pointer {
Expand Down
4 changes: 1 addition & 3 deletions src/shared/components/GenericList/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import {
Icon,
Text,
TableCell,
TableColumn,
TableRow,
TableHeaderRow,
TableHeaderCell,
} from '@ui5/webcomponents-react';
import ListActions from 'shared/components/ListActions/ListActions';

import ListActions from 'shared/components/ListActions/ListActions';

export const BodyFallback = ({ children }) => (
<TableRow>
<TableCell style={{ gridColumn: '1 / -1' }}>
Expand Down
5 changes: 3 additions & 2 deletions src/shared/components/Link/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export const Link = ({
const setLayout = useSetRecoilState(columnLayoutState);
const navigate = useNavigate();

function handleOnlick(resetLayout: any, url: any) {
function handleOnlick(resetLayout: any, url: any, e: any) {
e.stopPropagation();
if (resetLayout)
setLayout({
midColumn: null,
Expand All @@ -42,7 +43,7 @@ export const Link = ({
design={design}
className={className}
data-testid={dataTestId}
onClick={() => (onClick ? onClick() : handleOnlick(resetLayout, url))}
onClick={e => (onClick ? onClick() : handleOnlick(resetLayout, url, e))}
>
{children}
</UI5Link>
Expand Down

0 comments on commit 5618570

Please sign in to comment.