@rpg-engine/long-bow 0.8.213 → 0.8.215
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/dist/components/Store/Store.d.ts +4 -0
- package/dist/long-bow.cjs.development.js +29 -4
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +30 -5
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Store/Store.tsx +8 -2
- package/src/components/Store/sections/StoreItemsSection.tsx +50 -15
package/package.json
CHANGED
|
@@ -49,6 +49,10 @@ export interface IStoreProps {
|
|
|
49
49
|
customHistoryContent?: React.ReactNode;
|
|
50
50
|
/** When true the store renders full-screen (useful on mobile). */
|
|
51
51
|
fullScreen?: boolean;
|
|
52
|
+
/** Override the DraggableContainer width (e.g. "90vw"). Defaults to "1000px". */
|
|
53
|
+
containerWidth?: string;
|
|
54
|
+
/** Override the DraggableContainer height (e.g. "80vh"). Defaults to "auto". */
|
|
55
|
+
containerHeight?: string;
|
|
52
56
|
packsBadge?: string;
|
|
53
57
|
featuredItems?: IFeaturedItem[];
|
|
54
58
|
onQuickBuy?: (item: IProductBlueprint, quantity?: number) => void;
|
|
@@ -110,6 +114,8 @@ export const Store: React.FC<IStoreProps> = ({
|
|
|
110
114
|
customWalletContent,
|
|
111
115
|
customHistoryContent,
|
|
112
116
|
fullScreen = false,
|
|
117
|
+
containerWidth,
|
|
118
|
+
containerHeight,
|
|
113
119
|
packsTabLabel = 'Packs',
|
|
114
120
|
packsBadge,
|
|
115
121
|
featuredItems,
|
|
@@ -404,9 +410,9 @@ export const Store: React.FC<IStoreProps> = ({
|
|
|
404
410
|
<DraggableContainer
|
|
405
411
|
title="Store"
|
|
406
412
|
onCloseButton={onClose}
|
|
407
|
-
width="1000px"
|
|
413
|
+
width={containerWidth ?? "1000px"}
|
|
408
414
|
minWidth="700px"
|
|
409
|
-
height="auto"
|
|
415
|
+
height={containerHeight ?? "auto"}
|
|
410
416
|
type={RPGUIContainerTypes.Framed}
|
|
411
417
|
cancelDrag="[class*='Store__Container'], [class*='CartView'], [class*='StoreItemDetails'], .close-button"
|
|
412
418
|
isFullScreen={fullScreen}
|
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
UserAccountTypes,
|
|
5
5
|
ItemType,
|
|
6
6
|
} from '@rpg-engine/shared';
|
|
7
|
-
import React, { useEffect } from 'react';
|
|
7
|
+
import React, { useEffect, useState } from 'react';
|
|
8
|
+
import { FaFilter } from 'react-icons/fa';
|
|
8
9
|
import styled from 'styled-components';
|
|
9
10
|
import { ScrollableContent } from '../../shared/ScrollableContent/ScrollableContent';
|
|
10
11
|
import { StoreCharacterSkinRow } from '../StoreCharacterSkinRow';
|
|
@@ -115,29 +116,40 @@ export const StoreItemsSection: React.FC<IStoreItemsSectionProps> = ({
|
|
|
115
116
|
);
|
|
116
117
|
};
|
|
117
118
|
|
|
119
|
+
const [showFilters, setShowFilters] = useState(false);
|
|
120
|
+
|
|
118
121
|
return (
|
|
119
122
|
<StoreContainer>
|
|
120
|
-
<
|
|
121
|
-
<
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
<FilterBar>
|
|
124
|
+
<FilterToggle $active={showFilters} onClick={() => setShowFilters(prev => !prev)}>
|
|
125
|
+
<FaFilter size={12} />
|
|
126
|
+
<span>Filter</span>
|
|
127
|
+
</FilterToggle>
|
|
128
|
+
</FilterBar>
|
|
129
|
+
|
|
130
|
+
{showFilters && (
|
|
131
|
+
<SearchHeader>
|
|
132
|
+
<SearchBarContainer>
|
|
133
|
+
<SearchBar
|
|
134
|
+
value={searchQuery}
|
|
135
|
+
onChange={setSearchQuery}
|
|
136
|
+
placeholder="Search items..."
|
|
137
|
+
/>
|
|
138
|
+
</SearchBarContainer>
|
|
139
|
+
<SegmentedToggle
|
|
140
|
+
options={categoryOptions.map(opt => ({ id: opt.value, label: opt.option }))}
|
|
141
|
+
activeId={selectedCategory}
|
|
142
|
+
onChange={id => setSelectedCategory(id as ItemType | 'all')}
|
|
126
143
|
/>
|
|
127
|
-
</
|
|
128
|
-
|
|
129
|
-
options={categoryOptions.map(opt => ({ id: opt.value, label: opt.option }))}
|
|
130
|
-
activeId={selectedCategory}
|
|
131
|
-
onChange={id => setSelectedCategory(id as ItemType | 'all')}
|
|
132
|
-
/>
|
|
133
|
-
</SearchHeader>
|
|
144
|
+
</SearchHeader>
|
|
145
|
+
)}
|
|
134
146
|
|
|
135
147
|
<ScrollableContent
|
|
136
148
|
items={filteredItems}
|
|
137
149
|
renderItem={renderStoreItem}
|
|
138
150
|
emptyMessage="No items match your filters."
|
|
139
151
|
layout="list"
|
|
140
|
-
maxHeight="
|
|
152
|
+
maxHeight="none"
|
|
141
153
|
/>
|
|
142
154
|
</StoreContainer>
|
|
143
155
|
);
|
|
@@ -160,3 +172,26 @@ const SearchHeader = styled.div`
|
|
|
160
172
|
const SearchBarContainer = styled.div`
|
|
161
173
|
flex: 0.75;
|
|
162
174
|
`;
|
|
175
|
+
|
|
176
|
+
const FilterBar = styled.div`
|
|
177
|
+
display: flex;
|
|
178
|
+
padding-top: 0.25rem;
|
|
179
|
+
`;
|
|
180
|
+
|
|
181
|
+
const FilterToggle = styled.button<{ $active: boolean }>`
|
|
182
|
+
display: flex;
|
|
183
|
+
align-items: center;
|
|
184
|
+
gap: 0.4rem;
|
|
185
|
+
background: ${({ $active }) => ($active ? 'rgba(255,255,255,0.15)' : 'transparent')};
|
|
186
|
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
187
|
+
color: #fff;
|
|
188
|
+
padding: 0.3rem 0.6rem;
|
|
189
|
+
border-radius: 4px;
|
|
190
|
+
cursor: pointer;
|
|
191
|
+
font-family: 'Press Start 2P', cursive;
|
|
192
|
+
font-size: 0.55rem;
|
|
193
|
+
|
|
194
|
+
&:hover {
|
|
195
|
+
background: rgba(255, 255, 255, 0.1);
|
|
196
|
+
}
|
|
197
|
+
`;
|