@rpg-engine/long-bow 0.5.39 → 0.5.41

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.
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { IConfirmModalProps } from '../components/ConfirmModal';
3
+ declare const meta: Meta;
4
+ export default meta;
5
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IConfirmModalProps>;
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { IShopModalProps } from '../components/ShopModal/ShopModal';
3
+ declare const meta: Meta;
4
+ export default meta;
5
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IShopModalProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.5.39",
3
+ "version": "0.5.41",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -4,7 +4,7 @@ import ModalPortal from './Abstractions/ModalPortal';
4
4
  import { Button, ButtonTypes } from './Button';
5
5
  import { DraggableContainer } from './DraggableContainer';
6
6
 
7
- interface IConfirmModalProps {
7
+ export interface IConfirmModalProps {
8
8
  onConfirm: () => void;
9
9
  onClose: () => void;
10
10
  message?: string;
@@ -66,8 +66,6 @@ type onDragStart =
66
66
  | undefined;
67
67
  type onDragEnd = ((quantity?: number) => void) | undefined;
68
68
 
69
- const MIN_SLOTS_FOR_SCROLL = 20;
70
-
71
69
  export const ItemContainer: React.FC<IItemContainerProps> = ({
72
70
  itemContainer,
73
71
  onClose,
@@ -243,11 +241,7 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
243
241
  atlasJSON={atlasJSON}
244
242
  />
245
243
  )}
246
- <ItemsContainer
247
- className="item-container-body"
248
- ref={containerRef}
249
- isScrollable={itemContainer.slotQty > MIN_SLOTS_FOR_SCROLL}
250
- >
244
+ <ItemsContainer className="item-container-body" ref={containerRef}>
251
245
  {onRenderSlots()}
252
246
  </ItemsContainer>
253
247
  </SlotsContainer>
@@ -261,16 +255,12 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
261
255
  );
262
256
  };
263
257
 
264
- interface IItemsContainerProps {
265
- isScrollable: boolean;
266
- }
267
-
268
- const ItemsContainer = styled.div<IItemsContainerProps>`
258
+ const ItemsContainer = styled.div`
269
259
  display: flex;
270
260
  justify-content: center;
271
261
  flex-wrap: wrap;
272
262
  max-height: 270px;
273
- overflow-y: ${({ isScrollable }) => (isScrollable ? 'scroll' : 'hidden')};
263
+ overflow-y: auto;
274
264
  overflow-x: hidden;
275
265
  width: 415px;
