@xsolla/xui-icons-currency 0.141.0 → 0.147.1
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 +1 -1
- package/README.md +0 -253
package/package.json
CHANGED
package/README.md
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
# Icons Currency
|
|
2
|
-
|
|
3
|
-
A cross-platform React virtual currency icons package containing Xsolla game currency symbols. Each icon supports colored and monochrome variants.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @xsolla/xui-icons-currency
|
|
9
|
-
# or
|
|
10
|
-
yarn add @xsolla/xui-icons-currency
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Demo
|
|
14
|
-
|
|
15
|
-
### All Currency Icons
|
|
16
|
-
|
|
17
|
-
```tsx
|
|
18
|
-
import * as React from 'react';
|
|
19
|
-
import { PlayTime, XsollaGold, XsollaPoint, XsollaTicket } from '@xsolla/xui-icons-currency';
|
|
20
|
-
|
|
21
|
-
export default function AllCurrencies() {
|
|
22
|
-
return (
|
|
23
|
-
<div style={{ display: 'flex', gap: 16 }}>
|
|
24
|
-
<PlayTime size={32} />
|
|
25
|
-
<XsollaGold size={32} />
|
|
26
|
-
<XsollaPoint size={32} />
|
|
27
|
-
<XsollaTicket size={32} />
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Colored vs Monochrome
|
|
34
|
-
|
|
35
|
-
```tsx
|
|
36
|
-
import * as React from 'react';
|
|
37
|
-
import { XsollaGold } from '@xsolla/xui-icons-currency';
|
|
38
|
-
|
|
39
|
-
export default function Variants() {
|
|
40
|
-
return (
|
|
41
|
-
<div style={{ display: 'flex', gap: 16, alignItems: 'center' }}>
|
|
42
|
-
<div>
|
|
43
|
-
<p>Colored:</p>
|
|
44
|
-
<XsollaGold size={32} variant="colored" />
|
|
45
|
-
</div>
|
|
46
|
-
<div>
|
|
47
|
-
<p>Mono:</p>
|
|
48
|
-
<XsollaGold size={32} variant="mono" />
|
|
49
|
-
</div>
|
|
50
|
-
<div>
|
|
51
|
-
<p>Custom color:</p>
|
|
52
|
-
<XsollaGold size={32} variant="mono" color="#FFD700" />
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Different Sizes
|
|
60
|
-
|
|
61
|
-
```tsx
|
|
62
|
-
import * as React from 'react';
|
|
63
|
-
import { XsollaPoint } from '@xsolla/xui-icons-currency';
|
|
64
|
-
|
|
65
|
-
export default function Sizes() {
|
|
66
|
-
return (
|
|
67
|
-
<div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
|
|
68
|
-
<XsollaPoint size={16} />
|
|
69
|
-
<XsollaPoint size={24} />
|
|
70
|
-
<XsollaPoint size={32} />
|
|
71
|
-
<XsollaPoint size={48} />
|
|
72
|
-
</div>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## Anatomy
|
|
78
|
-
|
|
79
|
-
```jsx
|
|
80
|
-
import { XsollaGold } from '@xsolla/xui-icons-currency';
|
|
81
|
-
|
|
82
|
-
<XsollaGold
|
|
83
|
-
size={24} // Size in pixels
|
|
84
|
-
variant="colored" // colored or mono
|
|
85
|
-
color="currentColor" // Color (mono variant only)
|
|
86
|
-
className="currency-icon" // CSS class
|
|
87
|
-
style={{ margin: 4 }} // Inline styles
|
|
88
|
-
aria-label="Gold" // Accessible label
|
|
89
|
-
/>
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## Examples
|
|
93
|
-
|
|
94
|
-
### Currency Balance Display
|
|
95
|
-
|
|
96
|
-
```tsx
|
|
97
|
-
import * as React from 'react';
|
|
98
|
-
import { XsollaGold, XsollaPoint, XsollaTicket } from '@xsolla/xui-icons-currency';
|
|
99
|
-
|
|
100
|
-
export default function BalanceDisplay() {
|
|
101
|
-
const balances = [
|
|
102
|
-
{ icon: XsollaGold, amount: 1250, label: 'Gold' },
|
|
103
|
-
{ icon: XsollaPoint, amount: 500, label: 'Points' },
|
|
104
|
-
{ icon: XsollaTicket, amount: 3, label: 'Tickets' },
|
|
105
|
-
];
|
|
106
|
-
|
|
107
|
-
return (
|
|
108
|
-
<div style={{ display: 'flex', gap: 24 }}>
|
|
109
|
-
{balances.map(({ icon: Icon, amount, label }) => (
|
|
110
|
-
<div key={label} style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
|
111
|
-
<Icon size={24} aria-hidden />
|
|
112
|
-
<span>{amount.toLocaleString()}</span>
|
|
113
|
-
</div>
|
|
114
|
-
))}
|
|
115
|
-
</div>
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Price Tag
|
|
121
|
-
|
|
122
|
-
```tsx
|
|
123
|
-
import * as React from 'react';
|
|
124
|
-
import { XsollaGold } from '@xsolla/xui-icons-currency';
|
|
125
|
-
|
|
126
|
-
export default function PriceTag() {
|
|
127
|
-
return (
|
|
128
|
-
<div style={{
|
|
129
|
-
display: 'inline-flex',
|
|
130
|
-
alignItems: 'center',
|
|
131
|
-
gap: 4,
|
|
132
|
-
padding: '4px 12px',
|
|
133
|
-
background: '#FFF8E1',
|
|
134
|
-
borderRadius: 16,
|
|
135
|
-
}}>
|
|
136
|
-
<XsollaGold size={20} />
|
|
137
|
-
<span style={{ fontWeight: 600 }}>500</span>
|
|
138
|
-
</div>
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### Shop Item Card
|
|
144
|
-
|
|
145
|
-
```tsx
|
|
146
|
-
import * as React from 'react';
|
|
147
|
-
import { XsollaGold } from '@xsolla/xui-icons-currency';
|
|
148
|
-
import { Button } from '@xsolla/xui-button';
|
|
149
|
-
|
|
150
|
-
export default function ShopItem() {
|
|
151
|
-
return (
|
|
152
|
-
<div style={{
|
|
153
|
-
padding: 16,
|
|
154
|
-
border: '1px solid #e0e0e0',
|
|
155
|
-
borderRadius: 8,
|
|
156
|
-
width: 200,
|
|
157
|
-
}}>
|
|
158
|
-
<img
|
|
159
|
-
src="https://example.com/item.png"
|
|
160
|
-
alt="Sword of Fire"
|
|
161
|
-
style={{ width: '100%', height: 120, objectFit: 'cover' }}
|
|
162
|
-
/>
|
|
163
|
-
<h3 style={{ margin: '12px 0 8px' }}>Sword of Fire</h3>
|
|
164
|
-
<div style={{ display: 'flex', alignItems: 'center', gap: 4, marginBottom: 12 }}>
|
|
165
|
-
<XsollaGold size={20} />
|
|
166
|
-
<span style={{ fontWeight: 600 }}>1,500</span>
|
|
167
|
-
</div>
|
|
168
|
-
<Button size="sm" fullWidth>Buy Now</Button>
|
|
169
|
-
</div>
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### Reward Notification
|
|
175
|
-
|
|
176
|
-
```tsx
|
|
177
|
-
import * as React from 'react';
|
|
178
|
-
import { XsollaGold, XsollaTicket } from '@xsolla/xui-icons-currency';
|
|
179
|
-
|
|
180
|
-
export default function RewardNotification() {
|
|
181
|
-
return (
|
|
182
|
-
<div style={{
|
|
183
|
-
display: 'flex',
|
|
184
|
-
alignItems: 'center',
|
|
185
|
-
gap: 16,
|
|
186
|
-
padding: 16,
|
|
187
|
-
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
188
|
-
borderRadius: 12,
|
|
189
|
-
color: '#fff',
|
|
190
|
-
}}>
|
|
191
|
-
<div style={{ fontSize: 24 }}>Congratulations!</div>
|
|
192
|
-
<div style={{ display: 'flex', gap: 12 }}>
|
|
193
|
-
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
|
|
194
|
-
<XsollaGold size={24} />
|
|
195
|
-
<span>+100</span>
|
|
196
|
-
</div>
|
|
197
|
-
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
|
|
198
|
-
<XsollaTicket size={24} />
|
|
199
|
-
<span>+1</span>
|
|
200
|
-
</div>
|
|
201
|
-
</div>
|
|
202
|
-
</div>
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
## API Reference
|
|
208
|
-
|
|
209
|
-
### Currency Icon Components
|
|
210
|
-
|
|
211
|
-
Each currency icon component accepts the same props:
|
|
212
|
-
|
|
213
|
-
**CurrencyIconProps:**
|
|
214
|
-
|
|
215
|
-
| Prop | Type | Default | Description |
|
|
216
|
-
| :--- | :--- | :------ | :---------- |
|
|
217
|
-
| size | `number` | `24` | Size in pixels. |
|
|
218
|
-
| variant | `"colored" \| "mono"` | `"colored"` | Icon style variant. |
|
|
219
|
-
| color | `string` | `"currentColor"` | Icon color (mono variant only). |
|
|
220
|
-
| className | `string` | - | CSS class name. |
|
|
221
|
-
| style | `CSSProperties` | - | Inline styles. |
|
|
222
|
-
| data-testid | `string` | - | Test ID (web). |
|
|
223
|
-
| testID | `string` | - | Test ID (React Native). |
|
|
224
|
-
| aria-label | `string` | - | Accessible label. |
|
|
225
|
-
| aria-hidden | `boolean` | `true` if no aria-label | Hide from screen readers. |
|
|
226
|
-
|
|
227
|
-
## Available Icons
|
|
228
|
-
|
|
229
|
-
| Component | Description |
|
|
230
|
-
| :-------- | :---------- |
|
|
231
|
-
| `PlayTime` | Time-based game currency |
|
|
232
|
-
| `XsollaGold` | Gold coin currency |
|
|
233
|
-
| `XsollaPoint` | Points/credits currency |
|
|
234
|
-
| `XsollaTicket` | Ticket/voucher currency |
|
|
235
|
-
|
|
236
|
-
## Tree Shaking
|
|
237
|
-
|
|
238
|
-
Import individual icons for optimal bundle size:
|
|
239
|
-
|
|
240
|
-
```tsx
|
|
241
|
-
// Good - only imports needed icons
|
|
242
|
-
import { XsollaGold, XsollaPoint } from '@xsolla/xui-icons-currency';
|
|
243
|
-
|
|
244
|
-
// Avoid - imports all icons
|
|
245
|
-
import * as CurrencyIcons from '@xsolla/xui-icons-currency';
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
## Accessibility
|
|
249
|
-
|
|
250
|
-
- Icons are hidden from screen readers by default (`aria-hidden="true"`)
|
|
251
|
-
- Use `aria-label` when the currency icon conveys meaningful information
|
|
252
|
-
- When displaying amounts, ensure the currency type is communicated to screen readers
|
|
253
|
-
- Consider adding visually hidden text for accessibility: "1,500 Gold coins"
|