@rpg-engine/long-bow 0.8.133 → 0.8.135

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.8.133",
3
+ "version": "0.8.135",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,6 +1,5 @@
1
- import React, { useCallback } from 'react';
2
- import { FaCreditCard } from 'react-icons/fa';
3
- import { GiCrystalBall } from 'react-icons/gi';
1
+ import React, { useCallback, useState } from 'react';
2
+ import { FaTimes } from 'react-icons/fa';
4
3
  import styled from 'styled-components';
5
4
  import ModalPortal from '../Abstractions/ModalPortal';
6
5
  import { Button, ButtonTypes } from '../Button';
@@ -12,15 +11,30 @@ export interface IPaymentMethodModalProps {
12
11
  onClose: () => void;
13
12
  }
14
13
 
14
+ type PaymentMethod = 'dc' | 'card';
15
+
15
16
  export const PaymentMethodModal: React.FC<IPaymentMethodModalProps> = ({
16
17
  dcBalance,
17
18
  onPayWithDC,
18
19
  onPayWithCard,
19
20
  onClose,
20
21
  }) => {
21
- const stopPropagation = useCallback((e: React.MouseEvent | React.TouchEvent | React.PointerEvent) => {
22
- e.stopPropagation();
23
- }, []);
22
+ const [selected, setSelected] = useState<PaymentMethod>('card');
23
+
24
+ const stopPropagation = useCallback(
25
+ (e: React.MouseEvent | React.TouchEvent | React.PointerEvent) => {
26
+ e.stopPropagation();
27
+ },
28
+ []
29
+ );
30
+
31
+ const handleConfirm = useCallback(() => {
32
+ if (selected === 'dc') {
33
+ onPayWithDC();
34
+ } else {
35
+ onPayWithCard();
36
+ }
37
+ }, [selected, onPayWithDC, onPayWithCard]);
24
38
 
25
39
  return (
26
40
  <ModalPortal>
@@ -31,28 +45,42 @@ export const PaymentMethodModal: React.FC<IPaymentMethodModalProps> = ({
31
45
  onTouchStart={stopPropagation as React.TouchEventHandler}
32
46
  onPointerDown={stopPropagation as React.PointerEventHandler}
33
47
  >
34
- <Title>How would you like to pay?</Title>
35
-
36
- <OptionButton onClick={onPayWithDC} className="rpgui-button">
37
- <GiCrystalBall />
38
- <OptionLabel>
39
- <span>Pay with DC</span>
40
- <OptionBalance>{dcBalance.toLocaleString()} DC available</OptionBalance>
41
- </OptionLabel>
42
- </OptionButton>
43
-
44
- <OptionButton onClick={onPayWithCard} className="rpgui-button">
45
- <FaCreditCard />
46
- <OptionLabel>
47
- <span>Pay with Credit Card</span>
48
- </OptionLabel>
49
- </OptionButton>
50
-
51
- <CancelWrapper>
52
- <Button buttonType={ButtonTypes.RPGUIButton} onPointerDown={onClose}>
53
- Cancel
48
+ <Header>
49
+ <Title>How would you like to pay?</Title>
50
+ <CloseButton onPointerDown={onClose} aria-label="Close">
51
+ <FaTimes />
52
+ </CloseButton>
53
+ </Header>
54
+
55
+ <Options>
56
+ <RadioOption
57
+ $selected={selected === 'card'}
58
+ onPointerDown={() => setSelected('card')}
59
+ >
60
+ <RadioCircle $selected={selected === 'card'} />
61
+ <OptionText>
62
+ <OptionLabel>Credit Card</OptionLabel>
63
+ <OptionSub>Stripe secure checkout</OptionSub>
64
+ </OptionText>
65
+ </RadioOption>
66
+
67
+ <RadioOption
68
+ $selected={selected === 'dc'}
69
+ onPointerDown={() => setSelected('dc')}
70
+ >
71
+ <RadioCircle $selected={selected === 'dc'} />
72
+ <OptionText>
73
+ <OptionLabel>Definya Coin</OptionLabel>
74
+ <OptionSub>{dcBalance.toLocaleString()} DC available</OptionSub>
75
+ </OptionText>
76
+ </RadioOption>
77
+ </Options>
78
+
79
+ <ConfirmRow>
80
+ <Button buttonType={ButtonTypes.RPGUIButton} onPointerDown={handleConfirm}>
81
+ Confirm
54
82
  </Button>
55
- </CancelWrapper>
83
+ </ConfirmRow>
56
84
  </ModalContent>
57
85
  </ModalContainer>
58
86
  </ModalPortal>
@@ -80,14 +108,14 @@ const ModalContent = styled.div`
80
108
  background: #1a1a2e;
81
109
  border: 2px solid #f59e0b;
82
110
  border-radius: 8px;
83
- padding: 24px;
84
- min-width: 320px;
111
+ padding: 20px 24px 24px;
112
+ min-width: 300px;
85
113
  max-width: 90%;
86
114
  display: flex;
87
115
  flex-direction: column;
88
- gap: 12px;
116
+ gap: 16px;
89
117
  pointer-events: auto;
90
- animation: scaleIn 0.2s ease-out;
118
+ animation: scaleIn 0.15s ease-out;
91
119
 
92
120
  @keyframes scaleIn {
93
121
  from { transform: scale(0.85); opacity: 0; }
@@ -95,46 +123,97 @@ const ModalContent = styled.div`
95
123
  }
96
124
  `;
97
125
 
126
+ const Header = styled.div`
127
+ display: flex;
128
+ align-items: center;
129
+ justify-content: space-between;
130
+ `;
131
+
98
132
  const Title = styled.h3`
99
- margin: 0 0 8px;
133
+ margin: 0;
100
134
  font-family: 'Press Start 2P', cursive;
101
- font-size: 0.75rem;
135
+ font-size: 0.7rem;
102
136
  color: #fef08a;
103
- text-align: center;
104
137
  `;
105
138
 
106
- const OptionButton = styled.button`
139
+ const CloseButton = styled.button`
140
+ background: none;
141
+ border: none;
142
+ color: rgba(255, 255, 255, 0.6);
143
+ cursor: pointer;
144
+ font-size: 1rem;
145
+ padding: 4px;
146
+ display: flex;
147
+ align-items: center;
148
+
149
+ &:hover {
150
+ color: #ffffff;
151
+ }
152
+ `;
153
+
154
+ const Options = styled.div`
155
+ display: flex;
156
+ flex-direction: column;
157
+ gap: 8px;
158
+ `;
159
+
160
+ const RadioOption = styled.div<{ $selected: boolean }>`
107
161
  display: flex;
108
162
  align-items: center;
109
163
  gap: 12px;
110
- width: 100%;
111
- padding: 10px 14px;
164
+ padding: 10px 12px;
165
+ border: 1px solid ${({ $selected }) => ($selected ? '#f59e0b' : 'rgba(255,255,255,0.15)')};
166
+ border-radius: 6px;
167
+ background: ${({ $selected }) => ($selected ? 'rgba(245,158,11,0.1)' : 'transparent')};
112
168
  cursor: pointer;
113
- font-family: 'Press Start 2P', cursive;
114
- font-size: 0.65rem;
169
+ transition: border-color 0.15s, background 0.15s;
115
170
 
116
- svg {
117
- font-size: 1.25rem;
118
- flex-shrink: 0;
171
+ &:hover {
172
+ border-color: #f59e0b;
119
173
  }
120
174
  `;
121
175
 
122
- const OptionLabel = styled.div`
176
+ const RadioCircle = styled.div<{ $selected: boolean }>`
177
+ width: 16px;
178
+ height: 16px;
179
+ border-radius: 50%;
180
+ border: 2px solid ${({ $selected }) => ($selected ? '#f59e0b' : 'rgba(255,255,255,0.4)')};
181
+ display: flex;
182
+ align-items: center;
183
+ justify-content: center;
184
+ flex-shrink: 0;
185
+
186
+ &::after {
187
+ content: '';
188
+ width: 8px;
189
+ height: 8px;
190
+ border-radius: 50%;
191
+ background: #f59e0b;
192
+ opacity: ${({ $selected }) => ($selected ? 1 : 0)};
193
+ transition: opacity 0.15s;
194
+ }
195
+ `;
196
+
197
+ const OptionText = styled.div`
123
198
  display: flex;
124
199
  flex-direction: column;
125
- align-items: flex-start;
126
- gap: 4px;
200
+ gap: 3px;
127
201
  `;
128
202
 
129
- const OptionBalance = styled.span`
130
- font-size: 0.55rem;
131
- color: #fef08a;
132
- opacity: 0.8;
203
+ const OptionLabel = styled.span`
204
+ font-family: 'Press Start 2P', cursive;
205
+ font-size: 0.65rem;
206
+ color: #ffffff;
207
+ `;
208
+
209
+ const OptionSub = styled.span`
210
+ font-family: 'Press Start 2P', cursive;
211
+ font-size: 0.5rem;
212
+ color: rgba(255, 255, 255, 0.55);
133
213
  `;
134
214
 
135
- const CancelWrapper = styled.div`
215
+ const ConfirmRow = styled.div`
136
216
  display: flex;
137
217
  justify-content: center;
138
218
  margin-top: 4px;
139
- filter: grayscale(0.6);
140
219
  `;
package/src/index.tsx CHANGED
@@ -50,6 +50,7 @@ export * from './components/RadioButton';
50
50
  export * from './components/RangeSlider';
51
51
  export * from './components/RPGUI/RPGUIContainer';
52
52
  export * from './components/RPGUI/RPGUIRoot';
53
+ export * from './components/shared/CTAButton/CTAButton';
53
54
  export * from './components/shared/SpriteFromAtlas';
54
55
  export * from './components/Shortcuts/Shortcuts';
55
56
  export * from './components/SkillProgressBar';