From f9642ff49ed7cfb0532b983f6f7f0b1827189959 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Thu, 27 Jun 2019 17:55:07 +0200 Subject: [PATCH] Get survey from server and display it dynamically --- client/src/graphql/gql/surveyQuery.gql | 10 +++ client/src/main.js | 1 - client/src/pages/survey.vue | 102 +++++++++++++++++++++---- client/src/router/index.js | 7 +- client/src/styles/_survey.scss | 28 +++++++ client/src/styles/main.scss | 1 + 6 files changed, 130 insertions(+), 19 deletions(-) create mode 100644 client/src/graphql/gql/surveyQuery.gql create mode 100644 client/src/styles/_survey.scss diff --git a/client/src/graphql/gql/surveyQuery.gql b/client/src/graphql/gql/surveyQuery.gql new file mode 100644 index 00000000..19f60bd7 --- /dev/null +++ b/client/src/graphql/gql/surveyQuery.gql @@ -0,0 +1,10 @@ +query SurveyQuery($id: ID!) { + survey(id: $id) { + id + title + data + answer { + data + } + } +} diff --git a/client/src/main.js b/client/src/main.js index d8157873..d34edd7c 100644 --- a/client/src/main.js +++ b/client/src/main.js @@ -108,7 +108,6 @@ Vue.use(VeeValidate, { Vue.filter('date', dateFilter); - /* eslint-disable no-new */ new Vue({ el: '#app', diff --git a/client/src/pages/survey.vue b/client/src/pages/survey.vue index 2ab45cdd..fc8e0e62 100644 --- a/client/src/pages/survey.vue +++ b/client/src/pages/survey.vue @@ -1,37 +1,107 @@ + + diff --git a/client/src/router/index.js b/client/src/router/index.js index 6b9b54b3..a06fc241 100644 --- a/client/src/router/index.js +++ b/client/src/router/index.js @@ -25,6 +25,7 @@ import Router from 'vue-router' import editProject from '@/pages/editProject' import newProject from '@/pages/newProject' import surveyPage from '@/pages/survey' +// import styleGuidePage from '@/pages/styleguide' import store from '@/store/index'; @@ -87,9 +88,11 @@ const routes = [ ] }, { - path: '/survey', - component: surveyPage + path: '/survey/:id', + component: surveyPage, + props: true }, + // {path: '/styleguide', component: styleGuidePage}, {path: '*', component: p404} ]; diff --git a/client/src/styles/_survey.scss b/client/src/styles/_survey.scss new file mode 100644 index 00000000..c854eb23 --- /dev/null +++ b/client/src/styles/_survey.scss @@ -0,0 +1,28 @@ +.survey { + &__panel-title { + @include main-title; + margin-bottom: $large-spacing*2; + span { + @include main-title; + } + } + + &__panel-description { + @include regular-paragraph; + line-height: 1.5; + margin-bottom: $large-spacing; + } + + &__question-title { + @include heading-4; + margin-bottom: $medium-spacing; + span { + @include heading-4; + } + } + + &__input { + width: 100%; + margin-bottom: $medium-spacing; + } +} diff --git a/client/src/styles/main.scss b/client/src/styles/main.scss index 87f9760f..7315029b 100644 --- a/client/src/styles/main.scss +++ b/client/src/styles/main.scss @@ -14,3 +14,4 @@ @import "article"; @import "actions"; @import "top-navigation"; +@import "survey";