@rpg-engine/long-bow 0.2.45 → 0.2.47

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.
Files changed (30) hide show
  1. package/dist/components/StaticBook/StaticBook.d.ts +5 -8
  2. package/dist/components/TimeWidget/DayNightPeriod/DayNightPeriod.d.ts +6 -0
  3. package/dist/components/TimeWidget/TimeWidget.d.ts +8 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/long-bow.cjs.development.js +65 -12
  6. package/dist/long-bow.cjs.development.js.map +1 -1
  7. package/dist/long-bow.cjs.production.min.js +1 -1
  8. package/dist/long-bow.cjs.production.min.js.map +1 -1
  9. package/dist/long-bow.esm.js +66 -14
  10. package/dist/long-bow.esm.js.map +1 -1
  11. package/dist/stories/DayNightPeriod.stories.d.ts +2 -2
  12. package/dist/stories/StaticBook.stories.d.ts +2 -2
  13. package/dist/stories/TimeWidget.stories.d.ts +5 -0
  14. package/package.json +2 -2
  15. package/src/components/Item/Inventory/ItemSlot.tsx +35 -17
  16. package/src/components/StaticBook/StaticBook.tsx +85 -76
  17. package/src/components/TimeWidget/DayNightPeriod/DayNightPeriod.tsx +31 -0
  18. package/src/components/{DayNightPeriod/Gif/Afternoon.gif → TimeWidget/DayNightPeriod/gif/afternoon.gif} +0 -0
  19. package/src/components/{DayNightPeriod/Gif/Morning.gif → TimeWidget/DayNightPeriod/gif/morning.gif} +0 -0
  20. package/src/components/{DayNightPeriod/Gif/Night.gif → TimeWidget/DayNightPeriod/gif/night.gif} +0 -0
  21. package/src/components/TimeWidget/TimeWidget.tsx +63 -0
  22. package/src/components/TimeWidget/img/clockwidget.png +0 -0
  23. package/src/components/shared/Ellipsis.tsx +1 -1
  24. package/src/index.tsx +1 -0
  25. package/src/mocks/itemContainer.mocks.ts +46 -12
  26. package/src/stories/DayNightPeriod.stories.tsx +15 -8
  27. package/src/stories/StaticBook.stories.tsx +16 -23
  28. package/src/stories/TimeWidget.stories.tsx +27 -0
  29. package/dist/components/DayNightPeriod/DayNightPeriod.d.ts +0 -11
  30. package/src/components/DayNightPeriod/DayNightPeriod.tsx +0 -36
@@ -1,5 +1,5 @@
1
1
  import { Meta } from '@storybook/react';
2
- import { PeriodOfDayProps } from '../components/DayNightPeriod/DayNightPeriod';
2
+ import { IPeriodOfDayDisplayProps } from '../components/TimeWidget/DayNightPeriod/DayNightPeriod';
3
3
  declare const meta: Meta;
4
4
  export default meta;
5
- export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, PeriodOfDayProps>;
5
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IPeriodOfDayDisplayProps>;
@@ -1,5 +1,5 @@
1
1
  import { Meta } from '@storybook/react';
2
- import { StaticBookProps } from '../components/StaticBook/StaticBook';
2
+ import { IStaticBookProps } from '../components/StaticBook/StaticBook';
3
3
  declare const meta: Meta;
4
4
  export default meta;
