From 684a7e0a2bb0b21336b655c7841019e97c28f371 Mon Sep 17 00:00:00 2001 From: Danil Kovtonyuk Date: Fri, 7 Feb 2020 01:41:43 +1000 Subject: [PATCH] refactor -add name field validation -disable fields after successful contribute --- assets/styles/app.scss | 62 +++++++++++++++- components/Form.vue | 58 +++++++++++++++ pages/make-contribution.vue | 144 +++++++++++++++++------------------- store/user.js | 93 +++++++++++++++++++++++ 4 files changed, 281 insertions(+), 76 deletions(-) create mode 100644 components/Form.vue create mode 100644 store/user.js diff --git a/assets/styles/app.scss b/assets/styles/app.scss index 0e7beb0..ea3d48c 100644 --- a/assets/styles/app.scss +++ b/assets/styles/app.scss @@ -149,6 +149,7 @@ height: 100%; display: flex; flex-direction: column; + align-items: stretch; &:hover, &.is-hovered { color: $primary; @@ -166,19 +167,49 @@ } } + &:focus { + outline: none; + } + .cloak { align-self: center; } - .buttons { + .form { flex-grow: 1; + display: flex; flex-direction: column; justify-content: center; + align-items: stretch; } .button.is-fullwidth + .button.is-fullwidth { margin-top: 1rem; } + + &-anonymous { + width: 100%; + cursor: pointer; + } + } + + fieldset[disabled] { + .box { + opacity: .5; + cursor: not-allowed; + background-color: $primary-invert; + border-color: #393939; + + .title { + color: $white; + } + + .cloak { + path { + stroke: #393939; + } + } + } } .field { @@ -186,6 +217,19 @@ text-align: left; } + .help { + text-align: left; + position: absolute; + + &.counter { + right: 0; + } + } + + &:not(:last-child) { + margin-bottom: 1.5rem; + } + &.is-horizontal { display: flex; align-items: center; @@ -199,6 +243,16 @@ margin-right: 1.5rem; } } + + .control.has-icons-right { + .input { + padding-right: calc(#{$control-padding-horizontal} - 1px); + } + + .icon.is-right { + display: none; + } + } } .currently { @@ -543,3 +597,9 @@ } } } + +fieldset { + &:not(:last-child) { + margin-bottom: $block-spacing; + } +} diff --git a/components/Form.vue b/components/Form.vue new file mode 100644 index 0000000..148f1aa --- /dev/null +++ b/components/Form.vue @@ -0,0 +1,58 @@ + + + diff --git a/pages/make-contribution.vue b/pages/make-contribution.vue index 3e35311..6477984 100644 --- a/pages/make-contribution.vue +++ b/pages/make-contribution.vue @@ -1,44 +1,31 @@