mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 09:00:10 +00:00
modal: change transition
now a simple fade-in/fade-out, which is part of tailwind.config.js rather than modal.css.
This commit is contained in:
parent
baffa4a38c
commit
ecbff16a88
@ -10,19 +10,6 @@
|
|||||||
background-color: rgba(0,0,0,40%);
|
background-color: rgba(0,0,0,40%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-shown {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes modal-hide {
|
|
||||||
from { opacity: 1; }
|
|
||||||
to { opacity: 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-hiding {
|
|
||||||
animation: modal-hide 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-close {
|
.modal-close {
|
||||||
float: right;
|
float: right;
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
|
1
package-lock.json
generated
1
package-lock.json
generated
@ -10165,6 +10165,7 @@
|
|||||||
},
|
},
|
||||||
"nightwind": {
|
"nightwind": {
|
||||||
"version": "git+ssh://git@github.com/yonson2/nightwind.git#755e4b34e0cd782291822b88ad969c69404900da",
|
"version": "git+ssh://git@github.com/yonson2/nightwind.git#755e4b34e0cd782291822b88ad969c69404900da",
|
||||||
|
"integrity": "sha512-eibdkEdOFtBj/1iTk3W0CP9+GXwW1OXcoLBm+Pf7Sq5JLRmailuhaxGrKlNjZH9Wn8yYPO+LuYHg3NMG27Gjuw==",
|
||||||
"from": "nightwind@github:yonson2/nightwind",
|
"from": "nightwind@github:yonson2/nightwind",
|
||||||
"requires": {}
|
"requires": {}
|
||||||
},
|
},
|
||||||
|
@ -6,6 +6,28 @@ module.exports = {
|
|||||||
darkMode: 'class',
|
darkMode: 'class',
|
||||||
theme: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
|
keyframes: {
|
||||||
|
'fade-in': {
|
||||||
|
'0%': {
|
||||||
|
opacity: '0'
|
||||||
|
},
|
||||||
|
'100%': {
|
||||||
|
opacity: '1'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'fade-out': {
|
||||||
|
'0%': {
|
||||||
|
opacity: '1'
|
||||||
|
},
|
||||||
|
'100%': {
|
||||||
|
opacity: '0'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
animation: {
|
||||||
|
'fade-in': 'fade-in 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94)',
|
||||||
|
'fade-out': 'fade-out 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94)'
|
||||||
|
},
|
||||||
colors: {
|
colors: {
|
||||||
neutral: colors.slate,
|
neutral: colors.slate,
|
||||||
positive: colors.green,
|
positive: colors.green,
|
||||||
|
@ -24,11 +24,12 @@ export class Modal implements Modal {
|
|||||||
if (event) {
|
if (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
this.modal.classList.add('modal-hiding');
|
this.modal.classList.add('animate-fade-out');
|
||||||
|
this.modal.classList.remove("animate-fade-in");
|
||||||
const modal = this.modal;
|
const modal = this.modal;
|
||||||
const listenerFunc = () => {
|
const listenerFunc = () => {
|
||||||
modal.classList.remove('modal-shown');
|
modal.classList.remove('block');
|
||||||
modal.classList.remove('modal-hiding');
|
modal.classList.remove('animate-fade-out');
|
||||||
modal.removeEventListener(window.animationEvent, listenerFunc);
|
modal.removeEventListener(window.animationEvent, listenerFunc);
|
||||||
document.dispatchEvent(this.closeEvent);
|
document.dispatchEvent(this.closeEvent);
|
||||||
};
|
};
|
||||||
@ -43,11 +44,11 @@ export class Modal implements Modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show = () => {
|
show = () => {
|
||||||
this.modal.classList.add('modal-shown');
|
this.modal.classList.add('block', 'animate-fade-in');
|
||||||
document.dispatchEvent(this.openEvent);
|
document.dispatchEvent(this.openEvent);
|
||||||
}
|
}
|
||||||
toggle = () => {
|
toggle = () => {
|
||||||
if (this.modal.classList.contains('modal-shown')) {
|
if (this.modal.classList.contains('animate-fade-in')) {
|
||||||
this.close();
|
this.close();
|
||||||
} else {
|
} else {
|
||||||
this.show();
|
this.show();
|
||||||
|
Loading…
Reference in New Issue
Block a user