Skip to content
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

Success and Failure method added. #102

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/node_modules/
/dist/
/site/dist/
/package-lock.json
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

13 changes: 6 additions & 7 deletions css/ladda-themed.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $mint: #16a085;
-webkit-font-smoothing: antialiased;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);

&:hover {
&:hover:not([data-failed]):not([data-success]) {
border-color: rgba( 0, 0, 0, 0.07 );
background-color: #888;
}
Expand All @@ -45,14 +45,13 @@ $mint: #16a085;
@include buttonColor( 'purple', $purple );
@include buttonColor( 'mint', $mint );

&[disabled],
&[data-loading] {
&[disabled], &[data-loading] {
border-color: rgba( 0, 0, 0, 0.07 );
cursor: default;
}

&, &:hover {
cursor: default;
background-color: #999;
}
&[disabled]:not([data-failed]):not([data-success]), &[data-loading] {
background-color: #999;
}

&[data-size=xs] {
Expand Down
19 changes: 15 additions & 4 deletions css/ladda.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ $spinnerSize: 32px !default;
*/

@mixin buttonColor( $name, $color ) {
&[data-color=#{$name}] {
&[data-color=#{$name}]:not([data-failed]):not([data-success]) {
background: $color;

&:hover {
background-color: lighten( $color, 5% );
&:hover:not([data-loading]):not([data-failed]):not([data-success]) {
background: lighten( $color, 5% );
}
}
}
Expand Down Expand Up @@ -86,6 +86,15 @@ $spinnerSize: 32px !default;
display: block;
}

.ladda-button[data-failed] {
background: #dc3545;
border-color: #dc3545; /* necessary when using Bootstrap */
}

.ladda-button[data-success] {
background:#198754;
border-color: #198754; /* necessary when using Bootstrap */
}

/*************************************
* EASING
Expand Down Expand Up @@ -434,10 +443,12 @@ $spinnerSize: 32px !default;
margin-left: 0;
}

&[data-loading] {
&[data-loading], &[data-success], &[data-failed] {
border-radius: 50%;
width: 52px;
}

&[data-loading] {
.ladda-label {
opacity: 0;
}
Expand Down
2 changes: 2 additions & 0 deletions js/ladda.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export interface LaddaButton {
setProgress(progress: number): void,
isLoading(): boolean,
remove(): void,
succeed(timeout: number = 1250): LaddaButton,
fail(timeout: number = 1250): LaddaButton,
}

export interface BindOptions {
Expand Down
Loading