Skip to content

Commit

Permalink
fix: search option and change the color
Browse files Browse the repository at this point in the history
  • Loading branch information
maryia-matskevich-deriv committed Oct 17, 2024
1 parent 21b62a1 commit 23df5f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const StrategyBlock = ({ title, items, onSelectStrategy }: TStrategyBlock) => {
{items.map((item, index) => (
<div className='strategy-template-picker__links' key={index}>
<Link
color='var(--text-prominent)'
hasChevron
size='sm'
onClick={() => onSelectStrategy(item.name, title)}
Expand All @@ -55,26 +54,18 @@ const StrategyList = ({ selector_chip_value, search_value, is_searching, onSelec
return (is_searching && is_parent_match_value) || !is_searching;
};

const is_display_name_match = STRATEGY_TRADE_ASSOCIATIONS.some(item =>
item.display_name.toLowerCase().includes(search_value.toLowerCase())
);

STRATEGY_TRADE_ASSOCIATIONS.filter(
item =>
item.parent.some(parent => filterVisibleParents(parent)) ||
item.display_name.toLowerCase().includes(search_value.toLowerCase())
).forEach(item => {
const tmp_item = { ...item };
if (is_searching && search_value !== '') {
if (is_display_name_match) {
if (item.display_name.toLowerCase().includes(search_value.toLowerCase())) {
tmp_item.parent = [...item.parent];
} else {
const matched_parents = tmp_item.parent.filter(parent =>
TRADE_TYPES.some(
type =>
parent.toLowerCase().includes(type.toLowerCase()) &&
type.toLowerCase().includes(search_value.toLowerCase())
)
parent.toLowerCase().includes(search_value.toLowerCase())
);
tmp_item.parent = matched_parents.length > 0 ? matched_parents : item.parent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@

&__links {
margin: 0 0.8rem;

.quill-typography {
color: var(--text-general);
}
}

&__title {
Expand Down

0 comments on commit 23df5f1

Please sign in to comment.