@rpg-engine/long-bow 0.7.90 → 0.7.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.7.90",
3
+ "version": "0.7.91",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -67,7 +67,7 @@ export const CraftBook: React.FC<IItemCraftSelectorProps> = ({
67
67
  savedSelectedType ?? Object.keys(ItemSubType)[0]
68
68
  );
69
69
  const [size, setSize] = useState<{ width: string; height: string }>();
70
-
70
+ const [searchTerm, setSearchTerm] = useState('');
71
71
  const [isCraftingDisabled, setIsCraftingDisabled] = useState(false);
72
72
 
73
73
  useEffect(() => {
@@ -150,6 +150,15 @@ export const CraftBook: React.FC<IItemCraftSelectorProps> = ({
150
150
  ));
151
151
  };
152
152
 
153
+ const filteredCraftableItems = craftablesItems?.filter(item => {
154
+ const matchesSearch = item.name
155
+ .toLowerCase()
156
+ .includes(searchTerm.toLowerCase());
157
+ const matchesCategory =
158
+ selectedType === 'Suggested' || item.type === selectedType;
159
+ return matchesSearch && matchesCategory;
160
+ });
161
+
153
162
  if (!size) return null;
154
163
 
155
164
  return (
@@ -169,6 +178,15 @@ export const CraftBook: React.FC<IItemCraftSelectorProps> = ({
169
178
  <div style={{ width: '100%' }}>
170
179
  <Title>Craftbook</Title>
171
180
  <Subtitle>Select an item to craft</Subtitle>
181
+ <SearchContainer>
182
+ <input
183
+ type="text"
184
+ className="rpgui-input"
185
+ placeholder="Search items..."
186
+ value={searchTerm}
187
+ onChange={e => setSearchTerm(e.target.value)}
188
+ />
189
+ </SearchContainer>
172
190
  <hr className="golden" />
173
191
  </div>
174
192
 
@@ -178,7 +196,7 @@ export const CraftBook: React.FC<IItemCraftSelectorProps> = ({
178
196
  </ItemTypes>
179
197
 
180
198
  <RadioInputScroller className="inputRadioCraftBook">
181
- {craftablesItems?.map(item => (
199
+ {filteredCraftableItems?.map(item => (
182
200
  <CraftingRecipe
183
201
  key={item.key}
184
202
  atlasIMG={atlasIMG}
@@ -304,3 +322,27 @@ const ItemTypes = styled.div`
304
322
  width: 100%;
305
323
  }
306
324
  `;
325
+
326
+ const SearchContainer = styled.div`
327
+ margin: 8px 0;
328
+ padding: 0 16px;
329
+
330
+ input {
331
+ width: 100%;
332
+ font-size: 0.8rem;
333
+ padding: 8px 12px;
334
+ background-color: rgba(0, 0, 0, 0.3);
335
+ border: none;
336
+ color: white;
337
+ border-radius: 4px;
338
+
339
+ &::placeholder {
340
+ color: rgba(255, 255, 255, 0.5);
341
+ }
342
+
343
+ &:focus {
344
+ outline: none;
345
+ background-color: rgba(0, 0, 0, 0.4);
346
+ }
347
+ }
348
+ `;