276
266
  `;
@@ -0,0 +1,119 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import ModalPortal from '../Abstractions/ModalPortal';
4
+ import { Button, ButtonTypes } from '../Button';
5
+ import { DraggableContainer } from '../DraggableContainer';
6
+ import ShopImage from './shopImage.png';
7
+
8
+ export interface IShopModalProps {
9
+ onClose: () => void;
10
+ message?: string;
11
+ url: string
12
+ }
13
+
14
+ export const ShopModal: React.FC<IShopModalProps> = ({
15
+ onClose,
16
+ message,
17
+ url,
18
+ }) => {
19
+ const openShop = () => {
20
+ window.open(url, "_blank");
21
+ onClose()
22
+ }
23
+
24
+ return (
25
+ <ModalPortal>
26
+ <Container onPointerDown={onClose}>
27
+ <DraggableContainer width="auto" dragDisabled>
28
+ <Wrapper onPointerDown={e => e.stopPropagation()}>
29
+ <BackgroundContainer />
30
+ <Description>{message ?? 'Check out our shop items to prevent future death and enhance your gameplay!'}</Description>
31
+ <ButtonsWrapper>
32
+ <div className="cancel-button">
33
+ <Button
34
+ buttonType={ButtonTypes.RPGUIButton}
35
+ onPointerDown={onClose}
36
+ >
37
+ Back to Game
38
+ </Button>
39
+ </div>
40
+ <Button
41
+ buttonType={ButtonTypes.RPGUIButton}
42
+ onPointerDown={openShop}
43
+ >
44
+ Go to Shop
45
+ </Button>
46
+ </ButtonsWrapper>
47
+ </Wrapper>
48
+ </DraggableContainer>
49
+ </Container>
50
+ </ModalPortal>
51
+ );
52
+ };
53
+
54
+ const Container = styled.div`
55
+ position: absolute;
56
+ width: 100%;
57
+ height: 100%;
58
+ left: 0;
59
+ top: 0;
60
+ display: flex;
61
+ justify-content: center;
62
+ align-items: center;
63
+ z-index: 1001;
64
+ `;
65
+
66
+ const Wrapper = styled.div`
67
+ p {
68
+ margin: 0;
69
+ }
70
+ `;
71
+
72
+ const ButtonsWrapper = styled.div`
73
+ display: flex;
74
+ justify-content: space-around;
75
+ gap: 5px;
76
+ margin-top: 5px;
77
+ padding-left: 10%;
78
+ padding-right: 10%;
79
+
80
+ .cancel-button {
81
+ filter: grayscale(0.7);
82
+ }
83
+ `;
84
+
85
+ const Description = styled.div`
86
+ padding-left: 15%;
87
+ padding-right: 15%;
88
+ color: white;
89
+ font-size: 10px ;
90
+ line-height: 15px;
91
+ padding-top: 10px;
92
+ padding-bottom: 10px;
93
+ `
94
+
95
+ const BackgroundContainer = styled.div`
96
+ position: relative; /* Certifique-se de que o pai tem posição relativa */
97
+ background-image: url(${ShopImage});
98
+ background-size: 70%;
99
+ background-position: center;
100
+ background-repeat: no-repeat;
101
+ height: 300px;
102
+ margin-bottom: 10px;
103
+ ::before {
104
+ content: ''; /* necessário para pseudo-elementos */
105
+ position: absolute; /* posição absoluta em relação ao seu pai */
106
+ top: 0;
107
+ left: 0;
108
+ right: 0;
109
+ bottom: 0;
110
+ background: rgba(0, 0, 0, 0.4); /* cor de fundo preta com opacidade de 50% */
111
+ z-index: 1; /* garantir que o overlay esteja acima da imagem de fundo */
112
+ width: 70%;
113
+ margin: auto;
114
+ }
115
+ > * {
116
+ position: relative;
117
+ z-index: 2;
118
+ }
119
+ `
@@ -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: 20,
589
+ slotQty: 60,
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
+ }
@@ -0,0 +1,25 @@
1
+ import { Meta, Story } from '@storybook/react';
2
+ import React from 'react';
3
+ import { ConfirmModal, IConfirmModalProps } from '../components/ConfirmModal';
4
+ import { RPGUIRoot } from '../components/RPGUI/RPGUIRoot';
5
+
6
+ const meta: Meta = {
7
+ title: 'Modals/Confirm Modal',
8
+ component: ConfirmModal,
9
+ }
10
+
11
+ export default meta;
12
+
13
+ const Template: Story<IConfirmModalProps> = args => (
14
+ <RPGUIRoot>
15
+ <ConfirmModal {...args} />
16
+ </RPGUIRoot>
17
+ )
18
+
19
+ export const Default = Template.bind({});
20
+
21
+ Default.args = {
22
+ onConfirm: () => console.log("onConfirm"),
23
+ onClose: () => console.log("onClose"),
24
+ message: "Do you want to proceed ?"
25
+ }
@@ -0,0 +1,24 @@
1
+ import { Meta, Story } from '@storybook/react';
2
+ import React from 'react';
3
+ import { RPGUIRoot } from '../components/RPGUI/RPGUIRoot';
4
+ import { IShopModalProps, ShopModal } from '../components/ShopModal/ShopModal';
5
+
6
+ const meta: Meta = {
7
+ title: 'Modals/Shop Modal',
8
+ component: ShopModal,
9
+ }
10
+
11
+ export default meta;
12
+
13
+ const Template: Story<IShopModalProps> = args => (
14
+ <RPGUIRoot>
15
+ <ShopModal {...args} />
16
+ </RPGUIRoot>
17
+ )
18
+
19
+ export const Default = Template.bind({});
20
+
21
+ Default.args = {
22
+ onClose: () => console.log("onClose"),
23
+ url: "https://www.patreon.com/DefinyaMMORPG/shop"
24
+ }