mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-12-05 14:19:58 -05:00
add support for sideband/lxmf user appearance icons
This commit is contained in:
parent
cff5b2023c
commit
8e2cd6c62c
6 changed files with 109 additions and 1 deletions
34
src/frontend/components/MaterialDesignIcon.vue
Normal file
34
src/frontend/components/MaterialDesignIcon.vue
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<template>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" :aria-label="iconName" fill="currentColor" style="display:inline-block;vertical-align:middle;">
|
||||
<path :d="iconPath"/>
|
||||
</svg>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as mdi from "@mdi/js";
|
||||
|
||||
export default {
|
||||
name: "MaterialDesignIcon",
|
||||
props: {
|
||||
iconName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
mdiIconName() {
|
||||
// convert icon name from lxmf icon appearance to format expected by the @mdi/js library
|
||||
// e.g: alien-outline -> mdiAlienOutline
|
||||
// https://pictogrammers.github.io/@mdi/font/5.4.55/
|
||||
return "mdi" + this.iconName.split("-").map((word) => {
|
||||
// capitalise first letter of each part
|
||||
return word.charAt(0).toUpperCase() + word.slice(1);
|
||||
}).join("");
|
||||
},
|
||||
iconPath() {
|
||||
// find icon, otherwise fallback to question mark, and if that doesn't exist, show nothing...
|
||||
return mdi[this.mdiIconName] || mdi["mdiProgressQuestion"] || "";
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue