@rpg-engine/long-bow 0.5.38 → 0.5.39

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.5.38",
3
+ "version": "0.5.39",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -66,6 +66,8 @@ type onDragStart =
66
66
  | undefined;
67
67
  type onDragEnd = ((quantity?: number) => void) | undefined;
68
68
 
69
+ const MIN_SLOTS_FOR_SCROLL = 20;
70
+
69
71
  export const ItemContainer: React.FC<IItemContainerProps> = ({
70
72
  itemContainer,
71
73
  onClose,
@@ -241,7 +243,11 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
241
243
  atlasJSON={atlasJSON}
242
244
  />
243
245
  )}
244
- <ItemsContainer className="item-container-body" ref={containerRef}>
246
+ <ItemsContainer
247
+ className="item-container-body"
248
+ ref={containerRef}
249
+ isScrollable={itemContainer.slotQty > MIN_SLOTS_FOR_SCROLL}
250
+ >
245
251
  {onRenderSlots()}
246
252
  </ItemsContainer>
247
253
  </SlotsContainer>
@@ -255,12 +261,16 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
255
261
  );
256
262
  };
257
263
 
258
- const ItemsContainer = styled.div`
264
+ interface IItemsContainerProps {
265
+ isScrollable: boolean;
266
+ }
267
+
268
+ const ItemsContainer = styled.div<IItemsContainerProps>`
259
269
  display: flex;
260
270
  justify-content: center;
261
271
  flex-wrap: wrap;
262
272
  max-height: 270px;
263
- overflow-y: auto;
273
+ overflow-y: ${({ isScrollable }) => (isScrollable ? 'scroll' : 'hidden')};
264
274
  overflow-x: hidden;
265
275
  width: 415px;
266
276
  `;
@@ -5,7 +5,7 @@ import {
5
5
  ItemSlotType,
6
6
  ItemSubType,
7
7
  ItemType,
8
- UserAccountTypes
8
+ UserAccountTypes,
9
9
  } from '@rpg-engine/shared';
10
10
 
11
11
  export const items: IItem[] = [
@@ -586,7 +586,7 @@ export const itemContainerMock = (
586
586
  _id: '629ba0b6fe3f43002f58f23b',
587
587
  name: 'Item Container',
588
588
  owner: '629ba0b6fe3f43002f58f23b',
589
- slotQty: 60,
589
+ slotQty: 20,
590
590
  slots: {
591
591
  0: items[0],
592
592
  1: items[1],
@@ -614,4 +614,4 @@ export const itemContainerMock = (
614
614
  ...props,
615
615
  };
616
616
  }
617
- }
617
+ };