SQUAHME: Circleci test 1

pull/1249/head
Rick Carlino 2019-06-25 13:39:05 -05:00
parent bcccf7b768
commit 153b7763ea
4 changed files with 74 additions and 91 deletions

2
Untitled-1 100644
View File

@ -0,0 +1,2 @@
postgres 10 d29f10c3b706 3 days ago 230MB
postgres 10.9 d29f10c3b706 3 days ago 230MB

View File

@ -37,7 +37,7 @@ services:
db: db:
env_file: ".env" env_file: ".env"
image: postgres:10 image: postgres:10.9
volumes: ["./docker_volumes/db:/var/lib/postgresql/data"] volumes: ["./docker_volumes/db:/var/lib/postgresql/data"]
web: web:

View File

@ -21,15 +21,16 @@ const createToast = (message: string, title: string, color: string) => {
throw new Error("toast-container is null."); throw new Error("toast-container is null.");
} else { } else {
/** const state = {
* Amount of time before each element is removed. /**
*/ * Amount of time before each element is removed.
let timer = 7; */
timer: 7,
/** /**
* Declare if the user's mouse is hovering over the message. * Declare if the user's mouse is hovering over the message.
*/ */
let isHovered = false; isHovered: false,
};
/** /**
* Create elements. * Create elements.
@ -85,7 +86,7 @@ const createToast = (message: string, title: string, color: string) => {
for (let i = 0; i < children.length; i++) { for (let i = 0; i < children.length; i++) {
(children[i] as HTMLElement).style.animationPlayState = "paused"; (children[i] as HTMLElement).style.animationPlayState = "paused";
} }
isHovered = true; state.isHovered = true;
}); });
/** /**
@ -96,7 +97,7 @@ const createToast = (message: string, title: string, color: string) => {
for (let i = 0; i < children.length; i++) { for (let i = 0; i < children.length; i++) {
(children[i] as HTMLElement).style.animationPlayState = "running"; (children[i] as HTMLElement).style.animationPlayState = "running";
} }
isHovered = false; state.isHovered = false;
}); });
/** /**
@ -114,15 +115,15 @@ const createToast = (message: string, title: string, color: string) => {
* Start timer. * Start timer.
*/ */
const interval = setInterval(() => { const interval = setInterval(() => {
if (timer <= 7) { if (state.timer <= 7) {
toastEl.classList.add("active"); toastEl.classList.add("active");
} }
if (!isHovered && timer <= .800) { if (!state.isHovered && state.timer <= 0.800) {
toastEl.classList.add("poof"); toastEl.classList.add("poof");
} }
if (!isHovered) { if (!state.isHovered) {
timer -= 0.100; state.timer -= 0.100;
if (timer <= 0) { if (state.timer <= 0) {
clearInterval(interval); clearInterval(interval);
if (toastEl && toastEl.parentNode === tc) { if (toastEl && toastEl.parentNode === tc) {
if (!tc) { if (!tc) {
@ -138,77 +139,3 @@ const createToast = (message: string, title: string, color: string) => {
}, 100); }, 100);
} }
}; };
/**
* Yellow message with "Warning" as the default title.
*/
export const warning = (
message: string,
title = "Warning",
color = "yellow"
) => {
if (messageQueue.indexOf(message) > -1) {
console.warn(message);
} else {
createToast(message, title, color);
messageQueue.push(message);
}
};
/**
* Red message with "Error" as the default title.
*/
export const error = (
message: string,
title = "Error",
color = "red"
) => {
if (messageQueue.indexOf(message) > -1) {
console.error(message);
} else {
createToast(message, title, color);
messageQueue.push(message);
}
};
/**
* Green message with "Success" as the default title.
*/
export const success = (
message: string,
title = "Success",
color = "green"
) => {
createToast(message, title, color);
};
/**
* Red message with "FYI" as the default title.
*/
export const info = (
message: string,
title = "FYI",
color = "blue"
) => {
createToast(message, title, color);
};
/**
* Blue message with "Did you know?" as the default title.
*/
export const fun = (
message: string,
title = "Did you know?",
color = "dark-blue"
) => {
createToast(message, title, color);
};
/**
* Adds a hidden container div for holding toast messages.
*/
export const init = () => {
const toastContainer = document.createElement("div");
toastContainer.classList.add("toast-container");
document.body.appendChild(toastContainer);
};

View File

@ -0,0 +1,54 @@
/**
* Yellow message with "Warning" as the default title.
*/
export const warning =
(message: string, title = "Warning", color = "yellow") => {
if (messageQueue.indexOf(message) > -1) {
console.warn(message);
} else {
createToast(message, title, color);
messageQueue.push(message);
}
};
/**
* Red message with "Error" as the default title.
*/
export const error = (message: string, title = "Error", color = "red") => {
if (messageQueue.indexOf(message) > -1) {
console.error(message);
} else {
createToast(message, title, color);
messageQueue.push(message);
}
};
/**
* Green message with "Success" as the default title.
*/
export const success =
(message: string, title = "Success", color = "green") =>
createToast(message, title, color);
/**
* Red message with "FYI" as the default title.
*/
export const info =
(message: string, title = "FYI", color = "blue") =>
createToast(message, title, color);
/**
* Blue message with "Did you know?" as the default title.
*/
export const fun =
(message: string, title = "Did you know?", color = "dark-blue") =>
createToast(message, title, color);
/**
* Adds a hidden container div for holding toast messages.
*/
export const init = () => {
const toastContainer = document.createElement("div");
toastContainer.classList.add("toast-container");
document.body.appendChild(toastContainer);
};