refactor messageItem component
This commit is contained in:
parent
0a3bf4ca42
commit
9272dfb179
8 changed files with 212 additions and 221 deletions
40
src/composables/computed/useMessageItemComp.ts
Normal file
40
src/composables/computed/useMessageItemComp.ts
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import { computed } from "vue";
|
||||
// takes in message modifier as param
|
||||
export default function useMessageItemComp(m: string) {
|
||||
const textFill = computed(() => {
|
||||
switch (m) {
|
||||
case "fr":
|
||||
return "#000";
|
||||
default:
|
||||
return "#fff";
|
||||
}
|
||||
});
|
||||
|
||||
const bubbleFill = computed(() => {
|
||||
switch (m) {
|
||||
case "sf":
|
||||
return "#61b4f4";
|
||||
case "ai":
|
||||
return "#585858";
|
||||
default:
|
||||
return "#fff";
|
||||
}
|
||||
});
|
||||
|
||||
const startingOffset = computed(() => {
|
||||
switch (m) {
|
||||
case "sf":
|
||||
return "translate(10, 600)";
|
||||
case "ai":
|
||||
return "translate(135, 600)";
|
||||
default:
|
||||
return "translate(20, 600)";
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
textFill,
|
||||
bubbleFill,
|
||||
startingOffset
|
||||
};
|
||||
}
|
||||
Loading…
Reference in a new issue