@rpg-engine/long-bow 0.1.51 → 0.1.55

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.
@@ -37,11 +37,13 @@ export const QuestionDialog: React.FC<IProps> = ({
37
37
 
38
38
  const firstAnswerId = currentQuestion.answerIds![0];
39
39
 
40
- return answers.find((answer) => answer.id === firstAnswerId);
40
+ return answers.find(answer => answer.id === firstAnswerId);
41
41
  };
42
42
 
43
- const [currentAnswer, setCurrentAnswer] =
44
- useState<IQuestionDialogAnswer | null>(onGetFirstAnswer()!);
43
+ const [
44
+ currentAnswer,
45
+ setCurrentAnswer,
46
+ ] = useState<IQuestionDialogAnswer | null>(onGetFirstAnswer()!);
45
47
 
46
48
  useEffect(() => {
47
49
  setCurrentAnswer(onGetFirstAnswer()!);
@@ -49,7 +51,7 @@ export const QuestionDialog: React.FC<IProps> = ({
49
51
 
50
52
  const onGetAnswers = (answerIds: number[]) => {
51
53
  return answerIds.map((answerId: number) =>
52
- answers.find((answer) => answer.id === answerId)
54
+ answers.find(answer => answer.id === answerId)
53
55
  );
54
56
  };
55
57
 
@@ -64,14 +66,14 @@ export const QuestionDialog: React.FC<IProps> = ({
64
66
 
65
67
  const nextAnswerIndex = onGetAnswers(
66
68
  currentQuestion.answerIds!
67
- ).findIndex((answer) => answer?.id === currentAnswer!.id + 1);
69
+ ).findIndex(answer => answer?.id === currentAnswer!.id + 1);
68
70
 
69
71
  const nextAnswerID = currentQuestion.answerIds![nextAnswerIndex];
70
72
 
71
73
  // console.log(nextAnswerIndex);
72
74
 
73
75
  const nextAnswer = onGetAnswers(currentQuestion.answerIds!).find(
74
- (answer) => answer?.id === nextAnswerID
76
+ answer => answer?.id === nextAnswerID
75
77
  );
76
78
 
77
79
  setCurrentAnswer(nextAnswer || onGetFirstAnswer()!);
@@ -83,14 +85,14 @@ export const QuestionDialog: React.FC<IProps> = ({
83
85
 
84
86
  const previousAnswerIndex = onGetAnswers(
85
87
  currentQuestion.answerIds!
86
- ).findIndex((answer) => answer?.id === currentAnswer!.id - 1);
88
+ ).findIndex(answer => answer?.id === currentAnswer!.id - 1);
87
89
 
88
90
  const previousAnswerID =
89
91
  currentQuestion.answerIds &&
90
92
  currentQuestion.answerIds[previousAnswerIndex];
91
93
 
92
94
  const previousAnswer = onGetAnswers(currentQuestion.answerIds!).find(
93
- (answer) => answer?.id === previousAnswerID
95
+ answer => answer?.id === previousAnswerID
94
96
  );
95
97
 
96
98
  if (previousAnswer) {
@@ -109,7 +111,7 @@ export const QuestionDialog: React.FC<IProps> = ({
109
111
  } else {
110
112
  setCurrentQuestion(
111
113
  questions.find(
112
- (question) => question.id === currentAnswer!.nextQuestionId
114
+ question => question.id === currentAnswer!.nextQuestionId
113
115
  )!
114
116
  );
115
117
  }
@@ -124,7 +126,7 @@ export const QuestionDialog: React.FC<IProps> = ({
124
126
  if (answer.nextQuestionId) {
125
127
  // if there is a next question, go to it
126
128
  setCurrentQuestion(
127
- questions.find((question) => question.id === answer.nextQuestionId)!
129
+ questions.find(question => question.id === answer.nextQuestionId)!
128
130
  );
129
131
  } else {
130
132
  // else, finish dialog!
@@ -144,7 +146,7 @@ export const QuestionDialog: React.FC<IProps> = ({
144
146
  return null;
145
147
  }
146
148
 
147
- return answers.map((answer) => {
149
+ return answers.map(answer => {
148
150
  const isSelected = currentAnswer?.id === answer?.id;
149
151
  const selectedColor = isSelected ? 'yellow' : 'white';
150
152
 
@@ -213,7 +215,7 @@ interface IAnswerProps {
213
215
 
214
216
  const Answer = styled.p<IAnswerProps>`
215
217
  flex: auto;
216
- color: ${(props) => props.color} !important;
218
+ color: ${props => props.color} !important;
217
219
  font-size: 0.65rem !important;
218
220
  background: inherit;
219
221
  border: none;
@@ -221,7 +223,7 @@ const Answer = styled.p<IAnswerProps>`
221
223
 
222
224
  const AnswerSelectedIcon = styled.span<IAnswerProps>`
223
225
  flex: 5% 0 0;
224
- color: ${(props) => props.color} !important;
226
+ color: ${props => props.color} !important;
225
227
  `;
226
228
 
227
229
  const AnswerRow = styled.div`
@@ -20,7 +20,7 @@ export const ProgressBar: React.FC<IBarProps> = ({
20
20
  minWidth = 100,
21
21
  style,
22
22
  }) => {
23
- const calculatePercentageValue = function (max: number, value: number) {
23
+ const calculatePercentageValue = function(max: number, value: number) {
24
24
  if (value > max) {
25
25
  value = max;
26
26
  }
@@ -83,9 +83,9 @@ interface IContainerProps {
83
83
  const Container = styled.div<IContainerProps>`
84
84
  display: flex;
85
85
  flex-direction: column;
86
- min-width: ${(props) => props.minWidth}px;
87
- width: ${(props) => props.percentageWidth}%;
86
+ min-width: ${props => props.minWidth}px;
87
+ width: ${props => props.percentageWidth}%;
88
88
  justify-content: start;
89
89
  align-items: flex-start;
90
- ${(props) => props.style}
90
+ ${props => props.style}
91
91
  `;
@@ -39,7 +39,7 @@ interface IContainerProps {
39
39
  }
40
40
 
41
41
  const Container = styled.div<IContainerProps>`
42
- height: ${(props) => props.height};
42
+ height: ${props => props.height};
43
43
  width: ${({ width }) => width};
44
44
  display: flex;
45
45
  flex-wrap: wrap;
@@ -33,7 +33,7 @@ export const InputRadio: React.FC<IRadioProps> = ({
33
33
 
34
34
  return (
35
35
  <div id="elemento-radio">
36
- {items.map((element) => {
36
+ {items.map(element => {
37
37
  return (
38
38
  <>
39
39
  <input
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ interface IProps {
5
+ value: number;
6
+ height?: string;
7
+ bgColor?: string;
8
+ }
9
+
10
+ export const SimpleProgressBar: React.FC<IProps> = ({
11
+ value,
12
+
13
+ bgColor = 'red',
14
+ }) => {
15
+ return (
16
+ <Container>
17
+ <ProgressBarContainer>
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 IProgressProps {
38
+ value: number;
39
+ bgColor: string;
40
+ }
41
+
42
+ const Progress = styled.span`
43
+ background-color: ${(props: IProgressProps) => props.bgColor};
44
+ width: ${(props: IProgressProps) => props.value}%;
45
+ `;
46
+
47
+ const ProgressBarContainer = styled.div`
48
+ border-radius: 60px;
49
+ border: 1px solid #282424;
50
+ overflow: hidden;
51
+ width: 100%;
52
+ span {
53
+ display: block;
54
+ height: 100%;
55
+ }
56
+
57
+ height: 8px;
58
+ `;
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import imgSrcTemplate from './imgExp.png';
4
+ import { SimpleProgressBar } from './SimpleProgressBar';
5
+
6
+ export interface ISkillProgressBarProps {
7
+ value: number;
8
+
9
+ height: string;
10
+ bgColor: string;
11
+ titleName: string;
12
+
13
+ logoSrc?: string;
14
+ }
15
+
16
+ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
17
+ value,
18
+ bgColor,
19
+ titleName,
20
+
21
+ logoSrc = imgSrcTemplate,
22
+ }) => {
23
+ return (
24
+ <>
25
+ <ProgressTitle>
26
+ <TitleName>{titleName}</TitleName>
27
+ <ValueDisplay>{value}</ValueDisplay>
28
+ </ProgressTitle>
29
+ <ProgressBody>
30
+ <ProgressIconContainer>
31
+ <Icon src={logoSrc} />
32
+ </ProgressIconContainer>
33
+
34
+ <SimpleProgressBar value={value} bgColor={bgColor} />
35
+ </ProgressBody>
36
+ </>
37
+ );
38
+ };
39
+
40
+ const TitleName = styled.span`
41
+ margin-left: 5px;
42
+ `;
43
+
44
+ const ValueDisplay = styled.span``;
45
+
46
+ const ProgressIconContainer = styled.div`
47
+ display: flex;
48
+ justify-content: center;
49
+ align-items: center;
50
+ `;
51
+
52
+ const ProgressBody = styled.div`
53
+ display: flex;
54
+ flex-direction: row;
55
+ `;
56
+
57
+ const ProgressTitle = styled.div`
58
+ width: 100%;
59
+ display: flex;
60
+ flex-direction: row;
61
+ justify-content: space-between;
62
+ span {
63
+ font-size: 0.6rem;
64
+ }
65
+ `;
66
+
67
+ const Icon = styled.img`
68
+ margin-right: 10px;
69
+ height: 30px;
70
+ `;
@@ -19,7 +19,7 @@ const Container = styled.div<IContainerProps>`
19
19
  display: -webkit-box;
20
20
  max-width: 100%;
21
21
  max-height: 100%;
22
- -webkit-line-clamp: ${(props) => props.maxLines};
22
+ -webkit-line-clamp: ${props => props.maxLines};
23
23
  -webkit-box-orient: vertical;
24
24
  overflow: hidden;
25
25
  `;
Binary file
@@ -8,9 +8,9 @@ interface IColumn {
8
8
  }
9
9
 
10
10
  export const Column = styled.div<IColumn>`
11
- flex: ${(props) => props.flex || 'auto'};
11
+ flex: ${props => props.flex || 'auto'};
12
12
  display: flex;
13
- flex-wrap: ${(props) => props.flexWrap || 'nowrap'};
14
- align-items: ${(props) => props.alignItems || 'flex-start'};
15
- justify-content: ${(props) => props.justifyContent || 'flex-start'};
13
+ flex-wrap: ${props => props.flexWrap || 'nowrap'};
14
+ align-items: ${props => props.alignItems || 'flex-start'};
15
+ justify-content: ${props => props.justifyContent || 'flex-start'};
16
16
  `;
@@ -10,7 +10,7 @@ export const useEventListener = (type, handler, el = window) => {
10
10
 
11
11
  React.useEffect(() => {
12
12
  //@ts-ignore
13
- const listener = (e) => savedHandler.current(e);
13
+ const listener = e => savedHandler.current(e);
14
14
 
15
15
  el.addEventListener(type, listener);
16
16
 
package/src/index.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './components/Button';
2
- export * from './components/CheckButton';
3
2
  export * from './components/Chat/Chat';
3
+ export * from './components/CheckButton';
4
+ export * from './components/DraggableContainer';
4
5
  export * from './components/Dropdown';
5
6
  export * from './components/Input';
6
7
  export * from './components/ListMenu';
@@ -11,6 +12,7 @@ export * from './components/RadioButton';
11
12
  export * from './components/RangeSlider';
12
13
  export * from './components/RPGUIContainer';
13
14
  export * from './components/RPGUIRoot';
15
+ export * from './components/SkillProgressBar';
14
16
  export * from './components/TextArea';
15
17
  export * from './components/Truncate';
16
18
  export * from './components/typography/DynamicText';