-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from sabitalizade/dinamic-width-and-resizable-prop
added close button, dinamic maxWidth, title changed to ReactNode, com…
- Loading branch information
Showing
5 changed files
with
70 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export default function CloseIcon() { | ||
return ( | ||
<svg | ||
stroke="currentColor" | ||
fill="currentColor" | ||
strokeWidth="0" | ||
viewBox="0 0 512 512" | ||
height="1em" | ||
width="1em" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path d="M400 145.49 366.51 112 256 222.51 145.49 112 112 145.49 222.51 256 112 366.51 145.49 400 256 289.49 366.51 400 400 366.51 289.49 256 400 145.49z"></path> | ||
</svg> | ||
); | ||
} |
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,25 @@ | ||
import CloseIcon from "./CloseIcon"; | ||
import { ResizableDrawerProps } from "./types"; | ||
|
||
const Title = ({ | ||
title, | ||
closeButton = null, | ||
titleClosable = true, | ||
onClose = () => {}, | ||
}: ResizableDrawerProps) => { | ||
return ( | ||
<div className="rc-drawer-title-container"> | ||
<h3 className="rc-drawer-title">{title}</h3> | ||
{titleClosable && | ||
(closeButton ? ( | ||
<div onClick={onClose}>{closeButton}</div> | ||
) : ( | ||
<button onClick={onClose} className="rc-drawer-close-btn"> | ||
<CloseIcon /> | ||
</button> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Title; |
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,11 @@ | ||
import { DrawerProps } from "rc-drawer"; | ||
|
||
export type ResizableDrawerProps = DrawerProps & { | ||
title?: React.ReactNode; | ||
closeButton?: React.ReactNode; | ||
titleClosable?: boolean; | ||
minWidth?: number; | ||
maxWidth?: number; | ||
resizable?: boolean; | ||
onResize?: (width: number) => void; | ||
}; |
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,4 +1,4 @@ | ||
import "rc-drawer/assets/index.css"; | ||
import Drawer from "./components/Drawer"; | ||
|
||
export type { ResizableDrawerProps } from "./components/Drawer/types"; | ||
export default Drawer; |