5
- export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, StaticBookProps>;
5
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IStaticBookProps>;
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { IClockWidgetProps } from '../components/TimeWidget/TimeWidget';
3
+ declare const meta: Meta;
4
+ export default meta;
5
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IClockWidgetProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.2.45",
3
+ "version": "0.2.47",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "dependencies": {
85
85
  "@rollup/plugin-image": "^2.1.1",
86
- "@rpg-engine/shared": "^0.5.70",
86
+ "@rpg-engine/shared": "^0.5.74",
87
87
  "dayjs": "^1.11.2",
88
88
  "fs-extra": "^10.1.0",
89
89
  "lodash": "^4.17.21",
@@ -11,7 +11,9 @@ import { observer } from 'mobx-react-lite';
11
11
  import React, { useEffect, useState } from 'react';
12
12
  import styled from 'styled-components';
13
13
  import { v4 as uuidv4 } from 'uuid';
14
+ import { uiFonts } from '../../../constants/uiFonts';
14
15
  import { RelativeListMenu } from '../../RelativeListMenu';
16
+ import { Ellipsis } from '../../shared/Ellipsis';
15
17
  import { SpriteFromAtlas } from '../../shared/SpriteFromAtlas';
16
18
  import { ItemTooltip } from '../Cards/ItemTooltip';
17
19
  import { ErrorBoundary } from './ErrorBoundary';
@@ -81,21 +83,26 @@ export const ItemSlot: React.FC<IProps> = observer(
81
83
  }
82
84
  }, [item]);
83
85
 
