summaryrefslogtreecommitdiff
path: root/src/misc
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2018-11-06 01:40:11 +0900
committerGitHub <noreply@github.com>2018-11-06 01:40:11 +0900
commit9f5dc2c0df0cdba1113697bdd71637a404444065 (patch)
treea1d942cf6440f82244ef58ee7ff93103ff70f521 /src/misc
parent:art: (diff)
downloadsharkey-9f5dc2c0df0cdba1113697bdd71637a404444065.tar.gz
sharkey-9f5dc2c0df0cdba1113697bdd71637a404444065.tar.bz2
sharkey-9f5dc2c0df0cdba1113697bdd71637a404444065.zip
[WIP] Use FontAwesome Component for Vue (#3127)
* wip * Rename * Clean up * Clean up * wip * wip * Enable tree shaking * :v: * :v: * wip * wip * Clean up
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/fa.ts54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/misc/fa.ts b/src/misc/fa.ts
deleted file mode 100644
index 5405255ac7..0000000000
--- a/src/misc/fa.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Replace fontawesome symbols
- */
-
-import * as fontawesome from '@fortawesome/fontawesome-svg-core';
-import { far } from '@fortawesome/free-regular-svg-icons';
-import { fas } from '@fortawesome/free-solid-svg-icons';
-import { fab } from '@fortawesome/free-brands-svg-icons';
-
-fontawesome.library.add(far, fas, fab);
-
-export const pattern = /%fa:(.+?)%/g;
-
-export const replacement = (match: string, key: string) => {
- const args = key.split(' ');
- let prefix = 'fas';
- const classes: string[] = [];
- let transform = '';
- let name;
-
- args.forEach(arg => {
- if (arg == 'R' || arg == 'S' || arg == 'B') {
- prefix =
- arg == 'R' ? 'far' :
- arg == 'S' ? 'fas' :
- arg == 'B' ? 'fab' :
- '';
- } else if (arg.startsWith('.')) {
- classes.push(`fa-${arg.substr(1)}`);
- } else if (arg.startsWith('-')) {
- transform = arg.substr(1).split('|').join(' ');
- } else {
- name = arg;
- }
- });
-
- const icon = fontawesome.icon({ prefix, iconName: name } as fontawesome.IconLookup, {
- classes: classes,
- transform: fontawesome.parse.transform(transform)
- });
-
- if (icon) {
- return `<i data-fa class="${name}">${icon.html[0]}</i>`;
- } else {
- console.warn(`'${name}' not found in fa`);
- return '';
- }
-};
-
-export default (src: string) => {
- return src.replace(pattern, replacement);
-};
-
-export const fa = fontawesome;