-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add more tests in utils folder- part 3
Signed-off-by: Calvin Lee <[email protected]>
- Loading branch information
Showing
5 changed files
with
58 additions
and
15 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
42 changes: 42 additions & 0 deletions
42
packages/ui/src/views/repo/pull-request/components/pull-request-labels-list.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,42 @@ | ||
import { Button, Icon } from '@components/index' | ||
|
||
interface LabelsListProps { | ||
labels?: { key?: string; id?: number; color?: string }[] | ||
handleDelete?: (id: number) => void | ||
addLabelError?: string | ||
removeLabelError?: string | ||
} | ||
|
||
const LabelsList: React.FC<LabelsListProps> = ({ labels, handleDelete, addLabelError, removeLabelError }) => ( | ||
<div className="flex flex-col gap-3"> | ||
{addLabelError || removeLabelError ? ( | ||
<span className="text-12 text-destructive">{addLabelError ?? removeLabelError}</span> | ||
) : ( | ||
<></> | ||
)} | ||
{labels?.length ? ( | ||
labels?.map(({ key, id, color }) => ( | ||
<div key={id} className="mr-1 flex items-center space-x-2"> | ||
<div className="p-0.5 outline outline-1" style={{ outlineColor: color }}> | ||
<span className="px-1" style={{ color: color }}> | ||
{key} | ||
</span> | ||
<Button | ||
variant="ghost" | ||
size="xs" | ||
onClick={() => { | ||
handleDelete?.(id ?? 0) | ||
}} | ||
> | ||
<Icon name="close" size={12} className="text-tertiary-background" /> | ||
</Button> | ||
</div> | ||
</div> | ||
)) | ||
) : ( | ||
<span className="text-14 font-medium text-foreground-5">No labels</span> | ||
)} | ||
</div> | ||
) | ||
|
||
export { LabelsList } |