84
- const getLeftPositionValue = (quantity: number) => {
85
- if (quantity > 0 && quantity < 10) return '2.5rem';
86
- else if (quantity > 9 && quantity < 100) return '2.0rem';
87
- else if (quantity > 99) return '1rem';
88
- return '2.5rem';
89
- };
90
-
91
86
  const getStackInfo = (itemId: string, stackQty: number) => {
92
87
  // if (itemToRender?.isStackable && itemToRender?.stackQty) {
88
+
89
+ const isFractionalStackQty = stackQty % 1 !== 0;
90
+ const isLargerThan999 = stackQty > 999;
91
+
93
92
  if (stackQty > 1) {
94
93
  return (
95
- <ItemQty left={getLeftPositionValue(stackQty)} key={`qty-${itemId}`}>
96
- {' '}
97
- {stackQty}{' '}
98
- </ItemQty>
94
+ <ItemQtyContainer key={`qty-${itemId}`}>
95
+ <Ellipsis maxLines={1} maxWidth={48}>
96
+ <ItemQty
97
+ className={
98
+ isFractionalStackQty || isLargerThan999 ? 'small' : 'regular'
99
+ }
100
+ >
101
+ {' '}
102
+ {stackQty}{' '}
103
+ </ItemQty>
104
+ </Ellipsis>
105
+ </ItemQtyContainer>
99
106
  );
100
107
  }
101
108
  return undefined;
@@ -233,11 +240,22 @@ const Container = styled.div`
233
240
  position: relative;
234
241
  `;
235
242
 
236
- interface IItemQtyProps {
237
- left: string;
238
- }
239
- const ItemQty = styled.span<IItemQtyProps>`
243
+ const ItemQtyContainer = styled.div`
240
244
  position: relative;
241
- top: 1.5rem;
242
- left: ${props => props.left};
245
+ width: 85%;
246
+ height: 16px;
247
+ top: 25px;
248
+ left: 2px;
249
+
250
+ display: flex;
251
+ justify-content: flex-end;
252
+ `;
253
+
254
+ const ItemQty = styled.span`
255
+ &.regular {
256
+ font-size: ${uiFonts.size.small};
257
+ }
258
+ &.small {
259
+ font-size: ${uiFonts.size.xsmall};
260
+ }
243
261
  `;
@@ -1,96 +1,105 @@
1
1
  import React, { useEffect, useState } from 'react';
2
+ import Draggable from 'react-draggable';
2
3
  import styled from 'styled-components';
4
+ import { uiFonts } from '../../constants/uiFonts';
3
5
  import SelectArrow from '../Arrow/SelectArrow';
4
6
  import Book from './img/0.png';
5
7
 
6
- export interface StaticBookProps {
7
- availableBook: Array<staticProps>;
8
- onChange: (selectedBook: staticProps) => void;
8
+ export interface IStaticBookProps {
9
+ content: string;
10
+ onChange?: (slice: string) => void;
11
+ onClose?: () => void;
9
12
  }
10
13
 
11
- export interface staticProps {
12
- text: string;
13
- }
14
-
15
- export const StaticBook: React.FC<StaticBookProps> = ({
16
- availableBook,
17
- onChange,
14
+ export const StaticBook: React.FC<IStaticBookProps> = ({
15
+ content,
16
+ onChange,
17
+ onClose,
18
18
  }) => {
19
- const [currentIndex, setCurrentIndex] = useState(0);
20
- const bookLength = availableBook.length - 1;
19
+ const [currentIndex, setCurrentIndex] = useState(0);
21
20
 
22
- const onLeftClick = () => {
23
- if (currentIndex === 0) setCurrentIndex(bookLength);
24
- else setCurrentIndex(index => index - 1);
25
- };
26
- const onRightClick = () => {
27
- if (currentIndex === bookLength) setCurrentIndex(0);
28
- else setCurrentIndex(index => index + 1);
29
- };
21
+ // create slicedContent with string sliced every 550 characters
22
+ const slicedContent = content.match(/.{1,550}/g) || [];
30
23
 
31
- useEffect(() => {
32
- onChange(availableBook[currentIndex]);
33
- }, [currentIndex]);
24
+ useEffect(() => {
25
+ if (onChange) onChange(slicedContent[currentIndex]);
26
+ }, [currentIndex]);
34
27
 
35
- useEffect(() => {
36
- setCurrentIndex(0);
37
- }, [JSON.stringify(availableBook)]);
28
+ const bookLength = slicedContent.length - 1;
38
29
 
39
- const getCurrentSelectionName = () => {
40
- const item = availableBook[currentIndex];
41
- if (item) {
42
- return item.text.slice(0, 600);
43
- }
44
- return '';
45
- };
30
+ const onLeftClick = () => {
31
+ if (currentIndex === 0) setCurrentIndex(bookLength);
32
+ else setCurrentIndex(index => index - 1);
33
+ };
34
+ const onRightClick = () => {
35
+ if (currentIndex === bookLength) setCurrentIndex(0);
36
+ else setCurrentIndex(index => index + 1);
37
+ };
46
38
 
47
- return (
48
- <Container>
49
- <Textbook><Colunbook>{getCurrentSelectionName()}</Colunbook></Textbook>
50
- <ArrowContainer>
51
- <SelectArrow
52
- direction="left"
53
- onClick={onLeftClick}
54
- onTouchStart={onLeftClick}
55
- ></SelectArrow>
56
- <SelectArrow
57
- direction="right"
58
- onClick={onRightClick}
59
- onTouchStart={onRightClick}
60
- ></SelectArrow>
61
- </ArrowContainer>
62
- </Container>
63
- );
64
- };
39
+ const getCurrentContentSlice = () => {
40
+ return slicedContent[currentIndex];
41
+ };
65
42
 
43
+ return (
44
+ <Draggable>
45
+ <Container>
46
+ <CloseButton onClick={onClose}>X</CloseButton>
47
+ <ColumnBook isLastPage={currentIndex === bookLength}>
48
+ {getCurrentContentSlice()}
49
+ </ColumnBook>
50
+
51
+ <ArrowContainer>
52
+ {currentIndex >= 1 && (
53
+ <SelectArrow
54
+ direction="left"
55
+ onClick={onLeftClick}
56
+ onTouchStart={onLeftClick}
57
+ ></SelectArrow>
58
+ )}
59
+ {currentIndex !== bookLength && (
60
+ <SelectArrow
61
+ direction="right"
62
+ onClick={onRightClick}
63
+ onTouchStart={onRightClick}
64
+ ></SelectArrow>
65
+ )}
66
+ </ArrowContainer>
67
+ </Container>
68
+ </Draggable>
69
+ );
70
+ };
66
71
 
67
72
  const Container = styled.div`
68
- background-image: url(${Book});
69
- background-repeat:no-repeat;
70
- position: relative;
71
- width: 778px;
72
- height: 538px;
73
-
74
- `;
75
- const Textbook = styled.span`
76
- position: absolute;
77
- padding-left: 6em;
78
- display: flex;
79
-
80
- `;
81
- const Colunbook = styled.span`
82
- padding-left: 3px;
83
- padding-top: 70px;
84
- width: 86%;
85
- column-count:2;
86
- grid-gap: 50px;
73
+ background-image: url(${Book});
74
+ background-repeat: no-repeat;
75
+ position: relative;
76
+ width: 778px;
77
+ height: 463px;
78
+ background-position-y: -1rem;
79
+ `;
87
80
 
88
- `;
81
+ const CloseButton = styled.p`
82
+ position: absolute;
83
+ top: 1.9rem;
84
+ right: 5rem;
85
+ font-size: ${uiFonts.size.large} !important;
86
+ `;
87
+
88
+ interface IColumnBook {
89
+ isLastPage: boolean;
90
+ }
91
+
92
+ const ColumnBook = styled.span<IColumnBook>`
93
+ position: absolute;
94
+ left: 5.2rem;
95
+ top: 3.8rem;
96
+ width: ${({ isLastPage }) => (!isLastPage ? '77%' : '37%')};
97
+ column-count: ${({ isLastPage }) => (isLastPage ? 1 : 2)};
98
+ grid-gap: 56px;
99
+ min-height: 340px;
100
+ `;
89
101
  const ArrowContainer = styled.span`
90
102
  display: flex;
91
- height:100% ;
103
+ height: 100%;
92
104
  align-items: center;
93
-
94
- `;
95
-
96
- export default StaticBook;
105
+ `;
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { PeriodOfDay } from '@rpg-engine/shared';
5
+ import AfternoonGif from './gif/afternoon.gif';
6
+ import MorningGif from './gif/morning.gif';
7
+ import NightGif from './gif/night.gif';
8
+
9
+ export interface IPeriodOfDayDisplayProps {
10
+ periodOfDay: PeriodOfDay;
11
+ }
12
+
13
+ export const DayNightPeriod: React.FC<IPeriodOfDayDisplayProps> = ({
14
+ periodOfDay,
15
+ }) => {
16
+ const periodOfDaySrcFiles = {
17
+ [PeriodOfDay.Morning]: MorningGif,
18
+ [PeriodOfDay.Afternoon]: AfternoonGif,
19
+ [PeriodOfDay.Night]: NightGif,
20
+ };
21
+
22
+ return (
23
+ <GifContainer>
24
+ <img src={periodOfDaySrcFiles[periodOfDay]} />
25
+ </GifContainer>
26
+ );
27
+ };
28
+
29
+ const GifContainer = styled.span`
30
+ width: 100%;
31
+ `;
@@ -0,0 +1,63 @@
1
+ import { PeriodOfDay } from '@rpg-engine/shared';
2
+ import React from 'react';
3
+ import Draggable from 'react-draggable';
4
+ import styled from 'styled-components';
5
+ import { uiFonts } from '../../constants/uiFonts';
6
+ import { DayNightPeriod } from './DayNightPeriod/DayNightPeriod';
7
+
8
+ import ClockWidgetImg from './img/clockwidget.png';
9
+
10
+ export interface IClockWidgetProps {
11
+ onClose?: () => void;
12
+ TimeClock: string;
13
+ periodOfDay: PeriodOfDay;
14
+ }
15
+
16
+ export const TimeWidget: React.FC<IClockWidgetProps> = ({
17
+ onClose,
18
+ TimeClock,
19
+ periodOfDay,
20
+ }) => {
21
+ return (
22
+ <Draggable>
23
+ <WidgetContainer>
24
+ <CloseButton onClick={onClose}>X</CloseButton>
25
+ <DayNightContainer>
26
+ <DayNightPeriod periodOfDay={periodOfDay} />
27
+ </DayNightContainer>
28
+ <Time>{TimeClock}</Time>
29
+ </WidgetContainer>
30
+ </Draggable>
31
+ );
32
+ };
33
+
34
+ const WidgetContainer = styled.div`
35
+ background-image: url(${ClockWidgetImg});
36
+ background-repeat: no-repeat;
37
+ width: 100%;
38
+ position: absolute;
39
+ margin: 20px;
40
+ `;
41
+
42
+ const Time = styled.div`
43
+ width: 100%;
44
+ top: -6.95rem;
45
+ right: -4.4rem;
46
+ position: relative;
47
+ font-size: 7.5px;
48
+ color: white;
49
+ `;
50
+
51
+ const CloseButton = styled.p`
52
+ width: 100%;
53
+ position: relative;
54
+ top: -1rem;
55
+ right: -6.9rem;
56
+ font-size: ${uiFonts.size.xxsmall} !important;
57
+ z-index: 1;
58
+ `;
59
+ const DayNightContainer = styled.span`
60
+ top: -41px;
61
+ left: -3px;
62
+ position: relative;
63
+ `;
@@ -16,7 +16,7 @@ export const Ellipsis = ({
16
16
  }: IProps) => {
17
17
  return (
18
18
  <Container maxWidth={maxWidth} fontSize={fontSize}>
19
- <p className={`ellipsis-${maxLines}-lines`}>{children}</p>
19
+ <div className={`ellipsis-${maxLines}-lines`}>{children}</div>
20
20
  </Container>
21
21
  );
22
22
  };
package/src/index.tsx CHANGED
@@ -25,6 +25,7 @@ export * from './components/shared/SpriteFromAtlas';
25
25
  export * from './components/SkillProgressBar';
26
26
  export * from './components/SkillsContainer';
27
27
  export * from './components/TextArea';
28
+ export * from './components/TimeWidget/TimeWidget';
28
29
  export * from './components/TradingMenu/TradingMenu';
29
30
  export * from './components/Truncate';
30
31
  export * from './components/typography/DynamicText';
@@ -116,7 +116,7 @@ export const items: IItem[] = [
116
116
  isEquipable: false,
117
117
  isStackable: true,
118
118
  maxStackSize: 99,
119
- stackQty: 13,
119
+ stackQty: 100,
120
120
  isUsable: true,
121
121
  isStorable: true,
122
122
  isTwoHanded: false,
@@ -148,7 +148,7 @@ export const items: IItem[] = [
148
148
  allowedEquipSlotType: [ItemSlotType.Inventory],
149
149
  isEquipable: false,
150
150
  isStackable: true,
151
- maxStackSize: 999,
151
+ maxStackSize: 100,
152
152
  isTwoHanded: false,
153
153
 
154
154
  isUsable: true,
@@ -181,7 +181,7 @@ export const items: IItem[] = [
181
181
  allowedEquipSlotType: [ItemSlotType.Inventory],
182
182
  isEquipable: false,
183
183
  isStackable: true,
184
- maxStackSize: 999,
184
+ maxStackSize: 100,
185
185
  stackQty: 32,
186
186
  isUsable: false,
187
187
  isStorable: true,
@@ -214,7 +214,7 @@ export const items: IItem[] = [
214
214
  allowedEquipSlotType: [ItemSlotType.Inventory],
215
215
  isEquipable: false,
216
216
  isStackable: true,
217
- maxStackSize: 999,
217
+ maxStackSize: 100,
218
218
 
219
219
  isUsable: false,
220
220
  isStorable: true,
@@ -250,7 +250,7 @@ export const items: IItem[] = [
250
250
  allowedEquipSlotType: [ItemSlotType.Accessory],
251
251
  isEquipable: true,
252
252
  isStackable: true,
253
- maxStackSize: 999,
253
+ maxStackSize: 100,
254
254
  stackQty: 1,
255
255
  isUsable: false,
256
256
  isStorable: true,
@@ -284,7 +284,7 @@ export const items: IItem[] = [
284
284
  allowedEquipSlotType: [ItemSlotType.Accessory],
285
285
  isEquipable: true,
286
286
  isStackable: true,
287
- maxStackSize: 999,
287
+ maxStackSize: 100,
288
288
  stackQty: 2,
289
289
  isUsable: false,
290
290
  isStorable: true,
@@ -318,7 +318,7 @@ export const items: IItem[] = [
318
318
  allowedEquipSlotType: [ItemSlotType.Accessory],
319
319
  isEquipable: true,
320
320
  isStackable: true,
321
- maxStackSize: 999,
321
+ maxStackSize: 100,
322
322
  stackQty: 3,
323
323
  isUsable: false,
324
324
  isStorable: true,
@@ -352,7 +352,7 @@ export const items: IItem[] = [
352
352
  allowedEquipSlotType: [ItemSlotType.Accessory],
353
353
  isEquipable: true,
354
354
  isStackable: true,
355
- maxStackSize: 999,
355
+ maxStackSize: 100,
356
356
  stackQty: 4,
357
357
  isUsable: false,
358
358
  isStorable: true,
@@ -386,7 +386,7 @@ export const items: IItem[] = [
386
386
  allowedEquipSlotType: [ItemSlotType.Accessory],
387
387
  isEquipable: true,
388
388
  isStackable: true,
389
- maxStackSize: 999,
389
+ maxStackSize: 100,
390
390
  stackQty: 5,
391
391
  isUsable: false,
392
392
  isStorable: true,
@@ -420,8 +420,42 @@ export const items: IItem[] = [
420
420
  allowedEquipSlotType: [],
421
421
  isEquipable: true,
422
422
  isStackable: true,
423
- maxStackSize: 999,
424
- stackQty: 1345,
423
+ maxStackSize: 100,
424
+ stackQty: 9999,
425
+ isUsable: false,
426
+ isStorable: true,
427
+ isTwoHanded: false,
428
+ layer: 1,
429
+ isItemContainer: true,
430
+ isSolid: false,
431
+ key: 'gold-coin',
432
+ texturePath: 'others/gold-coin.png',
433
+ textureKey: 'gold-coin',
434
+ name: 'gold-coin',
435
+ generateContainerSlots: 10,
436
+ description: 'You see a coin.',
437
+ attack: 7,
438
+ defense: 3,
439
+ weight: 13,
440
+ tiledId: 67,
441
+ x: 320,
442
+ y: 144,
443
+ scene: 'MainScene',
444
+ fullDescription: 'You see a stone. It is used with slingshot',
445
+ createdAt: '2022-06-04T03:18:09.335Z',
446
+ updatedAt: '2022-06-04T18:16:49.056Z',
447
+ },
448
+ {
449
+ _id: '392acek4j7c8e80d2fs60404',
450
+ hasUseWith: false,
451
+ type: ItemType.Other,
452
+ subType: ItemSubType.Other,
453
+ textureAtlas: 'items',
454
+ allowedEquipSlotType: [],
455
+ isEquipable: true,
456
+ isStackable: true,
457
+ maxStackSize: 100,
458
+ stackQty: 3.75,
425
459
  isUsable: false,
426
460
  isStorable: true,
427
461
  isTwoHanded: false,
@@ -466,7 +500,7 @@ export const itemContainerMock: IItemContainer = {
466
500
  10: items[10],
467
501
  11: items[11],
468
502
  12: items[12],
469
- // 13: items[13],
503
+ 13: items[13],
470
504
  // 14: items[14],
471
505
  //remaining slots are considered null by default
472
506
  },
@@ -1,20 +1,27 @@
1
+ import { PeriodOfDay } from '@rpg-engine/shared';
1
2
  import { Meta, Story } from '@storybook/react';
2
3
  import React from 'react';
3
- import DayNightPeriod, { IPeriodOfDay, PeriodOfDay, PeriodOfDayProps } from '../components/DayNightPeriod/DayNightPeriod';
4
4
  import { RPGUIRoot } from '../components/RPGUIRoot';
5
-
5
+ import {
6
+ DayNightPeriod,
7
+ IPeriodOfDayDisplayProps,
8
+ } from '../components/TimeWidget/DayNightPeriod/DayNightPeriod';
6
9
 
7
10
  const meta: Meta = {
8
- title: 'Day and Night Period',
9
- component: DayNightPeriod,
11
+ title: 'Day and Night Period',
12
+ component: DayNightPeriod,
10
13
  };
11
14
 
12
15
  export default meta;
13
16
 
14
- const Template: Story<PeriodOfDayProps> = () => (
15
- <RPGUIRoot>
16
- <PeriodOfDay periodOfDay={IPeriodOfDay.Afternoon} />
17
- </RPGUIRoot>
17
+ const Template: Story<IPeriodOfDayDisplayProps> = args => (
18
+ <RPGUIRoot>
19
+ <DayNightPeriod {...args} />
20
+ </RPGUIRoot>
18
21
  );
19
22
 
20
23
  export const Default = Template.bind({});
24
+
25
+ Default.args = {
26
+ periodOfDay: PeriodOfDay.Morning,
27
+ };
@@ -1,39 +1,32 @@
1
1
  import { Meta, Story } from '@storybook/react';
2
2
  import React from 'react';
3
3
  import { RPGUIRoot } from '..';
4
-
5
- import StaticBook, { StaticBookProps } from '../components/StaticBook/StaticBook';
4
+ import {
5
+ IStaticBookProps,
6
+ StaticBook,
7
+ } from '../components/StaticBook/StaticBook';
6
8
 
7
9
  const meta: Meta = {
8
- title: 'Static Book',
9
- component: StaticBook,
10
+ title: 'Static Book',
11
+ component: StaticBook,
10
12
  };
11
13
 
12
14
  export default meta;
13
15
 
14
- const Template: Story<StaticBookProps> = args => (
15
- <RPGUIRoot>
16
- <StaticBook {...args} />
17
- </RPGUIRoot>
16
+ const Template: Story<IStaticBookProps> = args => (
17
+ <RPGUIRoot>
18
+ <StaticBook
19
+ {...args}
20
+ onClose={() => console.log('Trying to close the book!')}
21
+ />
22
+ </RPGUIRoot>
18
23
  );
19
24
 
20
25
  export const Default = Template.bind({});
21
26
 
22
- const bookMock = [
23
- {
24
- text: '1 ... Computers and RPGs have always gone hand-in-hand. Even when the bes and Oubliette. A few, such as Oubliette, had simple graphics, though most started out as just text or used ASCII’s standard set of text-mode graphics The most successful dungeon crawler of all time is, of course, Blizzard’s Diablo. But Rogue’s longest-lived descendent is arguably a much more interesting game—1987’s Nethack. Technically, it was based on a Rogue clone called, yes, Hack, but let’s not quibble. Nethack takes the basic dungeon crawling concept and adds several decades worth of development.',
25
- },
26
- {
27
- text: '2 ... The original PC RPGs—such as MUDs, or multi-user dungeons—appeared in the mid-70s. These weren’t for home computers, but mainframes, typically found in universities. They tended to be based on either Dungeons & Dragons, which itself launched in 1974, or be variously disguised takes on Tolkien. These included Dungeon, DND, Orthanc, and Oubliette. A few, such as Oubliette, had simple graphics, though most started out as just text or used ASCII’s standard set of text-mode graphics The most successful dungeon crawler of all time is, of course, Blizzard’s Diablo. But Rogue’s longest-lived descendent is arguably a much more interesting game—1987’s Nethack. Technically, it was based on a Rogue clone called, yes, Hack, but let’s not quibble. Nethack takes the basic dungeon crawling concept and adds several decades worth of development. ',
28
- },
29
- {
30
- text: '3 ... Despite the primitive technology, these games often offered surprising depth. Don Daglow’s Dungeon for instance, a 1975 D&D pastiche, offered control of an entire multiplayer party, mapping, NPCs with AI, line-of-sight-based combat, and both melee and ranged attacks. Moria, from the same year, served up wireframe graphics for its characters, and even featured rudimentary 3D views of its corridors. Small ones, with no detail, but let’s not forget that even Space Invaders wasn’t out yet! Ever wondered if throwing a custard pie in a basilisk’s face will stop its petrifying stare? Nethack not only answers that question (it will), but also implements blindness if you get hit by a pie yourself, causes you to break your code if a vegan character eats one (seriously), and ensures the attack doesn’t count if you’re on a pacifist run (it does no damage, no matter your combat bonus). This level of detail lead to the saying “The Dev Team Thinks Of Everything”. Many versions are now available, from the original ASCII-based game to graphical overhauls like Vulture’s Eye. All are free, as a condition of the distribution licence. ',
31
- },
32
- {
33
- text: '4 ... Despite the primitive technology, these games often offered surprising depth. Don Daglow’s Dungeon for instance, a 1975 D&D pastiche, offered control of an entire multiplayer party, mapping, NPCs with AI, line-of-sight-based combat, and both melee and ranged attacks. Moria, from the same year, served up wireframe graphics for its characters, and even featured rudimentary 3D views of its corridors. Small ones, with no detail, but let’s not forget that even Space Invaders wasn’t out yet! Ever wondered if throwing a custard pie in a basilisk’s face will stop its petrifying stare? Nethack not only answers that question (it will), but also implements blindness if you get hit by a pie yourself, causes you to break your code if a vegan character eats one (seriously), and ensures the attack doesn’t count if you’re on a pacifist run (it does no damage, no matter your combat bonus). This level of detail lead to the saying “The Dev Team Thinks Of Everything”. Many versions are now available, from the original ASCII-based game to graphical overhauls like Vulture’s Eye. All are free, as a condition of the distribution licence. ',
34
- },
35
- ];
27
+ const bookMock =
28
+ 'Computers and RPGs have always gone hand-in-hand. Even when the bes and Oubliette. A few, such as Oubliette, had simple graphics, though most started out as just text or used ASCII’s standard set of text-mode graphics The most successful dungeon crawler of all time is, of course, Blizzard’s Diablo. But Rogue’s longest-lived descendent is arguably a much more interesting game—1987’s Nethack. Technically, it was based on a Rogue clone called, yes, Hack, but let’s not quibble. Nethack takes the basic dungeon crawling concept and adds several decades worth of development. The original PC RPGs—such as MUDs, or multi-user dungeons—appeared in the mid-70s. These weren’t for home computers, but mainframes, typically found in universities. They tended to be based on either Dungeons & Dragons, which itself launched in 1974, or be variously disguised takes on Tolkien. These included Dungeon, DND, Orthanc, and Oubliette. A few, such as Oubliette, had simple graphics, though most started out as just text or used ASCII’s standard set of text-mode graphics The most successful dungeon crawler of all time is, of course, Blizzard’s Diablo. But Rogue’s longest-lived descendent is arguably a much more interesting game—1987’s Nethack. Technically, it was based on a Rogue clone called, yes, Hack, but let’s not quibble. Nethack takes the basic dungeon crawling concept and adds several decades worth of development. Despite the primitive technology, these games often offered surprising depth. Don Daglow’s Dungeon for instance, a 1975 D&D pastiche, offered control of an entire multiplayer party, mapping, NPCs with AI, line-of-sight-based combat, and both melee and ranged attacks. Moria, from the same year, served up wireframe graphics for its characters, and even featured rudimentary 3D views of its corridors. Small ones, with no detail, but let’s not forget that even Space Invaders wasn’t out yet! Ever wondered if throwing a custard pie in a basilisk’s face will stop its petrifying stare? Nethack not only answers that question (it will), but also implements blindness if you get hit by a pie yourself, causes you to break your code if a vegan character eats one (seriously), and ensures the attack doesn’t count if you’re on a pacifist run (it does no damage, no matter your combat bonus). This level of detail lead to the saying “The Dev Team Thinks Of Everything”. Many versions are now available, from the original ASCII-based game to graphical overhauls like Vulture’s Eye. All are free, as a condition of the distribution licence. While the original Rogue was a single-player game, the first multiplayer game was probably 1980’s MUD, or Multi-User Dungeon. This was a text-based game, but with the ability to play with other people. It was also the first game to use the term “multiplayer” in its name. MUDs were hugely popular, and spawned a whole genre of games, including the aforementioned Nethack. The most successful of these was probably 1988’s MUD1, which was so popular that it was ported to the Commodore 64. The most successful of these was probably 1988’s MUD1, which was so popular that it was ported to the Commodore 64. The most successful of these was probably 1988’s MUD1, which was so popular that it was ported to the Commodore 64. The most successful of these was probably 1988’s MUD1, which was so popular that it was ported to the Commodore 64. ';
36
29
 
37
30
  Default.args = {
38
- availableBook: bookMock,
31
+ content: bookMock,
39
32
  };