Skip to content

Commit

Permalink
refactor(components): move toolbar to root of custom
Browse files Browse the repository at this point in the history
fix #284
  • Loading branch information
nebula-aac committed Nov 10, 2023
1 parent d5015ad commit 5387940
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { ColumnIcon } from '@layer5/sistent-svg';
import React from 'react';
import { Checkbox } from '../../base/Checkbox';
import { ClickAwayListener } from '../../base/ClickAwayListener';
import { FormControlLabel } from '../../base/Form';
import { IconButton } from '../../base/IconButton';
import { Paper } from '../../base/Paper';
import { Popper } from '../../base/Popper';
import { Tooltip } from '../../base/Tooltip';
import { Checkbox } from '../base/Checkbox';
import { ClickAwayListener } from '../base/ClickAwayListener';
import { FormControlLabel } from '../base/Form';
import { IconButton } from '../base/IconButton';
import { Paper } from '../base/Paper';
import { Popper } from '../base/Popper';
import { Tooltip } from '../base/Tooltip';

interface CustomColumnVisibilityControlProps {
columns: Column[];
export interface CustomColumnVisibilityControlProps {
columns: CustomColumn[];
customToolsProps: {
columnVisibility: Record<string, boolean>;
setColumnVisibility: React.Dispatch<React.SetStateAction<Record<string, boolean>>>;
};
style?: React.CSSProperties;
}

interface Column {
export interface CustomColumn {
name: string;
label: string;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CloseIcon, SearchIcon } from '@layer5/sistent-svg';
import React from 'react';
import { IconButton } from '../../base/IconButton';
import { TextField } from '../../base/TextField';
import { Tooltip } from '../../base/Tooltip';
import { IconButton } from '../base/IconButton';
import { TextField } from '../base/TextField';
import { Tooltip } from '../base/Tooltip';

interface SearchBarProps {
onSearch: (searchText: string) => void;
Expand Down
3 changes: 0 additions & 3 deletions packages/components/src/custom/SearchBar/index.tsx

This file was deleted.

3 changes: 3 additions & 0 deletions packages/components/src/custom/StyledSearchBar/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import StyledSearchBar from './StyledSearchBar';

export { StyledSearchBar };
5 changes: 0 additions & 5 deletions packages/components/src/custom/Toolbar/index.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { FilterIcon } from '@layer5/sistent-svg';
import { SelectChangeEvent } from '@mui/material/Select';
import React from 'react';
import { Button } from '../../base/Button';
import { ClickAwayListener } from '../../base/ClickAwayListener';
import { IconButton } from '../../base/IconButton';
import { InputLabel } from '../../base/InputLabel';
import { MenuItem } from '../../base/Menu';
import { Paper } from '../../base/Paper';
import { Popper } from '../../base/Popper';
import { Select } from '../../base/Select';
import { Tooltip } from '../../base/Tooltip';
import { Button } from '../base/Button';
import { ClickAwayListener } from '../base/ClickAwayListener';
import { IconButton } from '../base/IconButton';
import { InputLabel } from '../base/InputLabel';
import { MenuItem } from '../base/Menu';
import { Paper } from '../base/Paper';
import { Popper } from '../base/Popper';
import { Select } from '../base/Select';
import { Tooltip } from '../base/Tooltip';

interface FilterColumn {
export interface FilterColumn {
name: string;
options: { label: string; value: string }[];
}

interface UniversalFilterProps {
export interface UniversalFilterProps {
filters: Record<string, FilterColumn>;
selectedFilters: Record<string, string>;
setSelectedFilters: React.Dispatch<React.SetStateAction<Record<string, string>>>;
Expand Down
8 changes: 1 addition & 7 deletions packages/components/src/custom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@
import { StyledDialog, StyledDialogActions, StyledDialogContent } from './Dialog';
import { useWindowDimensions } from './Helpers/Dimension';
import { useNotificationHandler } from './Helpers/Notification';
import CustomColumnVisibilityControl from './Toolbar/custom-column';
import UniversalFilter from './Toolbar/custom-filter';
import SearchBar from './Toolbar/custom-search';
import { StyledTooltip } from './Tooltip';

export { StyledChartDialog } from './ChartDialog';
export { StyledSearchBar } from './SearchBar';
export { StyledSearchBar } from './StyledSearchBar';
export {
CustomColumnVisibilityControl,
SearchBar,
StyledDialog,
StyledDialogActions,
StyledDialogContent,
StyledTooltip,
UniversalFilter,
useNotificationHandler,
useWindowDimensions
};
10 changes: 10 additions & 0 deletions packages/components/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,18 @@ export * from './base/Tooltip';
export * from './base/Typography';
export * from './colors';
export * from './custom';
export {
default as CustomColumnVisibilityControl,
type CustomColumn,
type CustomColumnVisibilityControlProps
} from './custom/CustomColumnVisibilityControl';
export {
default as ResponsiveDataTable,
type Column,
type ResponsiveDataTableProps
} from './custom/ResponsiveDataTable';
export {
default as UniversalFilter,
type FilterColumn,
type UniversalFilterProps
} from './custom/UniversalFilter';

0 comments on commit 5387940

Please sign in to comment.