generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ci-add-lint-checks
- Loading branch information
Showing
36 changed files
with
974 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import { Pagination as MuiPagination, PaginationProps as MuiPaginationProps } from '@mui/material'; | ||
import { | ||
Pagination as MuiPagination, | ||
PaginationItem as MuiPaginationItem, | ||
PaginationProps as MuiPaginationProps | ||
} from '@mui/material'; | ||
import React from 'react'; | ||
|
||
const Pagination = React.forwardRef<HTMLDivElement, MuiPaginationProps>((props, ref) => { | ||
return <MuiPagination {...props} ref={ref} />; | ||
}); | ||
|
||
export { MuiPaginationItem as PaginationItem }; | ||
export default Pagination; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { PaginationProps } from '@mui/material'; | ||
import Pagination from './Pagination'; | ||
import Pagination, { PaginationItem } from './Pagination'; | ||
|
||
export { Pagination }; | ||
export { Pagination, PaginationItem }; | ||
export type { PaginationProps }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import { Resizable } from 're-resizable'; | ||
import React from 'react'; | ||
import Draggable from 'react-draggable'; | ||
import { Box, BoxProps, IconButton, Tooltip } from '../../base'; | ||
import { CloseIcon, CollapseAllIcon, ExpandAllIcon } from '../../icons'; | ||
import { PanelDragHandleIcon } from '../../icons/PanelDragHandle'; | ||
import { useTheme } from '../../theme'; | ||
import { ErrorBoundary } from '../ErrorBoundary'; | ||
import { | ||
DragHandle, | ||
DrawerHeader, | ||
HeaderActionsContainer, | ||
HeaderContainer, | ||
PanelBody, | ||
PanelContainer, | ||
ResizableContent | ||
} from './style'; | ||
|
||
export type PanelProps = { | ||
isOpen: boolean; | ||
children: React.ReactNode; | ||
areAllExpanded?: boolean; | ||
toggleExpandAll?: () => void; | ||
handleClose: () => void; | ||
sx?: BoxProps['sx']; | ||
id?: string; | ||
intitialPosition?: { | ||
left?: string | number; | ||
right?: string | number; | ||
top?: string | number; | ||
bottom?: string | number; | ||
}; | ||
}; | ||
|
||
const Panel_: React.FC<PanelProps> = ({ | ||
isOpen, | ||
id = 'panel', | ||
children, | ||
areAllExpanded, | ||
toggleExpandAll, | ||
handleClose, | ||
intitialPosition, | ||
sx | ||
}) => { | ||
const theme = useTheme(); | ||
if (!isOpen) return null; | ||
return ( | ||
<Draggable handle=".drag-handle"> | ||
<PanelContainer theme={theme} intitialPosition={intitialPosition} sx={sx}> | ||
<Resizable | ||
defaultSize={{ width: '18rem', height: 'auto' }} | ||
onResize={() => { | ||
window.dispatchEvent(new Event('panel-resize')); | ||
}} | ||
enable={{ | ||
top: true, | ||
right: true, | ||
bottom: true, | ||
left: true, | ||
topRight: true, | ||
bottomRight: true, | ||
bottomLeft: true, | ||
topLeft: true | ||
}} | ||
> | ||
<ResizableContent> | ||
<ErrorBoundary> | ||
<div className="drag-handle"> | ||
<DrawerHeader> | ||
<Box display="flex" justifyContent="flex-end" padding="8px"> | ||
{toggleExpandAll && ( | ||
<Tooltip title={areAllExpanded ? 'Collapse All' : 'Expand All'}> | ||
<IconButton onClick={toggleExpandAll}> | ||
{areAllExpanded ? <CollapseAllIcon /> : <ExpandAllIcon />} | ||
</IconButton> | ||
</Tooltip> | ||
)} | ||
</Box> | ||
<DragHandle> | ||
<PanelDragHandleIcon /> | ||
</DragHandle> | ||
<HeaderContainer> | ||
<HeaderActionsContainer | ||
id={`${id}-panel-header-actions-container`} | ||
></HeaderActionsContainer> | ||
<IconButton onClick={handleClose}> | ||
<CloseIcon /> | ||
</IconButton> | ||
</HeaderContainer> | ||
</DrawerHeader> | ||
</div> | ||
<PanelBody className="panel-body">{children}</PanelBody> | ||
</ErrorBoundary> | ||
</ResizableContent> | ||
</Resizable> | ||
</PanelContainer> | ||
</Draggable> | ||
); | ||
}; | ||
|
||
export const Panel: React.FC<PanelProps> = ({ ...props }) => { | ||
return <Panel_ {...props} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Panel } from './Panel'; | ||
|
||
export { Panel }; |
Oops, something went wrong.