From 63f5b3fe19ba8b63e7e883543aafdf2c223ddfd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Fri, 20 Jan 2023 00:41:15 +0000 Subject: [PATCH] FontAwesomePlugin --- ui/package.json | 4 ++++ ui/src/main.ts | 2 ++ ui/src/plugins/fontawesome.ts | 20 ++++++++++++++++++++ ui/yarn.lock | 31 +++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 ui/src/plugins/fontawesome.ts diff --git a/ui/package.json b/ui/package.json index 7e1c330..145f2b2 100644 --- a/ui/package.json +++ b/ui/package.json @@ -13,6 +13,10 @@ "vue-class-component": "^8.0.0-0" }, "devDependencies": { + "@fortawesome/fontawesome-svg-core": "^6.2.1", + "@fortawesome/free-brands-svg-icons": "^6.2.1", + "@fortawesome/free-solid-svg-icons": "^6.2.1", + "@fortawesome/vue-fontawesome": "^3.0.2", "@typescript-eslint/eslint-plugin": "^5.4.0", "@typescript-eslint/parser": "^5.4.0", "@vue/cli-plugin-babel": "~5.0.0", diff --git a/ui/src/main.ts b/ui/src/main.ts index ae500bb..299eedb 100644 --- a/ui/src/main.ts +++ b/ui/src/main.ts @@ -1,4 +1,5 @@ import { Advent22Plugin } from "@/plugins/advent22" +import { FontAwesomePlugin } from "@/plugins/fontawesome" import { createApp } from 'vue' import App from './App.vue' @@ -6,5 +7,6 @@ import "@/main.scss" const app = createApp(App) app.use(Advent22Plugin) +app.use(FontAwesomePlugin) app.mount('#app') diff --git a/ui/src/plugins/fontawesome.ts b/ui/src/plugins/fontawesome.ts new file mode 100644 index 0000000..da115c5 --- /dev/null +++ b/ui/src/plugins/fontawesome.ts @@ -0,0 +1,20 @@ +import { App, Plugin } from 'vue'; + +/* import the fontawesome core */ +import { library } from '@fortawesome/fontawesome-svg-core'; + +/* import specific icons */ +import { fab } from '@fortawesome/free-brands-svg-icons'; +import { fas } from '@fortawesome/free-solid-svg-icons'; + +/* add icons to the library */ +library.add(fas, fab); + +/* import font awesome icon component */ +import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'; + +export const FontAwesomePlugin: Plugin = { + install(app: App) { + app.component('font-awesome-icon', FontAwesomeIcon); + } +} \ No newline at end of file diff --git a/ui/yarn.lock b/ui/yarn.lock index 86065a0..c297f07 100644 --- a/ui/yarn.lock +++ b/ui/yarn.lock @@ -968,6 +968,37 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" +"@fortawesome/fontawesome-common-types@6.2.1": + version "6.2.1" + resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.2.1.tgz#411e02a820744d3f7e0d8d9df9d82b471beaa073" + integrity sha512-Sz07mnQrTekFWLz5BMjOzHl/+NooTdW8F8kDQxjWwbpOJcnoSg4vUDng8d/WR1wOxM0O+CY9Zw0nR054riNYtQ== + +"@fortawesome/fontawesome-svg-core@^6.2.1": + version "6.2.1" + resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.2.1.tgz#e87e905e444b5e7b715af09b64d27b53d4c8f9d9" + integrity sha512-HELwwbCz6C1XEcjzyT1Jugmz2NNklMrSPjZOWMlc+ZsHIVk+XOvOXLGGQtFBwSyqfJDNgRq4xBCwWOaZ/d9DEA== + dependencies: + "@fortawesome/fontawesome-common-types" "6.2.1" + +"@fortawesome/free-brands-svg-icons@^6.2.1": + version "6.2.1" + resolved "https://registry.yarnpkg.com/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-6.2.1.tgz#04a6d6f7898f7ef392aba7a65030a584d4f4c84f" + integrity sha512-L8l4MfdHPmZlJ72PvzdfwOwbwcCAL0vx48tJRnI6u1PJXh+j2f3yDoKyQgO3qjEsgD5Fr2tQV/cPP8F/k6aUig== + dependencies: + "@fortawesome/fontawesome-common-types" "6.2.1" + +"@fortawesome/free-solid-svg-icons@^6.2.1": + version "6.2.1" + resolved "https://registry.yarnpkg.com/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.2.1.tgz#2290ea5adcf1537cbd0c43de6feb38af02141d27" + integrity sha512-oKuqrP5jbfEPJWTij4sM+/RvgX+RMFwx3QZCZcK9PrBDgxC35zuc7AOFsyMjMd/PIFPeB2JxyqDr5zs/DZFPPw== + dependencies: + "@fortawesome/fontawesome-common-types" "6.2.1" + +"@fortawesome/vue-fontawesome@^3.0.2": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@fortawesome/vue-fontawesome/-/vue-fontawesome-3.0.2.tgz#1b2ec546caab790c38d3dcb38407485a70703dd2" + integrity sha512-xHVtVY8ASUeEvgcA/7vULUesENhD+pi/EirRHdMBqooHlXBqK+yrV6d8tUye1m5UKQKVgYAHMhUBfOnoiwvc8Q== + "@hapi/hoek@^9.0.0": version "9.3.0" resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb"