Skip to content
Merged
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
11 changes: 11 additions & 0 deletions src/components/ClusterRow/ClusterRow.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.qp-cluster-row {
width: 100%;
padding: 0 var(--g-spacing-3) 0 var(--g-spacing-4);
box-sizing: border-box;
cursor: pointer;

&__title {
flex-grow: 1;
min-width: 0;
}
}
1 change: 1 addition & 0 deletions src/components/ClusterRow/ClusterRow.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {FC} from 'react';
import {Avatar, Flex, Text} from '@gravity-ui/uikit';
import cn from 'bem-cn-lite';
import './ClusterRow.scss';
import {NavigationCluster} from '../../types/navigation';

const block = cn('qp-cluster-row');
Expand Down
2 changes: 2 additions & 0 deletions src/components/FieldsSearchToolbar/FieldsSearchToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function FieldsSearchToolbar<K extends string = string>({

return (
<SearchWithButtons
gap={2}
value={search}
placeholder={searchPlaceholder}
onUpdate={onSearchUpdate}
Expand All @@ -36,6 +37,7 @@ export function FieldsSearchToolbar<K extends string = string>({
? [
<FieldsSelector<K>
key="fields-selector"
buttonView="flat"
fields={fields}
value={visibleFields}
onChange={onVisibleFieldsChange}
Expand Down
12 changes: 10 additions & 2 deletions src/components/FieldsSelector/FieldsSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {ReactNode, useState} from 'react';
import {Button, Flex, Icon, Popup, Text} from '@gravity-ui/uikit';
import {Button, type ButtonProps, Flex, Icon, Popup, Text} from '@gravity-ui/uikit';
import GearIcon from '@gravity-ui/icons/svgs/gear.svg';
import CheckIcon from '@gravity-ui/icons/svgs/check.svg';
import {useToggle} from '../../helpers/useToggle';
Expand All @@ -17,6 +17,7 @@ export type FieldsSelectorProps<K extends string = string> = {
value: K[];
onChange: (value: K[]) => void;
buttonLabel?: string;
buttonView?: ButtonProps['view'];
};

const block = cn('qp-fields-selector');
Expand All @@ -26,6 +27,7 @@ export const FieldsSelector = <K extends string = string>({
value,
onChange,
buttonLabel = i18n('action_configure-visible-fields'),
buttonView = 'normal',
}: FieldsSelectorProps<K>) => {
const [buttonElement, setButtonElement] = useState<HTMLButtonElement | null>(null);
const [open, toggleOpen] = useToggle(false);
Expand All @@ -37,7 +39,13 @@ export const FieldsSelector = <K extends string = string>({

return (
<>
<Button ref={setButtonElement} onClick={toggleOpen} aria-label={buttonLabel}>
<Button
view={buttonView}
size="m"
ref={setButtonElement}
onClick={toggleOpen}
aria-label={buttonLabel}
>
<Icon data={GearIcon} size={16} />
</Button>
<Popup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import React from 'react';
import {Button, Flex} from '@gravity-ui/uikit';
import {Button, type ButtonProps, Flex} from '@gravity-ui/uikit';
import type {NavigationAction} from '../../types/navigation';

export type NavigationActionButtonsProps<TArg> = {
actions?: Array<NavigationAction<TArg>>;
arg: TArg;
className?: string;
buttonClassName?: string;
size?: ButtonProps['size'];
};

export function NavigationActionButtons<TArg>({
actions,
arg,
className,
buttonClassName,
size = 's',
}: NavigationActionButtonsProps<TArg>) {
const visibleActions = actions?.filter((action) => !action.hidden) ?? [];

Expand All @@ -27,7 +29,7 @@ export function NavigationActionButtons<TArg>({
<Button
key={action.id}
view="flat"
size="s"
size={size}
disabled={action.disabled}
title={action.title}
aria-label={action.title}
Expand Down
16 changes: 16 additions & 0 deletions src/components/NavigationItemRow/NavigationItemRow.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.qp-navigation-item-row {
width: 100%;
padding: 0 var(--g-spacing-3) 0 var(--g-spacing-4);
box-sizing: border-box;
cursor: pointer;

&__title {
flex-grow: 1;
min-width: 0;
}

&_disabled {
color: var(--g-color-text-secondary);
cursor: default;
}
}
1 change: 1 addition & 0 deletions src/components/NavigationItemRow/NavigationItemRow.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {FC} from 'react';
import {Flex, Icon, Text} from '@gravity-ui/uikit';
import cn from 'bem-cn-lite';
import './NavigationItemRow.scss';
import {NavigationItem} from '../../types/navigation';
import {getDefaultNavigationIcon} from '../../helpers/getDefaultNavigationIcon';

Expand Down
6 changes: 4 additions & 2 deletions src/components/SearchWithButtons/SearchWithButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {FC} from 'react';
import {Flex, TextInput} from '@gravity-ui/uikit';
import {Flex, type FlexProps, TextInput} from '@gravity-ui/uikit';
import cn from 'bem-cn-lite';
import './SearchWithButtons.scss';

Expand All @@ -11,6 +11,7 @@ export type SearchWithButtonsProps = {
endButtons?: React.ReactNode[];
onUpdate?: (value: string) => void;
className?: string;
gap?: FlexProps['gap'];
};

const block = cn('qp-search-with-buttons');
Expand All @@ -26,12 +27,13 @@ export const SearchWithButtons: FC<SearchWithButtonsProps> = ({
endButtons,
onUpdate,
className,
gap = 1,
}) => {
const hasInnerButtons = Boolean(innerButtons?.length);
const hasEndButtons = Boolean(endButtons?.length);

return (
<Flex gap={1} className={block(null, className)}>
<Flex gap={gap} className={block(null, className)}>
<TextInput
className={block('input')}
value={value}
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/getDefaultNavigationIcon.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {IconData} from '@gravity-ui/uikit';
import BanIcon from '@gravity-ui/icons/svgs/ban.svg';
import EyeSlashIcon from '@gravity-ui/icons/svgs/eye-slash.svg';
import CircleQuestionIcon from '@gravity-ui/icons/svgs/circle-question.svg';
import FileTextIcon from '@gravity-ui/icons/svgs/file-text.svg';
import FolderIcon from '@gravity-ui/icons/svgs/folder.svg';
import LayoutHeaderCellsLargeIcon from '@gravity-ui/icons/svgs/layout-header-cells-large.svg';
Expand All @@ -26,7 +26,7 @@ export function getDefaultNavigationIcon(
case 'link':
return LinkIcon;
case 'unknown':
return EyeSlashIcon;
return CircleQuestionIcon;
default:
return BanIcon;
}
Expand Down
11 changes: 0 additions & 11 deletions src/modules/ClustersList/ClustersList.scss

This file was deleted.

1 change: 0 additions & 1 deletion src/modules/ClustersList/ClustersList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type {NavigationCluster, RenderNavigationCluster} from '../../types/navig
import {ClusterRow} from '../../components/ClusterRow';
import {LazyList} from '../../components/LazyList';
import {NAVIGATION_ROW_HEIGHT} from '../../constants/row';
import './ClustersList.scss';

const block = cn('qp-clusters-list');

Expand Down
31 changes: 22 additions & 9 deletions src/modules/NavigationDetail/NavigationDetail.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
.qp-navigation-detail {
min-width: 0;
min-width: 0;

&__tabs {
overflow-x: auto;
}
&__header,
&__tabs,
&__search,
&__content {
margin-inline: var(--g-spacing-3) var(--g-spacing-2);
}

&__content {
min-width: 0;
overflow-x: hidden;
overflow-y: auto;
}
&__header,
&__tabs,
&__search {
flex-shrink: 0;
}

&__tabs {
overflow-x: auto;
}

&__content {
min-width: 0;
overflow-x: hidden;
overflow-y: auto;
}
}
2 changes: 2 additions & 0 deletions src/modules/NavigationDetail/NavigationDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export const NavigationDetail: React.FC<NavigationDetailProps> = ({
return (
<Flex direction="column" gap={2} className={block(null, className)}>
<NavigationHeader
className={block('header')}
location={location}
actions={mergedActions}
renderActions={renderActions}
Expand All @@ -114,6 +115,7 @@ export const NavigationDetail: React.FC<NavigationDetailProps> = ({
/>
{config.hasSearch && (
<SearchWithButtons
className={block('search')}
placeholder={config.searchPlaceholder}
value={search}
onUpdate={handleSearchUpdate}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/NavigationHeader/NavigationHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const NavigationHeader: FC<NavigationHeaderProps> = ({
{renderActions ? (
renderActions({location, actions: actions ?? []})
) : (
<NavigationActionButtons actions={actions} arg={location} />
<NavigationActionButtons size="m" actions={actions} arg={location} />
)}
</Flex>
);
Expand Down
83 changes: 29 additions & 54 deletions src/modules/NavigationItemsList/NavigationItemsList.scss
Original file line number Diff line number Diff line change
@@ -1,65 +1,40 @@
.qp-navigation-item-row {
width: 100%;
padding: 0 var(--g-spacing-2);
box-sizing: border-box;
cursor: pointer;

&__title {
flex-grow: 1;
min-width: 0;
}

&_disabled {
color: var(--g-color-text-secondary);
cursor: default;
}
}

.qp-navigation-items-list-header {
padding: 0 var(--g-spacing-2);

&__button {
padding-left: 0;
}
}

.qp-navigation-items-list {
display: flex;
flex-direction: column;
height: 100%;
display: flex;
flex-direction: column;
height: 100%;

&__header {
height: 28px;
}
&__header {
height: 28px;
}

&__list {
flex-grow: 1;
min-height: 0;
&__list {
flex-grow: 1;
min-height: 0;

.g-list__item_selected:hover {
background-color: var(--g-color-base-selection-hover);
.g-list__item_selected:hover {
background-color: var(--g-color-base-selection-hover);
}
}
}

&__empty {
display: flex;
flex-direction: column;
flex-grow: 1;
min-height: 0;
}
&__empty {
display: flex;
flex-direction: column;
flex-grow: 1;
min-height: 0;
}

&__parent-row {
flex-shrink: 0;
height: 32px;
cursor: pointer;
&__parent-row {
flex-shrink: 0;
height: 32px;
cursor: pointer;

&:hover {
background-color: var(--g-color-base-simple-hover);
&:hover {
background-color: var(--g-color-base-simple-hover);
}
}
}

&__empty-content {
flex-grow: 1;
min-height: 0;
}
&__empty-content {
flex-grow: 1;
min-height: 0;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.qp-navigation-items-list-header {
&__sort {
cursor: pointer;
user-select: none;
}
}
padding: 0 var(--g-spacing-3) 0 var(--g-spacing-4);
&__sort {
cursor: pointer;
user-select: none;
}
}
Loading
Loading