Skip to content

Commit

Permalink
TP-1366: ability to hide the progress bar (#141)
Browse files Browse the repository at this point in the history
* feat(forms): hide progress bar
---------

Co-authored-by: Nick Hellemans <[email protected]>
  • Loading branch information
nckhell and Nick Hellemans authored Apr 2, 2024
1 parent dfddf46 commit ccfff66
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@awell-health/ui-library",
"version": "0.1.56",
"version": "0.1.57",
"private": false,
"description": "UI components to integrate with Awell Health",
"repository": {
Expand Down
4 changes: 3 additions & 1 deletion src/hostedPages/activities/form/ConversationalForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const ConversationalForm = ({
onAnswersChange,
autoProgress = false,
autosaveAnswers = true,
showProgressBar = true,
}: FormProps) => {
const {
submitForm,
Expand Down Expand Up @@ -83,7 +84,8 @@ export const ConversationalForm = ({
// hide progress indicator when all questions are evaluated or when form only has one question
const hideProgressIndicator =
(isEvaluatingQuestionVisibility && percentageCompleted === 100) ||
form.questions.length === 1
form.questions.length === 1 ||
showProgressBar === false

return (
<>
Expand Down
12 changes: 12 additions & 0 deletions src/hostedPages/activities/form/form.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export default {
control: { type: 'radio' },
defaultValue: false,
},
showProgressBar: {
options: [true, false],
control: { type: 'radio' },
defaultValue: true,
},
},
decorators: [
(StoryComponent) => (
Expand All @@ -67,6 +72,7 @@ const MyStory: Story = ({
displayMode,
autoProgress,
errorLabels,
showProgressBar,
}) => {
const [answers, setAnswers] = React.useState<string>('')
const isConversationalMode = displayMode == 'conversational'
Expand All @@ -92,6 +98,7 @@ const MyStory: Story = ({
storedAnswers={answers}
onAnswersChange={handleAnswersChange}
key={form.id}
showProgressBar={showProgressBar}
questionLabels={{
no_label: 'No',
yes_label: 'Yes',
Expand Down Expand Up @@ -134,6 +141,7 @@ const MyStory: Story = ({
storedAnswers={answers}
onAnswersChange={handleAnswersChange}
key={form.id}
showProgressBar={showProgressBar}
questionLabels={{
no_label: 'No',
yes_label: 'Yes',
Expand Down Expand Up @@ -176,6 +184,7 @@ export const Form: Story = ({
displayMode,
errorLabels,
autoProgress,
showProgressBar,
}) => {
return (
<MyStory
Expand All @@ -185,6 +194,7 @@ export const Form: Story = ({
buttonLabels={buttonLabels}
errorLabels={errorLabels}
autoProgress={autoProgress}
showProgressBar={showProgressBar}
/>
)
}
Expand Down Expand Up @@ -215,6 +225,7 @@ export const FormMobile: Story = ({
buttonLabels,
displayMode,
errorLabels,
showProgressBar,
}) => {
return (
<MyStory
Expand All @@ -223,6 +234,7 @@ export const FormMobile: Story = ({
displayMode={displayMode}
buttonLabels={buttonLabels}
errorLabels={errorLabels}
showProgressBar={showProgressBar}
/>
)
}
Expand Down
1 change: 1 addition & 0 deletions src/types/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ export interface FormProps {
) => Promise<Array<QuestionRuleResult>>
autoProgress?: boolean
autosaveAnswers?: boolean
showProgressBar?: boolean
}

0 comments on commit ccfff66

Please sign in to comment.