-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add contributor hub url contributor search (#321)
Signed-off-by: laixingyou <[email protected]>
- Loading branch information
1 parent
0b7f788
commit a9378af
Showing
7 changed files
with
185 additions
and
64 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
.../analyze/DataView/MetricDetail/MetricContributor/ContributorTable/ContributorDropdown.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,48 @@ | ||
import React, { useState } from 'react'; | ||
// import { AiOutlineSearch } from 'react-icons/ai'; | ||
import { Button, Input } from 'antd'; | ||
import { useTranslation } from 'next-i18next'; | ||
|
||
const ContributorDropdown = ({ selectedKeys, setSelectedKeys, confirm }) => { | ||
const { t } = useTranslation(); | ||
const [contributor, setContributor] = useState(selectedKeys); | ||
|
||
const handleSearch = () => { | ||
setSelectedKeys(contributor); | ||
confirm(); | ||
}; | ||
const handleReset = () => { | ||
setContributor([]); | ||
}; | ||
return ( | ||
<div style={{ padding: 8 }} onKeyDown={(e) => e.stopPropagation()}> | ||
<Input | ||
placeholder={t('analyze:metric_detail:search_contributor')} | ||
value={contributor[0]} | ||
onChange={(e) => setContributor([e.target.value])} | ||
onPressEnter={() => handleSearch()} | ||
style={{ marginBottom: 8, display: 'block' }} | ||
/> | ||
<div className="flex justify-between"> | ||
<Button | ||
type="link" | ||
disabled={contributor[0] ? false : true} | ||
onClick={() => handleReset()} | ||
size="small" | ||
> | ||
{t('analyze:metric_detail:reset')} | ||
</Button> | ||
<Button | ||
type="primary" | ||
className="flex items-center" | ||
onClick={() => handleSearch()} | ||
size="small" | ||
> | ||
{t('analyze:metric_detail:search')} | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ContributorDropdown; |
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