Skip to content

Commit 55b044b

Browse files
authored
fix potlock search (#397)
1 parent 840e115 commit 55b044b

File tree

2 files changed

+10
-80
lines changed

2 files changed

+10
-80
lines changed

apps/new/widget/page/projects/PotlockImport.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const Search = useMemo(() => {
120120
}}
121121
/>
122122
);
123-
}, [projects]);
123+
}, [projects, searchTerm]);
124124

125125
function shuffleArray(array) {
126126
return array.sort(() => Math.random() - 0.5);
Lines changed: 9 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { Button } = VM.require("${config_account}/widget/components") || {
1+
const { Button } = VM.require("${alias_old}/widget/components") || {
22
Button: () => <></>,
33
};
44

@@ -30,6 +30,7 @@ const SearchIcon = styled.div`
3030
`;
3131

3232
const SearchBarInput = styled.input`
33+
color: white;
3334
background: none;
3435
width: 100%;
3536
outline: none;
@@ -40,79 +41,8 @@ const SearchBarInput = styled.input`
4041
}
4142
`;
4243

43-
const FilterButton = styled.div`
44-
font-weight: 500;
45-
font-size: 14px;
46-
display: flex;
47-
align-items: center;
48-
gap: 0.5rem;
49-
cursor: pointer;
50-
width: fit-content;
51-
padding: 0.54rem 1rem;
52-
border-radius: 6px;
53-
border: 1px solid #7b7b7b;
54-
transition: all 200ms ease-in-out;
55-
&.active {
56-
color: #fff;
57-
background: #292929;
58-
}
59-
`;
60-
61-
const FilterIcon = styled.div`
62-
display: flex;
63-
width: 16px;
64-
height: 16px;
65-
align-items: center;
66-
justify-content: center;
67-
`;
68-
69-
const FilterMenu = styled.div`
70-
position: absolute;
71-
background: #fff;
72-
font-size: 14px;
73-
top: 110%;
74-
right: 0;
75-
padding: 8px;
76-
display: flex;
77-
flex-direction: column;
78-
gap: 8px;
79-
border-radius: 6px;
80-
border: 1px solid rgba(41, 41, 41, 0.36);
81-
box-shadow:
82-
0px 12px 20px -4px rgba(123, 123, 123, 0.32),
83-
0px 4px 8px -3px rgba(123, 123, 123, 0.2),
84-
0px 0px 2px 0px rgba(123, 123, 123, 0.36);
85-
z-index: 2;
86-
opacity: 0;
87-
visibility: hidden;
88-
transform: translateY(100px);
89-
transition: all 200ms ease-in-out;
90-
&.active {
91-
opacity: 1;
92-
visibility: visible;
93-
transform: translateY(0);
94-
}
95-
@media screen and (max-width: 768px) {
96-
left: 0;
97-
background: #fff;
98-
}
99-
`;
100-
101-
const FilterItem = styled.div`
102-
cursor: pointer;
103-
padding: 8px;
104-
display: flex;
105-
gap: 12px;
106-
white-space: nowrap;
107-
&:hover {
108-
background: #292929;
109-
color: #fff;
110-
border-radius: 6px;
111-
}
112-
`;
113-
114-
const { numItems, itemName, onSearch } = props;
115-
const [searchTerm, setSearchTerm] = useState("");
44+
const { numItems, itemName, onSearch, term } = props;
45+
const [searchTerm, setSearchTerm] = useState(term);
11646

11747
const onSearchChange = (value) => {
11848
setSearchTerm(value);
@@ -126,7 +56,7 @@ const handleKeyDown = (event) => {
12656
};
12757

12858
return (
129-
<>
59+
<div className="d-flex gap-3 align-items-center">
13060
<Row>
13161
<SearchIcon>
13262
<svg
@@ -150,9 +80,9 @@ return (
15080
autocomplete="search"
15181
onKeyDown={handleKeyDown}
15282
/>
153-
<Button variant="primary" onClick={() => onSearch(searchTerm)}>
154-
Search
155-
</Button>
15683
</Row>
157-
</>
84+
<Button variant="primary" onClick={() => onSearch(searchTerm)}>
85+
Search
86+
</Button>
87+
</div>
15888
);

0 commit comments

Comments
 (0)