-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/loader #67
Feature/loader #67
Conversation
class="button" | ||
:type="buttonType" | ||
:title="buttonTitle" | ||
:disabled="isBlocked" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can set disabled button if prop withLoader is true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prop withLoader
is not a loader state. It's like a variant for the button. You can set button without or with loader. So I can't disable the button when withLoader
is true b/c it will be disabled it on start
components: { | ||
BaseLoader | ||
}, | ||
props: ['buttonType', 'text', 'buttonTitle', 'withLoader'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change props? Prev version was ok. We should add require property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better to cahnge prop withLoader
to loader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think prop loader
means it will enable loader or start the loader. In this situation, withLoader
means it will show the button with loader option. You can also show normal button without it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I changed props b/c prev we just have type: String
without require property
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So better is to add require
true or false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
|
||
<template v-if="withLoader"> | ||
<BaseLoader/> | ||
</template> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move v-if="withLoader"
to BaseLoader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b/c it's variant for button. Not always you want to show button with loader. I.e when have 2 buttons and one is "Place order" and the second is "Back"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it does not metter you can move condition to BaseLoader, like below
<BaseLoader v-if="withLoader"/>
in this case we dont need temlate tag
} | ||
|
||
&:disabled { | ||
opacity: .5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it works but please change to opacity: 0.5;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
begin="0.3" | ||
/> | ||
</circle> | ||
</svg> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please minify svg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added svg-loader and add icon to assets + minify it and change styles to non scoped to get it in loader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
view/frontend/web/js/store/index.js
Outdated
@@ -51,7 +51,8 @@ const store = new Vuex.Store({ | |||
shippingCarrierCode: '', | |||
shippingMethodCode: '' | |||
}, | |||
totals: null | |||
totals: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you changed to empty object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol idk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And want to see it it working or no. For now we are not setting to totals anything. Is it ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, for now we don't use this state
this.$store.commit('setLoading', true) | ||
this.regions = this.$store.getters.regionsByCountryId(this.address.country_id) | ||
this.$store.dispatch('updateShippingMethods', this.address.country_id) | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this method. Where do you execute it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like some dead code - deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -61,7 +61,7 @@ | |||
In this country we don't handle any shipping methods. | |||
</p> | |||
</template> | |||
<BaseButton class="button" button-type="submit" text="Next Step"/> | |||
<BaseButton class="button" button-type="submit" text="Next Step" with-loader="true"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can change with-loader="true"
to with-loader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -50,6 +50,7 @@ | |||
class="button" | |||
button-type="button" | |||
text="Place order" | |||
with-loader="true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can change with-loader="true" to with-loader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -105,13 +106,19 @@ export default { | |||
this.$validator.validateAll().then((result) => { | |||
if (result) { | |||
EventBus.$emit('save-address', 'billingAddress') | |||
this.$store.commit('setLoading', true) | |||
this.$store.commit('setAddress', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you add above this commit?
Conflicts: view/frontend/web/js/components/BaseButton.vue view/frontend/web/js/components/steps/TheShippingStep.vue yarn.lock
If we want to add loader on start than must deal with v-cloak and add some styles to loader |
@@ -0,0 +1 @@ | |||
<svg xmlns="http://www.w3.org/2000/svg"><circle cx="4" cy="4" r="4"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin=".1"/></circle><circle cx="18" cy="4" r="4"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin=".2"/></circle><circle cx="32" cy="4" r="4"><animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin=".3"/></circle></svg> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing new line :D
|
||
<template v-if="withLoader"> | ||
<BaseLoader/> | ||
</template> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it does not metter you can move condition to BaseLoader, like below
<BaseLoader v-if="withLoader"/>
in this case we dont need temlate tag
@kjugi just 2 comments to fix ;) |
Closes #26 |
Add loader to button while clicking on it after filling up form with data. Must validate first and then showing loader and blocking button to prevent multiple clicks and sending multiple requests.
Modify button props.
Add styles to button
Create loader components with styles