Skip to content

Commit 909b560

Browse files
committed
fix(NavigationTree): add node types & update icons
1 parent 61c1fd9 commit 909b560

File tree

8 files changed

+61
-24
lines changed

8 files changed

+61
-24
lines changed

src/components/NavigationTree/NavigationTreeNode.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import {DatabaseIcon} from '../icons/Database';
77
import {FolderIcon} from '../icons/Folder';
88
import {FolderOpenIcon} from '../icons/FolderOpen';
99
import {TableIcon} from '../icons/Table';
10+
import {TopicIcon} from '../icons/Topic';
11+
import {IndexIcon} from '../icons/Index';
12+
import {ColumnTableIcon} from '../icons/ColumnTable';
1013
import {TreeView} from '../TreeView/TreeView';
1114

1215
export interface NavigationTreeNodeProps {
@@ -25,13 +28,19 @@ export interface NavigationTreeNodeProps {
2528
function renderIcon(type: NavigationTreeNodeType | string, collapsed: boolean) {
2629
switch (type) {
2730
case 'database':
31+
// this icon is larger than the others, therefore 14 for a better fit
2832
return <DatabaseIcon height={14} />;
2933
case 'directory':
34+
return collapsed ? <FolderIcon height={16} /> : <FolderOpenIcon height={16} />;
3035
case 'index':
31-
return collapsed ? <FolderIcon height={14} /> : <FolderOpenIcon height={14} />;
36+
return <IndexIcon height={16} />;
3237
case 'table':
3338
case 'index_table':
34-
return <TableIcon height={14} />;
39+
return <TableIcon height={16} />;
40+
case 'column_table':
41+
return <ColumnTableIcon height={16} />;
42+
case 'topic':
43+
return <TopicIcon height={16} />;
3544
default:
3645
return null;
3746
}

src/components/NavigationTree/types.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import {DropdownMenuItemMixed} from '@yandex-cloud/uikit';
22

3-
export type NavigationTreeNodeType = 'database' | 'directory' | 'table' | 'index_table' | 'index';
3+
export type NavigationTreeNodeType =
4+
| 'database'
5+
| 'directory'
6+
| 'table'
7+
| 'column_table'
8+
| 'index_table'
9+
| 'index'
10+
| 'topic';
411

512
export interface NavigationTreeDataItem {
613
name: string;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
3+
export function ColumnTableIcon(props: React.SVGProps<SVGSVGElement>) {
4+
return (
5+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" {...props}>
6+
<rect x="2" y="3" width="5" height="2.5" rx="0.5" />
7+
<rect x="2" y="7" width="5" height="2.5" rx="0.5" />
8+
<rect x="2" y="11" width="5" height="2.5" rx="0.5" />
9+
<rect x="9" y="3" width="5" height="2.5" rx="0.5" />
10+
<rect x="9" y="7" width="5" height="2.5" rx="0.5" />
11+
<rect x="9" y="11" width="5" height="2.5" rx="0.5" />
12+
</svg>
13+
);
14+
}

src/components/icons/Folder.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@ import React from 'react';
22

33
export function FolderIcon(props: React.SVGProps<SVGSVGElement>) {
44
return (
5-
<svg
6-
xmlns="http://www.w3.org/2000/svg"
7-
viewBox="0 0 512 512"
8-
fill="currentColor"
9-
{...props}
10-
>
11-
<path d="M512 144v288c0 26.5-21.5 48-48 48h-416C21.5 480 0 458.5 0 432v-352C0 53.5 21.5 32 48 32h160l64 64h192C490.5 96 512 117.5 512 144z" />
5+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" {...props}>
6+
<path d="M13.2812 4.875H8.40625L6.78125 3.25H2.71875C2.0332 3.25 1.5 3.80859 1.5 4.46875V11.7812C1.5 12.4668 2.0332 13 2.71875 13H13.2812C13.9414 13 14.5 12.4668 14.5 11.7812V6.09375C14.5 5.43359 13.9414 4.875 13.2812 4.875Z" />
127
</svg>
138
);
149
}

src/components/icons/FolderOpen.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@ import React from 'react';
22

33
export function FolderOpenIcon(props: React.SVGProps<SVGSVGElement>) {
44
return (
5-
<svg
6-
xmlns="http://www.w3.org/2000/svg"
7-
viewBox="0 0 576 512"
8-
fill="currentColor"
9-
{...props}
10-
>
11-
<path d="M147.8 192H480V144C480 117.5 458.5 96 432 96h-160l-64-64h-160C21.49 32 0 53.49 0 80v328.4l90.54-181.1C101.4 205.6 123.4 192 147.8 192zM543.1 224H147.8C135.7 224 124.6 230.8 119.2 241.7L0 480h447.1c12.12 0 23.2-6.852 28.62-17.69l96-192C583.2 249 567.7 224 543.1 224z" />
5+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" {...props}>
6+
<path d="M15.2109 9.06445C15.4648 8.6582 15.1602 8.125 14.6777 8.125H4.54688C4.01367 8.125 3.37891 8.50586 3.125 8.9375L1.29688 12.0859C1.04297 12.4922 1.34766 13 1.83008 13H11.9609C12.4941 13 13.1289 12.6445 13.3828 12.2129L15.2109 9.06445ZM4.54688 7.3125H12.875V6.09375C12.875 5.43359 12.3164 4.875 11.6562 4.875H7.59375L5.96875 3.25H1.90625C1.2207 3.25 0.6875 3.80859 0.6875 4.46875V11.5527L2.43945 8.53125C2.87109 7.79492 3.6582 7.3125 4.54688 7.3125Z" />
127
</svg>
138
);
149
}

src/components/icons/Index.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
3+
export function IndexIcon(props: React.SVGProps<SVGSVGElement>) {
4+
return (
5+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" {...props}>
6+
<path
7+
fill-rule="evenodd"
8+
clip-rule="evenodd"
9+
d="M2.21875 2H9.97675L6.6875 7.29469V5.25H2.625V7.6875H6.44347L6.10429 8.23348V8.23454C5.9286 8.50001 5.92847 8.93002 5.9286 9.03845C5.9286 9.13568 5.9579 9.2302 6.01212 9.3125H2.625V11.75H6.6875V9.57909L8.3125 9.60141V11.75H8.96364L8.68578 13.375H2.21875C1.5332 13.375 1 12.8418 1 12.1562V3.21875C1 2.55859 1.5332 2 2.21875 2ZM12.7812 13.375H11.5739L14 9.27358V12.1562C14 12.8418 13.4414 13.375 12.7812 13.375ZM14 3.21875V6H12L12.6784 2H12.7812C13.4414 2 14 2.55859 14 3.21875ZM10.962 2.06484C11.034 2.02249 11.1162 2.00009 11.2 2C11.3238 2 11.4425 2.04863 11.53 2.13518C11.6175 2.22174 11.6667 2.33913 11.6667 2.46154C11.6666 2.50769 11.6595 2.55358 11.6457 2.59766L10.9667 7.07692H13.5333C13.7909 7.07692 14 7.28369 14 7.53846C14 7.63899 13.9604 7.72676 13.9052 7.80258L13.9098 7.8107L10.2129 13.7539H10.212C10.1724 13.8281 10.1131 13.8902 10.0405 13.9335C9.96796 13.9769 9.8848 13.9999 9.8 14C9.67623 14 9.55753 13.9514 9.47002 13.8648C9.3825 13.7783 9.33333 13.6609 9.33333 13.5385C9.33325 13.5076 9.33631 13.4768 9.34245 13.4465L10.0333 8.92308H7.46667C7.3429 8.92308 7.2242 8.87445 7.13668 8.7879C7.04917 8.70134 7 8.58395 7 8.46154C6.9999 8.3686 7.02818 8.2778 7.08112 8.20102V8.20012L10.7908 2.24069C10.8308 2.16793 10.89 2.10719 10.962 2.06484Z"
10+
/>
11+
</svg>
12+
);
13+
}

src/components/icons/Table.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@ import React from 'react';
22

33
export function TableIcon(props: React.SVGProps<SVGSVGElement>) {
44
return (
5-
<svg
6-
xmlns="http://www.w3.org/2000/svg"
7-
viewBox="0 0 512 512"
8-
fill="currentColor"
9-
{...props}
10-
>
11-
<path d="M448 32C483.3 32 512 60.65 512 96V416C512 451.3 483.3 480 448 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H448zM224 256V160H64V256H224zM64 320V416H224V320H64zM288 416H448V320H288V416zM448 256V160H288V256H448z" />
5+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" {...props}>
6+
<path d="M12.7812 2.4375H2.21875C1.5332 2.4375 1 2.99609 1 3.65625V12.5938C1 13.2793 1.5332 13.8125 2.21875 13.8125H12.7812C13.4414 13.8125 14 13.2793 14 12.5938V3.65625C14 2.99609 13.4414 2.4375 12.7812 2.4375ZM6.6875 12.1875H2.625V9.75H6.6875V12.1875ZM6.6875 8.125H2.625V5.6875H6.6875V8.125ZM12.375 12.1875H8.3125V9.75H12.375V12.1875ZM12.375 8.125H8.3125V5.6875H12.375V8.125Z" />
127
</svg>
138
);
149
}

src/components/icons/Topic.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
3+
export function TopicIcon(props: React.SVGProps<SVGSVGElement>) {
4+
return (
5+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" {...props}>
6+
<path d="M1.90625 4.875H12.4688C12.6719 4.875 12.875 4.69727 12.875 4.46875V2.84375C12.875 2.64062 12.6719 2.4375 12.4688 2.4375H1.90625C1.67773 2.4375 1.5 2.64062 1.5 2.84375V4.46875C1.5 4.69727 1.67773 4.875 1.90625 4.875ZM14.0938 6.90625H3.53125C3.30273 6.90625 3.125 7.10938 3.125 7.3125V8.9375C3.125 9.16602 3.30273 9.34375 3.53125 9.34375H14.0938C14.2969 9.34375 14.5 9.16602 14.5 8.9375V7.3125C14.5 7.10938 14.2969 6.90625 14.0938 6.90625ZM12.4688 11.375H1.90625C1.67773 11.375 1.5 11.5781 1.5 11.7812V13.4062C1.5 13.6348 1.67773 13.8125 1.90625 13.8125H12.4688C12.6719 13.8125 12.875 13.6348 12.875 13.4062V11.7812C12.875 11.5781 12.6719 11.375 12.4688 11.375Z" />
7+
</svg>
8+
);
9+
}

0 commit comments

Comments
 (0)