Skip to content

Commit 26deb31

Browse files
author
Nicu
authored
Added option to hide the back button (#197)
1 parent 1aa779a commit 26deb31

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@code4ro/taskforce-fe-components",
3-
"version": "1.0.29",
3+
"version": "1.0.30",
44
"private": false,
55
"sideEffects": false,
66
"dependencies": {

src/components/form/data/decisionTree.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export default {
104104
questionId: 100,
105105
type: "FINAL",
106106
questionText: "Ce trebuie sa faci?",
107+
showBackButton: false,
107108
options: [
108109
{
109110
label: "Esti bine! Stai acasa!",

src/components/form/form.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ export const Form = ({ data, evaluateForm, onFinishingForm }) => {
186186
setCurrentNode(nextNode);
187187
}
188188
};
189+
189190
const goToPreviousQuestion = () => {
190191
const newNode = historyOfSteps.pop();
191192
setHistoryOfSteps(historyOfSteps);
@@ -209,6 +210,7 @@ export const Form = ({ data, evaluateForm, onFinishingForm }) => {
209210
</div>
210211
);
211212
};
213+
212214
const goForwardButton = () => {
213215
return (
214216
<div className="level-item">
@@ -222,21 +224,26 @@ export const Form = ({ data, evaluateForm, onFinishingForm }) => {
222224
</div>
223225
);
224226
};
227+
225228
const restartButton = () => {
226229
return (
227230
<Button inverted={true} onClick={resetForm}>
228231
Reîncepe testul
229232
</Button>
230233
);
231234
};
235+
232236
const showQuestion = () => {
237+
const currentQuestion = formAsMap[currentNode];
233238
return (
234239
<div>
235240
{questionView()}
236241
<div className="level action-buttons">
237242
<div className="level-left">{data.form && restartButton()}</div>
238243
<div className="level-right">
239-
{currentNode > FIRST_NODE && goBackButton()}
244+
{currentNode > FIRST_NODE &&
245+
currentQuestion.showBackButton !== false &&
246+
goBackButton()}
240247
{areThereQuestionsLeft() && goForwardButton()}
241248
</div>
242249
</div>

0 commit comments

Comments
 (0)