-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b6864f
commit 8c6d39e
Showing
9 changed files
with
962 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React from 'react'; | ||
import { components } from 'react-select'; | ||
|
||
const CustomOptionForPrompts = (props) => { | ||
const { innerRef, innerProps, data, handleDelete, handleTemplateSelect, isDefault, isSelected } = props; | ||
|
||
return ( | ||
<components.Option {...props} innerRef={innerRef} innerProps={innerProps}> | ||
<div style={{ display: 'flex', alignItems: 'center' }}> | ||
{props.children} | ||
{isDefault && <span | ||
style={{ | ||
cursor: 'pointer', | ||
marginLeft: 'auto', | ||
color: 'black', | ||
fontSize: '12px', | ||
lineHeight: '1' | ||
}} | ||
title="Default" | ||
>★ | ||
</span>} | ||
{isSelected && <span | ||
style={{ | ||
cursor: 'pointer', | ||
marginLeft: !isDefault ? 'auto' : '1em', | ||
color: 'black', | ||
fontSize: '12px', | ||
lineHeight: '1' | ||
}} | ||
title="Selected" | ||
>🔘 | ||
</span>} | ||
<span | ||
onClick={() => handleTemplateSelect(data)} | ||
style={{ | ||
cursor: 'pointer', | ||
marginLeft: !isDefault && !isSelected ? 'auto' : '1em', | ||
color: 'black', | ||
fontSize: '12px', | ||
lineHeight: '1' | ||
}} | ||
title="Select as Template or Update" | ||
> | ||
🖉 | ||
</span> | ||
{!isDefault && !isSelected && <span | ||
onClick={() => handleDelete(data)} | ||
style={{ | ||
cursor: 'pointer', | ||
marginLeft: '1em', // Push the cross to the right end | ||
color: 'black', | ||
fontSize: '12px', | ||
lineHeight: '1' | ||
}} | ||
title="Delete" | ||
> | ||
✕ | ||
</span>} | ||
</div> | ||
</components.Option> | ||
); | ||
}; | ||
|
||
export default CustomOptionForPrompts; |
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
Oops, something went wrong.