-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix: Global search and pagination in modify page (#423) * feat: change theme to dark mode * fix: dashboard table dark mode * feat-dark mode * feat:dark mode * fix: lead page in dark mode * fix * text to white in deallocate page * fix * fix issue: removed filter options, fix to logout shimmering * feat: added refresh button to approve assets page * fix * fix: modify table * removed comments --------- Co-authored-by: AidrinVargheseEXP <[email protected]> Co-authored-by: Ashish Sam T George <[email protected]> * fix: Increase timeout of gunicorn to 120 seconds (#427) * fix: Make the background color of all the pages uniform (#436) * fix: Reset field values when an asset is succefully created (#438) * fix : Design improvments at frontend, bug fix (#437) * fix : Design improvments at frontend, bug fix * fix: remov extra loading icon * fix : resolve more error handling to user tasks --------- Co-authored-by: Aidrin Varghese <[email protected]> Co-authored-by: AidrinVargheseEXP <[email protected]> Co-authored-by: AnanthanCJ <[email protected]>
- Loading branch information
1 parent
2099fb9
commit 550685d
Showing
10 changed files
with
118 additions
and
212 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,62 @@ | ||
import React, { useState } from 'react'; | ||
import { DownOutlined } from '@ant-design/icons'; | ||
import { Dropdown, Button, Menu } from 'antd'; | ||
import { Dropdown, Button, MenuProps } from 'antd'; | ||
|
||
interface DropDownProps { | ||
onSelect: (key: string) => void; | ||
items?: { label: string; key: string; icon?: React.ReactNode }[]; | ||
buttonLabel?: string; | ||
buttonLabel?: React.ReactNode; | ||
disabled?: boolean; | ||
} | ||
|
||
const DropDown: React.FC<DropDownProps> = ({ onSelect, items = [], buttonLabel = "Submit" }) => { | ||
const [loadings, setLoadings] = useState<boolean[]>([]); | ||
|
||
const enterLoading = (index: number) => { | ||
setLoadings((state) => { | ||
const newLoadings = [...state]; | ||
newLoadings[index] = true; | ||
return newLoadings; | ||
}); | ||
const DropDown: React.FC<DropDownProps> = ({ | ||
onSelect, | ||
items = [], | ||
buttonLabel = "Submit", | ||
disabled = false | ||
}) => { | ||
const [loading, setLoading] = useState(false); | ||
|
||
const handleMenuClick: MenuProps['onClick'] = (e) => { | ||
setLoading(true); | ||
onSelect(e.key); | ||
setTimeout(() => { | ||
setLoadings((state) => { | ||
const newLoadings = [...state]; | ||
newLoadings[index] = false; | ||
return newLoadings; | ||
}); | ||
setLoading(false); | ||
}, 6000); | ||
}; | ||
|
||
const menuItems = items.map(item => ({ | ||
key: item.key, | ||
label: ( | ||
<span onClick={() => onSelect(item.key)}> | ||
{item.label} | ||
</span> | ||
), | ||
label: item.label, | ||
icon: item.icon, | ||
})); | ||
|
||
const menuProps = { | ||
items: menuItems, | ||
onClick: handleMenuClick, | ||
}; | ||
|
||
return ( | ||
<Dropdown menu={{ items: menuItems }}> | ||
<Dropdown menu={menuProps} disabled={disabled}> | ||
<Button | ||
icon={<DownOutlined />} | ||
style={{ | ||
borderRadius: '7px', | ||
border: '1px solid #d9d9d9', | ||
background: '#1677ff', | ||
color: 'white', | ||
height: '41px', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}} | ||
loading={loadings[0]} | ||
onClick={() => enterLoading(0)} | ||
|
||
disabled={disabled} | ||
> | ||
{buttonLabel} | ||
<span style={{ marginRight: '8px' }}>{buttonLabel}</span> | ||
<DownOutlined /> | ||
</Button> | ||
</Dropdown> | ||
); | ||
}; | ||
|
||
export default DropDown; | ||
export default DropDown; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.