diff --git a/lib/js/components/SurveyQuestions/SurveyQuestion.consts.ts b/lib/js/components/SurveyQuestions/SurveyQuestion.consts.ts index 269340009..f292f2593 100644 --- a/lib/js/components/SurveyQuestions/SurveyQuestion.consts.ts +++ b/lib/js/components/SurveyQuestions/SurveyQuestion.consts.ts @@ -2,3 +2,8 @@ export const SURVEY_QUESTION_STATES = { DEFAULT: 'default', DISABLED: 'disabled', } as const; + +export const SURVEY_QUESTION_SCALE_CONTAINERS = { + ONE: 'one', + TWO: 'two', +} as const; diff --git a/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.stories.ts b/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.stories.ts index 1df61b337..0df378bc9 100644 --- a/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.stories.ts +++ b/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.stories.ts @@ -1,6 +1,6 @@ import SurveyQuestionScale from './SurveyQuestionScale.vue'; import { SURVEY_TOGGLE_MEANINGS } from '../../SurveyToggle'; -import { SURVEY_QUESTION_STATES } from '../SurveyQuestion.consts'; +import { SURVEY_QUESTION_SCALE_CONTAINERS, SURVEY_QUESTION_STATES } from '../SurveyQuestion.consts'; import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3'; @@ -15,7 +15,7 @@ const StoryTemplate: StoryFn = (args, { updateArgs } return { ...args }; }, template: - '' + + '' + '' + '', methods: { @@ -37,6 +37,7 @@ const args = { explanation: '

Jak ocenić, czy slajdy i diagramy były zrozumiałe?

\n
Wyczerpujące materiały dają poczucie pełnego zrozumienia, przy jednoczesnym usystematyzowaniu informacji. Wpływa na to nie tylko ich jakość, ale też ilość.
', placeholder: 'Wpisz swoją odpowiedź', + containers: SURVEY_QUESTION_SCALE_CONTAINERS.TWO, scaleOptions: [ { value: '1', @@ -75,6 +76,10 @@ const argTypes = { elaborationValue: { control: { type: 'text' } }, selectedValue: { control: false }, explanation: { control: { type: 'text' } }, + containers: { + control: { type: 'select' }, + options: Object.values(SURVEY_QUESTION_SCALE_CONTAINERS), + }, scaleOptions: { control: { type: 'object' } }, state: { control: { type: 'select', options: Object.values(SURVEY_QUESTION_STATES) }, @@ -111,7 +116,7 @@ const StoryLimitedWidthTemplate: StoryFn = (args, { return { ...args }; }, template: - '
' + + '
' + '' + '
', methods: { @@ -125,7 +130,13 @@ const StoryLimitedWidthTemplate: StoryFn = (args, { }); export const LimitedWidth = StoryLimitedWidthTemplate.bind({}); -LimitedWidth.argTypes = argTypesDisabled; +LimitedWidth.argTypes = { + ...argTypesDisabled, + containers: { + control: { type: 'select' }, + options: Object.values(SURVEY_QUESTION_SCALE_CONTAINERS), + }, +} as ArgTypes; LimitedWidth.args = { title: "Main question write here if it's long it will collapse.", @@ -134,6 +145,7 @@ LimitedWidth.args = { explanation: '

Jak ocenić, czy slajdy i diagramy były zrozumiałe?

\n
Wyczerpujące materiały dają poczucie pełnego zrozumienia, przy jednoczesnym usystematyzowaniu informacji. Wpływa na to nie tylko ich jakość, ale też ilość.
', placeholder: 'Wpisz swoją odpowiedź', + containers: SURVEY_QUESTION_SCALE_CONTAINERS.TWO, scaleOptions: [ { value: '1', @@ -176,54 +188,8 @@ const StorySevenOptionsTemplate: StoryFn = (args, { data() { return { elaboration: '' }; }, - created() { - this.scaleOptions = [ - { - value: '1', - label: 'Nie zgadzam się', - meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY, - content: '1', - }, - { - value: '2', - label: '', - meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY, - content: '2', - }, - { - value: '3', - label: '', - meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY, - content: '3', - }, - { - value: '4', - label: 'Trochę', - meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY, - content: '4', - }, - { - value: '5', - label: '', - meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY, - content: '5', - }, - { - value: '6', - label: '', - meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY, - content: '6', - }, - { - value: '7', - label: 'Zgadzam się', - meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY, - content: '7', - }, - ]; - }, template: - '', + '', methods: { selectedValueUpdate(selectedValue) { updateArgs({ selectedValue }); @@ -232,4 +198,58 @@ const StorySevenOptionsTemplate: StoryFn = (args, { }); export const SevenOptions = StorySevenOptionsTemplate.bind({}); -SevenOptions.argTypes = argTypesDisabled; +SevenOptions.argTypes = { + ...argTypesDisabled, + containers: { + control: { type: 'select' }, + options: Object.values(SURVEY_QUESTION_SCALE_CONTAINERS), + }, +} as ArgTypes; + +SevenOptions.args = { + containers: SURVEY_QUESTION_SCALE_CONTAINERS.ONE, + scaleOptions: [ + { + value: '1', + label: 'Nie zgadzam się', + meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY, + content: '1', + }, + { + value: '2', + label: '', + meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY, + content: '2', + }, + { + value: '3', + label: '', + meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY, + content: '3', + }, + { + value: '4', + label: 'Trochę', + meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY, + content: '4', + }, + { + value: '5', + label: '', + meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY, + content: '5', + }, + { + value: '6', + label: '', + meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY, + content: '6', + }, + { + value: '7', + label: 'Zgadzam się', + meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY, + content: '7', + }, + ], +} as Args; diff --git a/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue b/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue index c7d87b3ba..8fa219d51 100644 --- a/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue +++ b/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue @@ -24,34 +24,79 @@ @click="showModal = true" />
-
- + +
+ +
+ +