@rpg-engine/long-bow 0.1.91 → 0.1.92
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/LICENSE +20 -20
- package/README.md +181 -181
- package/dist/components/Item/Inventory/itemContainerHelper.d.ts +2 -2
- package/dist/long-bow.cjs.development.js +49 -2
- 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 +49 -2
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +98 -98
- package/src/components/Abstractions/SlotsContainer.tsx +42 -42
- package/src/components/Button.tsx +30 -30
- package/src/components/Chat/Chat.tsx +193 -193
- package/src/components/CheckButton.tsx +65 -65
- package/src/components/DraggableContainer.tsx +150 -150
- package/src/components/Dropdown.tsx +57 -57
- package/src/components/Equipment/EquipmentSet.tsx +134 -134
- package/src/components/Input.tsx +11 -11
- package/src/components/Item/Cards/ItemTooltip.tsx +32 -32
- package/src/components/Item/Inventory/ItemContainer.tsx +65 -65
- package/src/components/Item/Inventory/ItemContainerTypes.ts +4 -4
- package/src/components/Item/Inventory/ItemSlot.tsx +199 -199
- package/src/components/Item/Inventory/itemContainerHelper.ts +94 -81
- package/src/components/ListMenu.tsx +65 -65
- package/src/components/Multitab/Tab.tsx +57 -57
- package/src/components/Multitab/TabBody.tsx +13 -13
- package/src/components/Multitab/TabsContainer.tsx +97 -97
- package/src/components/NPCDialog/NPCDialog.tsx +145 -145
- package/src/components/NPCDialog/NPCDialogText.tsx +53 -53
- package/src/components/NPCDialog/QuestionDialog/QuestionDialog.tsx +239 -239
- package/src/components/ProgressBar.tsx +91 -91
- package/src/components/PropertySelect/PropertySelect.tsx +101 -101
- package/src/components/PropertySelect/img/ui-arrows/arrow01-left-clicked.png +0 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow01-left.png +0 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow01-right-clicked.png +0 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow01-right.png +0 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow02-left-clicked.png +0 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow02-left.png +0 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow02-right-clicked.png +0 -0
- package/src/components/PropertySelect/img/ui-arrows/arrow02-right.png +0 -0
- package/src/components/QuestInfo/QuestInfo.tsx +143 -143
- package/src/components/RPGUIContainer.tsx +47 -47
- package/src/components/RPGUIRoot.tsx +14 -14
- package/src/components/RadioButton.tsx +53 -53
- package/src/components/RangeSlider.tsx +68 -68
- package/src/components/RelativeListMenu.tsx +83 -83
- package/src/components/ScrollList.tsx +77 -77
- package/src/components/SimpleProgressBar.tsx +62 -62
- package/src/components/SkillProgressBar.tsx +123 -123
- package/src/components/SkillsContainer.tsx +196 -196
- package/src/components/TextArea.tsx +11 -11
- package/src/components/Truncate.tsx +25 -25
- package/src/components/shared/Column.tsx +16 -16
- package/src/components/shared/SpriteFromAtlas.tsx +99 -99
- package/src/components/typography/DynamicText.tsx +49 -49
- package/src/constants/uiColors.ts +10 -10
- package/src/hooks/useEventListener.ts +21 -21
- package/src/hooks/useOutsideAlerter.ts +25 -25
- package/src/index.tsx +25 -25
- package/src/libs/StringHelpers.ts +3 -3
- package/src/mocks/atlas/icons/icons.json +735 -735
- package/src/mocks/atlas/items/items.json +5215 -5215
- package/src/mocks/equipmentSet.mocks.ts +347 -347
- package/src/mocks/itemContainer.mocks.ts +249 -249
- package/src/mocks/skills.mocks.ts +122 -122
- package/src/stories/Button.stories.tsx +36 -36
- package/src/stories/Chat.stories.tsx +170 -170
- package/src/stories/CheckButton.stories.tsx +48 -48
- package/src/stories/DraggableContainer.stories.tsx +28 -28
- package/src/stories/Dropdown.stories.tsx +46 -46
- package/src/stories/EquipmentSet.stories.tsx +50 -50
- package/src/stories/ItemContainer.stories.tsx +50 -50
- package/src/stories/ListMenu.stories.tsx +56 -56
- package/src/stories/Multitab.stories.tsx +51 -51
- package/src/stories/NPCDialog.stories.tsx +130 -130
- package/src/stories/ProgressBar.stories.tsx +23 -23
- package/src/stories/PropertySelect.stories.tsx +41 -41
- package/src/stories/QuestInfo.stories.tsx +76 -76
- package/src/stories/RPGUIContainers.stories.tsx +42 -42
- package/src/stories/RadioButton.stories.tsx +49 -49
- package/src/stories/RangeSlider.stories.tsx +60 -60
- package/src/stories/ScrollList.stories.tsx +85 -85
- package/src/stories/SimpleProgressBar.stories.tsx +22 -22
- package/src/stories/SkillProgressBar.stories.tsx +30 -30
- package/src/stories/SkillsContainer.stories.tsx +31 -31
- package/src/stories/Text.stories.tsx +42 -42
- package/src/types/eventTypes.ts +4 -4
- package/src/types/index.d.ts +2 -2
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
export interface IRadioItems {
|
|
4
|
-
label: string;
|
|
5
|
-
value: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface IRadioProps {
|
|
9
|
-
name: string;
|
|
10
|
-
items: IRadioItems[];
|
|
11
|
-
onChange: (value: string) => void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const InputRadio: React.FC<IRadioProps> = ({
|
|
15
|
-
name,
|
|
16
|
-
items,
|
|
17
|
-
onChange,
|
|
18
|
-
}) => {
|
|
19
|
-
const [selectedValue, setSelectedValue] = useState<string>();
|
|
20
|
-
const handleClick = () => {
|
|
21
|
-
let element = document.querySelector(
|
|
22
|
-
`input[name=${name}]:checked`
|
|
23
|
-
) as HTMLInputElement;
|
|
24
|
-
const elementValue = element.value;
|
|
25
|
-
setSelectedValue(elementValue);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (selectedValue) {
|
|
30
|
-
onChange(selectedValue);
|
|
31
|
-
}
|
|
32
|
-
}, [selectedValue]);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<div id="elemento-radio">
|
|
36
|
-
{items.map(element => {
|
|
37
|
-
return (
|
|
38
|
-
<>
|
|
39
|
-
<input
|
|
40
|
-
key={element.value}
|
|
41
|
-
className="rpgui-radio"
|
|
42
|
-
value={element.value}
|
|
43
|
-
name={name}
|
|
44
|
-
type="radio"
|
|
45
|
-
/>
|
|
46
|
-
<label onClick={handleClick}>{element.label}</label>
|
|
47
|
-
<br />
|
|
48
|
-
</>
|
|
49
|
-
);
|
|
50
|
-
})}
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface IRadioItems {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface IRadioProps {
|
|
9
|
+
name: string;
|
|
10
|
+
items: IRadioItems[];
|
|
11
|
+
onChange: (value: string) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const InputRadio: React.FC<IRadioProps> = ({
|
|
15
|
+
name,
|
|
16
|
+
items,
|
|
17
|
+
onChange,
|
|
18
|
+
}) => {
|
|
19
|
+
const [selectedValue, setSelectedValue] = useState<string>();
|
|
20
|
+
const handleClick = () => {
|
|
21
|
+
let element = document.querySelector(
|
|
22
|
+
`input[name=${name}]:checked`
|
|
23
|
+
) as HTMLInputElement;
|
|
24
|
+
const elementValue = element.value;
|
|
25
|
+
setSelectedValue(elementValue);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (selectedValue) {
|
|
30
|
+
onChange(selectedValue);
|
|
31
|
+
}
|
|
32
|
+
}, [selectedValue]);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div id="elemento-radio">
|
|
36
|
+
{items.map(element => {
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
<input
|
|
40
|
+
key={element.value}
|
|
41
|
+
className="rpgui-radio"
|
|
42
|
+
value={element.value}
|
|
43
|
+
name={name}
|
|
44
|
+
type="radio"
|
|
45
|
+
/>
|
|
46
|
+
<label onClick={handleClick}>{element.label}</label>
|
|
47
|
+
<br />
|
|
48
|
+
</>
|
|
49
|
+
);
|
|
50
|
+
})}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
-
import { useEventListener } from '../hooks/useEventListener';
|
|
5
|
-
import { _RPGUI } from './RPGUIRoot';
|
|
6
|
-
|
|
7
|
-
export enum RangeSliderType {
|
|
8
|
-
Slider = 'rpgui-slider',
|
|
9
|
-
GoldSlider = 'rpgui-slider golden',
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface IRangeSliderProps {
|
|
13
|
-
type: RangeSliderType;
|
|
14
|
-
valueMin: number;
|
|
15
|
-
valueMax: number;
|
|
16
|
-
width: string;
|
|
17
|
-
onChange: (value: number) => void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const RangeSlider: React.FC<IRangeSliderProps> = ({
|
|
21
|
-
type,
|
|
22
|
-
valueMin,
|
|
23
|
-
valueMax,
|
|
24
|
-
width,
|
|
25
|
-
onChange,
|
|
26
|
-
}) => {
|
|
27
|
-
const sliderId = uuidv4();
|
|
28
|
-
|
|
29
|
-
const [wasMouseDownFirst, setWasMouseDownFirst] = useState<boolean>(false);
|
|
30
|
-
|
|
31
|
-
useEventListener('mouseup', () => {
|
|
32
|
-
if (wasMouseDownFirst) {
|
|
33
|
-
onHandleMouseUp();
|
|
34
|
-
}
|
|
35
|
-
setWasMouseDownFirst(false);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const onHandleMouseUp = () => {
|
|
39
|
-
const rpguiSlider = document.getElementById(`rpgui-slider-${sliderId}`);
|
|
40
|
-
const value = _RPGUI.get_value(rpguiSlider);
|
|
41
|
-
|
|
42
|
-
onChange(Number(value));
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<div
|
|
47
|
-
onMouseUp={onHandleMouseUp}
|
|
48
|
-
onMouseDown={() => setWasMouseDownFirst(true)}
|
|
49
|
-
>
|
|
50
|
-
<Input
|
|
51
|
-
className={
|
|
52
|
-
type === RangeSliderType.Slider
|
|
53
|
-
? RangeSliderType.Slider
|
|
54
|
-
: RangeSliderType.GoldSlider
|
|
55
|
-
}
|
|
56
|
-
type="range"
|
|
57
|
-
style={{ width: width }}
|
|
58
|
-
min={valueMin}
|
|
59
|
-
max={valueMax}
|
|
60
|
-
id={`rpgui-slider-${sliderId}`}
|
|
61
|
-
/>
|
|
62
|
-
</div>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const Input = styled.input`
|
|
67
|
-
opacity: 0;
|
|
68
|
-
`;
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
+
import { useEventListener } from '../hooks/useEventListener';
|
|
5
|
+
import { _RPGUI } from './RPGUIRoot';
|
|
6
|
+
|
|
7
|
+
export enum RangeSliderType {
|
|
8
|
+
Slider = 'rpgui-slider',
|
|
9
|
+
GoldSlider = 'rpgui-slider golden',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IRangeSliderProps {
|
|
13
|
+
type: RangeSliderType;
|
|
14
|
+
valueMin: number;
|
|
15
|
+
valueMax: number;
|
|
16
|
+
width: string;
|
|
17
|
+
onChange: (value: number) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const RangeSlider: React.FC<IRangeSliderProps> = ({
|
|
21
|
+
type,
|
|
22
|
+
valueMin,
|
|
23
|
+
valueMax,
|
|
24
|
+
width,
|
|
25
|
+
onChange,
|
|
26
|
+
}) => {
|
|
27
|
+
const sliderId = uuidv4();
|
|
28
|
+
|
|
29
|
+
const [wasMouseDownFirst, setWasMouseDownFirst] = useState<boolean>(false);
|
|
30
|
+
|
|
31
|
+
useEventListener('mouseup', () => {
|
|
32
|
+
if (wasMouseDownFirst) {
|
|
33
|
+
onHandleMouseUp();
|
|
34
|
+
}
|
|
35
|
+
setWasMouseDownFirst(false);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const onHandleMouseUp = () => {
|
|
39
|
+
const rpguiSlider = document.getElementById(`rpgui-slider-${sliderId}`);
|
|
40
|
+
const value = _RPGUI.get_value(rpguiSlider);
|
|
41
|
+
|
|
42
|
+
onChange(Number(value));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div
|
|
47
|
+
onMouseUp={onHandleMouseUp}
|
|
48
|
+
onMouseDown={() => setWasMouseDownFirst(true)}
|
|
49
|
+
>
|
|
50
|
+
<Input
|
|
51
|
+
className={
|
|
52
|
+
type === RangeSliderType.Slider
|
|
53
|
+
? RangeSliderType.Slider
|
|
54
|
+
: RangeSliderType.GoldSlider
|
|
55
|
+
}
|
|
56
|
+
type="range"
|
|
57
|
+
style={{ width: width }}
|
|
58
|
+
min={valueMin}
|
|
59
|
+
max={valueMax}
|
|
60
|
+
id={`rpgui-slider-${sliderId}`}
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const Input = styled.input`
|
|
67
|
+
opacity: 0;
|
|
68
|
+
`;
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { useOutsideClick } from '../hooks/useOutsideAlerter';
|
|
4
|
-
|
|
5
|
-
interface IListMenuOption {
|
|
6
|
-
id: string;
|
|
7
|
-
text: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface IRelativeMenuProps {
|
|
11
|
-
options: IListMenuOption[];
|
|
12
|
-
onSelected: (selectedOptionId: string) => void;
|
|
13
|
-
fontSize?: number;
|
|
14
|
-
onOutsideClick?: () => void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const RelativeListMenu: React.FC<IRelativeMenuProps> = ({
|
|
18
|
-
options,
|
|
19
|
-
onSelected,
|
|
20
|
-
onOutsideClick,
|
|
21
|
-
fontSize = 0.8,
|
|
22
|
-
}) => {
|
|
23
|
-
const ref = useRef(null);
|
|
24
|
-
|
|
25
|
-
useOutsideClick(ref, 'relative-context-menu');
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
document.addEventListener('clickOutside', event => {
|
|
29
|
-
const e = event as CustomEvent;
|
|
30
|
-
|
|
31
|
-
if (e.detail.id === 'relative-context-menu') {
|
|
32
|
-
if (onOutsideClick) {
|
|
33
|
-
onOutsideClick();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
return () => {
|
|
39
|
-
document.removeEventListener('clickOutside', _e => {});
|
|
40
|
-
};
|
|
41
|
-
}, []);
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<Container fontSize={fontSize} ref={ref}>
|
|
45
|
-
<ul className="rpgui-list-imp" style={{ overflow: 'hidden' }}>
|
|
46
|
-
{options.map((params, index) => (
|
|
47
|
-
<ListElement
|
|
48
|
-
key={params?.id || index}
|
|
49
|
-
onClick={() => {
|
|
50
|
-
onSelected(params?.id);
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
{params?.text || 'No text'}
|
|
54
|
-
</ListElement>
|
|
55
|
-
))}
|
|
56
|
-
</ul>
|
|
57
|
-
</Container>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
interface IContainerProps {
|
|
62
|
-
fontSize?: number;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const Container = styled.div<IContainerProps>`
|
|
66
|
-
position: absolute;
|
|
67
|
-
top: 1rem;
|
|
68
|
-
left: 4rem;
|
|
69
|
-
|
|
70
|
-
display: flex;
|
|
71
|
-
flex-direction: column;
|
|
72
|
-
width: 100%;
|
|
73
|
-
justify-content: start;
|
|
74
|
-
align-items: flex-start;
|
|
75
|
-
|
|
76
|
-
li {
|
|
77
|
-
font-size: ${props => props.fontSize}em;
|
|
78
|
-
}
|
|
79
|
-
`;
|
|
80
|
-
|
|
81
|
-
const ListElement = styled.li`
|
|
82
|
-
margin-right: 0.5rem;
|
|
83
|
-
`;
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { useOutsideClick } from '../hooks/useOutsideAlerter';
|
|
4
|
+
|
|
5
|
+
interface IListMenuOption {
|
|
6
|
+
id: string;
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IRelativeMenuProps {
|
|
11
|
+
options: IListMenuOption[];
|
|
12
|
+
onSelected: (selectedOptionId: string) => void;
|
|
13
|
+
fontSize?: number;
|
|
14
|
+
onOutsideClick?: () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const RelativeListMenu: React.FC<IRelativeMenuProps> = ({
|
|
18
|
+
options,
|
|
19
|
+
onSelected,
|
|
20
|
+
onOutsideClick,
|
|
21
|
+
fontSize = 0.8,
|
|
22
|
+
}) => {
|
|
23
|
+
const ref = useRef(null);
|
|
24
|
+
|
|
25
|
+
useOutsideClick(ref, 'relative-context-menu');
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
document.addEventListener('clickOutside', event => {
|
|
29
|
+
const e = event as CustomEvent;
|
|
30
|
+
|
|
31
|
+
if (e.detail.id === 'relative-context-menu') {
|
|
32
|
+
if (onOutsideClick) {
|
|
33
|
+
onOutsideClick();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return () => {
|
|
39
|
+
document.removeEventListener('clickOutside', _e => {});
|
|
40
|
+
};
|
|
41
|
+
}, []);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Container fontSize={fontSize} ref={ref}>
|
|
45
|
+
<ul className="rpgui-list-imp" style={{ overflow: 'hidden' }}>
|
|
46
|
+
{options.map((params, index) => (
|
|
47
|
+
<ListElement
|
|
48
|
+
key={params?.id || index}
|
|
49
|
+
onClick={() => {
|
|
50
|
+
onSelected(params?.id);
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
{params?.text || 'No text'}
|
|
54
|
+
</ListElement>
|
|
55
|
+
))}
|
|
56
|
+
</ul>
|
|
57
|
+
</Container>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
interface IContainerProps {
|
|
62
|
+
fontSize?: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const Container = styled.div<IContainerProps>`
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: 1rem;
|
|
68
|
+
left: 4rem;
|
|
69
|
+
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
width: 100%;
|
|
73
|
+
justify-content: start;
|
|
74
|
+
align-items: flex-start;
|
|
75
|
+
|
|
76
|
+
li {
|
|
77
|
+
font-size: ${props => props.fontSize}em;
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
const ListElement = styled.li`
|
|
82
|
+
margin-right: 0.5rem;
|
|
83
|
+
`;
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { DraggableContainer } from './DraggableContainer';
|
|
4
|
-
|
|
5
|
-
interface IListMenuOption {
|
|
6
|
-
id: string;
|
|
7
|
-
text: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface IListMenuProps {
|
|
11
|
-
x: number;
|
|
12
|
-
y: number;
|
|
13
|
-
options: IListMenuOption[];
|
|
14
|
-
onSelected: (selectedOptionId: string) => void;
|
|
15
|
-
fontSize?: number;
|
|
16
|
-
title: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const ListMenu: React.FC<IListMenuProps> = ({
|
|
20
|
-
options,
|
|
21
|
-
onSelected,
|
|
22
|
-
title,
|
|
23
|
-
}) => {
|
|
24
|
-
return (
|
|
25
|
-
<ScrollListContainer title={title}>
|
|
26
|
-
<SkillSplitDiv>
|
|
27
|
-
<hr className="golden" />
|
|
28
|
-
</SkillSplitDiv>
|
|
29
|
-
|
|
30
|
-
<ListContainer className="rpgui-list-imp">
|
|
31
|
-
{options.map(params => (
|
|
32
|
-
<ListElement
|
|
33
|
-
key={params?.id}
|
|
34
|
-
onClick={() => {
|
|
35
|
-
onSelected(params?.id);
|
|
36
|
-
}}
|
|
37
|
-
>
|
|
38
|
-
{params?.text || 'No text'}
|
|
39
|
-
</ListElement>
|
|
40
|
-
))}
|
|
41
|
-
</ListContainer>
|
|
42
|
-
</ScrollListContainer>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const ScrollListContainer = styled(DraggableContainer)`
|
|
47
|
-
border: 1px solid black;
|
|
48
|
-
width: 400px;
|
|
49
|
-
height: 400px;
|
|
50
|
-
.DraggableContainer__TitleContainer-sc-184mpyl-2 {
|
|
51
|
-
width: auto;
|
|
52
|
-
height: auto;
|
|
53
|
-
}
|
|
54
|
-
`;
|
|
55
|
-
|
|
56
|
-
const SkillSplitDiv = styled.div`
|
|
57
|
-
width: 100%;
|
|
58
|
-
font-size: 11px;
|
|
59
|
-
margin-bottom: 10px;
|
|
60
|
-
hr {
|
|
61
|
-
margin: 0px;
|
|
62
|
-
padding: 0px;
|
|
63
|
-
}
|
|
64
|
-
p {
|
|
65
|
-
margin-bottom: 0px;
|
|
66
|
-
}
|
|
67
|
-
`;
|
|
68
|
-
|
|
69
|
-
const ListContainer = styled.ul`
|
|
70
|
-
border: none;
|
|
71
|
-
width: 400px;
|
|
72
|
-
height: 250px;
|
|
73
|
-
overflow-y: scroll;
|
|
74
|
-
`;
|
|
75
|
-
const ListElement = styled.li`
|
|
76
|
-
margin-right: 0.5rem;
|
|
77
|
-
`;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { DraggableContainer } from './DraggableContainer';
|
|
4
|
+
|
|
5
|
+
interface IListMenuOption {
|
|
6
|
+
id: string;
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IListMenuProps {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
options: IListMenuOption[];
|
|
14
|
+
onSelected: (selectedOptionId: string) => void;
|
|
15
|
+
fontSize?: number;
|
|
16
|
+
title: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const ListMenu: React.FC<IListMenuProps> = ({
|
|
20
|
+
options,
|
|
21
|
+
onSelected,
|
|
22
|
+
title,
|
|
23
|
+
}) => {
|
|
24
|
+
return (
|
|
25
|
+
<ScrollListContainer title={title}>
|
|
26
|
+
<SkillSplitDiv>
|
|
27
|
+
<hr className="golden" />
|
|
28
|
+
</SkillSplitDiv>
|
|
29
|
+
|
|
30
|
+
<ListContainer className="rpgui-list-imp">
|
|
31
|
+
{options.map(params => (
|
|
32
|
+
<ListElement
|
|
33
|
+
key={params?.id}
|
|
34
|
+
onClick={() => {
|
|
35
|
+
onSelected(params?.id);
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
{params?.text || 'No text'}
|
|
39
|
+
</ListElement>
|
|
40
|
+
))}
|
|
41
|
+
</ListContainer>
|
|
42
|
+
</ScrollListContainer>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const ScrollListContainer = styled(DraggableContainer)`
|
|
47
|
+
border: 1px solid black;
|
|
48
|
+
width: 400px;
|
|
49
|
+
height: 400px;
|
|
50
|
+
.DraggableContainer__TitleContainer-sc-184mpyl-2 {
|
|
51
|
+
width: auto;
|
|
52
|
+
height: auto;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
const SkillSplitDiv = styled.div`
|
|
57
|
+
width: 100%;
|
|
58
|
+
font-size: 11px;
|
|
59
|
+
margin-bottom: 10px;
|
|
60
|
+
hr {
|
|
61
|
+
margin: 0px;
|
|
62
|
+
padding: 0px;
|
|
63
|
+
}
|
|
64
|
+
p {
|
|
65
|
+
margin-bottom: 0px;
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
const ListContainer = styled.ul`
|
|
70
|
+
border: none;
|
|
71
|
+
width: 400px;
|
|
72
|
+
height: 250px;
|
|
73
|
+
overflow-y: scroll;
|
|
74
|
+
`;
|
|
75
|
+
const ListElement = styled.li`
|
|
76
|
+
margin-right: 0.5rem;
|
|
77
|
+
`;
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
|
|
4
|
-
export interface ISimpleProgressBarProps {
|
|
5
|
-
value: number;
|
|
6
|
-
bgColor?: string;
|
|
7
|
-
margin?: number;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const SimpleProgressBar: React.FC<ISimpleProgressBarProps> = ({
|
|
11
|
-
value,
|
|
12
|
-
bgColor = 'red',
|
|
13
|
-
margin = 20,
|
|
14
|
-
}) => {
|
|
15
|
-
return (
|
|
16
|
-
<Container className="simple-progress-bar">
|
|
17
|
-
<ProgressBarContainer margin={margin}>
|
|
18
|
-
<BackgroundBar>
|
|
19
|
-
<Progress value={value} bgColor={bgColor} />
|
|
20
|
-
</BackgroundBar>
|
|
21
|
-
</ProgressBarContainer>
|
|
22
|
-
</Container>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const Container = styled.div`
|
|
27
|
-
display: flex;
|
|
28
|
-
justify-content: center;
|
|
29
|
-
align-items: center;
|
|
30
|
-
width: 100%;
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
const BackgroundBar = styled.span`
|
|
34
|
-
background-color: rgba(0, 0, 0, 0.075);
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
interface ISimpleProgressBarThemeProps {
|
|
38
|
-
value: number;
|
|
39
|
-
bgColor: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const Progress = styled.span`
|
|
43
|
-
background-color: ${(props: ISimpleProgressBarThemeProps) => props.bgColor};
|
|
44
|
-
width: ${(props: ISimpleProgressBarThemeProps) => props.value}%;
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
interface ISimpleProgressBarTheme2Props {
|
|
48
|
-
margin: number;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const ProgressBarContainer = styled.div`
|
|
52
|
-
border-radius: 60px;
|
|
53
|
-
border: 1px solid #282424;
|
|
54
|
-
overflow: hidden;
|
|
55
|
-
width: 100%;
|
|
56
|
-
span {
|
|
57
|
-
display: block;
|
|
58
|
-
height: 100%;
|
|
59
|
-
}
|
|
60
|
-
height: 8px;
|
|
61
|
-
margin-left: ${(props: ISimpleProgressBarTheme2Props) => props.margin}px;
|
|
62
|
-
`;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
export interface ISimpleProgressBarProps {
|
|
5
|
+
value: number;
|
|
6
|
+
bgColor?: string;
|
|
7
|
+
margin?: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const SimpleProgressBar: React.FC<ISimpleProgressBarProps> = ({
|
|
11
|
+
value,
|
|
12
|
+
bgColor = 'red',
|
|
13
|
+
margin = 20,
|
|
14
|
+
}) => {
|
|
15
|
+
return (
|
|
16
|
+
<Container className="simple-progress-bar">
|
|
17
|
+
<ProgressBarContainer margin={margin}>
|
|
18
|
+
<BackgroundBar>
|
|
19
|
+
<Progress value={value} bgColor={bgColor} />
|
|
20
|
+
</BackgroundBar>
|
|
21
|
+
</ProgressBarContainer>
|
|
22
|
+
</Container>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const Container = styled.div`
|
|
27
|
+
display: flex;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
align-items: center;
|
|
30
|
+
width: 100%;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const BackgroundBar = styled.span`
|
|
34
|
+
background-color: rgba(0, 0, 0, 0.075);
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
interface ISimpleProgressBarThemeProps {
|
|
38
|
+
value: number;
|
|
39
|
+
bgColor: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const Progress = styled.span`
|
|
43
|
+
background-color: ${(props: ISimpleProgressBarThemeProps) => props.bgColor};
|
|
44
|
+
width: ${(props: ISimpleProgressBarThemeProps) => props.value}%;
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
interface ISimpleProgressBarTheme2Props {
|
|
48
|
+
margin: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const ProgressBarContainer = styled.div`
|
|
52
|
+
border-radius: 60px;
|
|
53
|
+
border: 1px solid #282424;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
width: 100%;
|
|
56
|
+
span {
|
|
57
|
+
display: block;
|
|
58
|
+
height: 100%;
|
|
59
|
+
}
|
|
60
|
+
height: 8px;
|
|
61
|
+
margin-left: ${(props: ISimpleProgressBarTheme2Props) => props.margin}px;
|
|
62
|
+
`;
|