From 5618570c10ce220eb87425c584140921196f6903 Mon Sep 17 00:00:00 2001 From: Oliwia Gowor Date: Thu, 7 Nov 2024 09:39:23 +0100 Subject: [PATCH] fix: fix default props & links in tables --- .../DynamicPageComponent.scss | 4 +++ .../components/GenericList/GenericList.js | 27 +++++++------------ .../components/GenericList/GenericList.scss | 4 +++ .../components/GenericList/components.js | 4 +-- src/shared/components/Link/Link.tsx | 5 ++-- 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/shared/components/DynamicPageComponent/DynamicPageComponent.scss b/src/shared/components/DynamicPageComponent/DynamicPageComponent.scss index 7baa6afe65..94f9751376 100644 --- a/src/shared/components/DynamicPageComponent/DynamicPageComponent.scss +++ b/src/shared/components/DynamicPageComponent/DynamicPageComponent.scss @@ -39,6 +39,10 @@ border-radius: 5px; } } + + &::part(fit-content) { + padding: 0; + } } .header-wrapper { diff --git a/src/shared/components/GenericList/GenericList.js b/src/shared/components/GenericList/GenericList.js index 459accec3a..adff766c65 100644 --- a/src/shared/components/GenericList/GenericList.js +++ b/src/shared/components/GenericList/GenericList.js @@ -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, @@ -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, @@ -394,7 +394,7 @@ export const GenericList = ({ headerActions={!headerActionsEmpty && headerActions} data-testid={testid} disableMargin - className={className} + className={`${className} ${disableMargin ? {} : 'sap-margin-small'}`} > handleRowClick(e), ); }} - columns={ + headerRow={ ( diff --git a/src/shared/components/Link/Link.tsx b/src/shared/components/Link/Link.tsx index c1de9dec3b..d04ccfe14c 100644 --- a/src/shared/components/Link/Link.tsx +++ b/src/shared/components/Link/Link.tsx @@ -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, @@ -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}