-
-
Notifications
You must be signed in to change notification settings - Fork 13
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 #318 from ashik-75/work
scrollable menu and download
- Loading branch information
Showing
11 changed files
with
125 additions
and
16 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions
46
ui/src/components/General/DropdownDownloadButton/index.tsx
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,46 @@ | ||
import { MenuProps } from "antd"; | ||
import React from "react"; | ||
import { ResponsiveDropdownButton } from "components/General/FormComponents"; | ||
import Icon from "components/General/Icon"; | ||
import { DropdownDownloadButtonPropsType } from "./utils/types"; | ||
const imageType = { | ||
jpeg: ".jpeg", | ||
png: ".png", | ||
}; | ||
|
||
const DropdownDownloadButton: React.FC<DropdownDownloadButtonPropsType> = ({ | ||
handleDownload, | ||
}) => { | ||
const handleMenuClick: MenuProps["onClick"] = (e) => { | ||
handleDownload(e.key); | ||
}; | ||
|
||
const items: MenuProps["items"] = [ | ||
{ | ||
label: "Download JPEG", | ||
key: imageType.jpeg, | ||
}, | ||
{ | ||
label: "Download PNG", | ||
key: imageType.png, | ||
}, | ||
]; | ||
|
||
const menuProps = { | ||
items, | ||
onClick: handleMenuClick, | ||
}; | ||
|
||
return ( | ||
<ResponsiveDropdownButton | ||
menu={menuProps} | ||
icon={<Icon name="ChevronDown" />} | ||
placement="top" | ||
onClick={() => handleDownload(imageType.png)} | ||
> | ||
Download | ||
</ResponsiveDropdownButton> | ||
); | ||
}; | ||
|
||
export default DropdownDownloadButton; |
5 changes: 5 additions & 0 deletions
5
ui/src/components/General/DropdownDownloadButton/utils/types.ts
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,5 @@ | ||
interface DropdownDownloadButtonPropsType { | ||
handleDownload: (val: string) => void; | ||
} | ||
|
||
export type { DropdownDownloadButtonPropsType }; |
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
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
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