From 0ef9aeb029221d7c60df414e1e39f155f656c51d Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Thu, 2 Dec 2021 15:14:35 +0530 Subject: [PATCH] Style : Changing some styles on explore page. (#1515) * Style : Changing some styles on explore page. * Move PageContainerV1 from exploreComponent to ExplorePageComponent. --- .../components/Explore/Explore.component.tsx | 36 ++++++------- .../common/facetfilter/FilterContainer.tsx | 11 +--- .../table-data-card/TableDataCardBody.tsx | 8 ++- .../pages/explore/ExplorePage.component.tsx | 51 ++++++++++--------- .../main/resources/ui/src/styles/x-master.css | 24 +++++++++ .../resources/ui/src/utils/CommonUtils.tsx | 17 +++++-- .../src/main/resources/ui/tailwind.config.js | 2 + 7 files changed, 90 insertions(+), 59 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Explore/Explore.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Explore/Explore.component.tsx index 6f9e5a65d2f..af02099a8e8 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Explore/Explore.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Explore/Explore.component.tsx @@ -19,7 +19,13 @@ import { FormatedTableData, SearchResponse, } from 'Models'; -import React, { useCallback, useEffect, useRef, useState } from 'react'; +import React, { + Fragment, + useCallback, + useEffect, + useRef, + useState, +} from 'react'; import { useHistory, useLocation } from 'react-router-dom'; import { Button } from '../../components/buttons/Button/Button'; import ErrorPlaceHolderES from '../../components/common/error-with-placeholder/ErrorPlaceHolderES'; @@ -51,7 +57,6 @@ import { getCountBadge } from '../../utils/CommonUtils'; import { getFilterString } from '../../utils/FilterUtils'; import { dropdownIcon as DropDownIcon } from '../../utils/svgconstant'; import SVGIcons from '../../utils/SvgUtils'; -import PageContainerV1 from '../containers/PageContainerV1'; import PageLayout from '../containers/PageLayout'; import { ExploreProps } from './explore.interface'; @@ -344,18 +349,18 @@ const Explore: React.FC = ({ }); }; - const getTabCount = (index: string, className = '') => { + const getTabCount = (index: string, isActive: boolean, className = '') => { switch (index) { case SearchIndex.TABLE: - return getCountBadge(tabCounts.table, className); + return getCountBadge(tabCounts.table, className, isActive); case SearchIndex.TOPIC: - return getCountBadge(tabCounts.topic, className); + return getCountBadge(tabCounts.topic, className, isActive); case SearchIndex.DASHBOARD: - return getCountBadge(tabCounts.dashboard, className); + return getCountBadge(tabCounts.dashboard, className, isActive); case SearchIndex.PIPELINE: - return getCountBadge(tabCounts.pipeline, className); + return getCountBadge(tabCounts.pipeline, className, isActive); case SearchIndex.DBT_MODEL: - return getCountBadge(tabCounts.dbtModel, className); + return getCountBadge(tabCounts.dbtModel, className, isActive); default: return getCountBadge(); } @@ -394,16 +399,7 @@ const Explore: React.FC = ({ icon={tabDetail.icon} /> {tabDetail.label} - {getTabCount( - tabDetail.index, - classNames( - { 'tw-bg-tag': tabDetail.tab !== currentTab }, - { - 'tw-bg-primary tw-text-white tw-border-none': - tabDetail.tab === currentTab, - } - ) - )} + {getTabCount(tabDetail.index, tabDetail.tab === currentTab)} ))} @@ -509,7 +505,7 @@ const Explore: React.FC = ({ }; return ( - + {!connectionError && getTabs()} = ({ /> )} - + ); }; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/facetfilter/FilterContainer.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/facetfilter/FilterContainer.tsx index 71fb24d08a4..3a597cad6c8 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/facetfilter/FilterContainer.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/facetfilter/FilterContainer.tsx @@ -49,16 +49,7 @@ const FilterContainer: FunctionComponent = ({ {name.startsWith('Tier.Tier') ? name.split('.')[1] : name} - {getCountBadge( - count, - classNames( - 'tw-text-center tw-py-0 tw-px-0', - { 'tw-bg-tag': !isSelected }, - { - 'tw-bg-primary tw-text-white tw-border-none': isSelected, - } - ) - )} + {getCountBadge(count, classNames('tw-py-0 tw-px-0'), isSelected)} ); }; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/table-data-card/TableDataCardBody.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/table-data-card/TableDataCardBody.tsx index da82d156481..7ce1763bf65 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/table-data-card/TableDataCardBody.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/table-data-card/TableDataCardBody.tsx @@ -101,8 +101,12 @@ const TableDataCardBody: FunctionComponent = ({ {Boolean(tags?.length) && (

-
- +
+
{tags?.map((tag, index) => ( { {isLoading || isLoadingForData ? ( ) : ( - + + + )} ); diff --git a/openmetadata-ui/src/main/resources/ui/src/styles/x-master.css b/openmetadata-ui/src/main/resources/ui/src/styles/x-master.css index b145e9c65e4..382d6d9b70d 100644 --- a/openmetadata-ui/src/main/resources/ui/src/styles/x-master.css +++ b/openmetadata-ui/src/main/resources/ui/src/styles/x-master.css @@ -751,8 +751,32 @@ body .profiler-graph .recharts-active-dot circle { } #center { grid-area: centerarea; + overflow-y: auto; } +/* Hide scrollbar for Chrome, Safari and Opera */ +/* #center::-webkit-scrollbar, +#left-panel::-webkit-scrollbar, +#right-panel::-webkit-scrollbar { + display: none; + width: 4px; +} */ +/* #center::-webkit-scrollbar-track { + background: #f8f9fa; +} +#center::-webkit-scrollbar-thumb { + background: #aaa; + border-radius: 12px; +} */ + +/* Hide scrollbar for IE, Edge and Firefox */ +/* #center, +#left-panel, +#right-panel { + -ms-overflow-style: none; + scrollbar-width: 4px; +} */ + .page-layout-container { display: grid; grid-template-columns: 256px auto 256px; diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.tsx index cb9a025b08f..607a3ff90b5 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.tsx @@ -12,7 +12,7 @@ */ import classNames from 'classnames'; -import { isEmpty } from 'lodash'; +import { isEmpty, isUndefined } from 'lodash'; import { RecentlySearchData, RecentlyViewed, @@ -129,11 +129,22 @@ export const getTabClasses = ( return 'tw-gh-tabs' + (activeTab === tab ? ' active' : ''); }; -export const getCountBadge = (count = 0, className = '') => { +export const getCountBadge = ( + count = 0, + className = '', + isActive?: boolean +) => { + const clsBG = isUndefined(isActive) + ? '' + : isActive + ? 'tw-bg-primary tw-text-white tw-border-none' + : 'tw-bg-badge'; + return ( {count} diff --git a/openmetadata-ui/src/main/resources/ui/tailwind.config.js b/openmetadata-ui/src/main/resources/ui/tailwind.config.js index 610caae5562..272173d0aca 100644 --- a/openmetadata-ui/src/main/resources/ui/tailwind.config.js +++ b/openmetadata-ui/src/main/resources/ui/tailwind.config.js @@ -40,6 +40,7 @@ const statusQueued = '#777777'; const bodyBG = '#F8F9FA'; const bodyHoverBG = '#F9F8FD'; const tagBG = '#EEEAF8'; +const badgeBG = '#D5D8DC'; const primaryBG = '#7147E840'; // 'rgba(113, 71, 232, 0.25)'; const backdropBG = '#302E36'; @@ -93,6 +94,7 @@ module.exports = { 'body-main': bodyBG, 'body-hover': bodyHoverBG, tag: tagBG, + badge: badgeBG, success: success, error: error, warning: warning,