Skip to content

Commit aa7b6db

Browse files
committed
Fontawesome, tweaks to lang
1 parent 9a9e041 commit aa7b6db

File tree

9 files changed

+84
-10
lines changed

9 files changed

+84
-10
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- [Numeral](http://numeraljs.com/)
77
- [Vue I18n](https://kazupon.github.io/vue-i18n/)
88
- [Vue2 smooth scroll](https://www.npmjs.com/package/vue2-smooth-scroll)
9+
- [FortAwesome / FontAwesome](https://github.com/FortAwesome/vue-fontawesome)
910
- ... and some others, probably. See [package.json](https://github.com/dazecoop/vue-template/blob/master/package.json) file for more
1011

1112
## ⚙️ Installation

package-lock.json

+42
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
"lint": "vue-cli-service lint"
99
},
1010
"dependencies": {
11+
"@fortawesome/fontawesome-svg-core": "^1.2.36",
12+
"@fortawesome/free-brands-svg-icons": "^5.15.4",
13+
"@fortawesome/free-regular-svg-icons": "^5.15.4",
14+
"@fortawesome/free-solid-svg-icons": "^5.15.4",
15+
"@fortawesome/vue-fontawesome": "^2.0.6",
1116
"@tailwindcss/forms": "^0.3.4",
1217
"@tailwindcss/postcss7-compat": "^2.0.2",
1318
"autoprefixer": "^9",

src/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import './assets/main.scss'
3939
*/
4040
import './modules/filters'
4141
import './modules/tailwind'
42+
import './modules/fontawesome'
4243

4344
/**
4445
* Global variables

src/modules/fontawesome.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import Vue from 'vue'
2+
3+
import { library } from '@fortawesome/fontawesome-svg-core'
4+
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
5+
6+
/**
7+
* Standard icons
8+
*/
9+
import {
10+
faUserSecret,
11+
} from '@fortawesome/free-solid-svg-icons'
12+
library.add(
13+
faUserSecret,
14+
)
15+
16+
/**
17+
* Brand icons
18+
*/
19+
import {
20+
faGithub,
21+
faTwitter,
22+
} from '@fortawesome/free-brands-svg-icons'
23+
library.add(
24+
faGithub,
25+
faTwitter,
26+
)
27+
28+
Vue.component('FontAwesomeIcon', FontAwesomeIcon)

src/modules/i18n.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,7 @@ Vue.prototype.$languages = languages;
3030

3131
// Default language
3232
const fallbackLocale = 'en';
33-
34-
// Attempt to grab language from URL
3533
let locale = fallbackLocale;
36-
const localeFromURL = window.location.pathname.replace(/^\/([^\/]+).*/i,'$1');
37-
if (localeFromURL.trim().length && localeFromURL !== '/') {
38-
locale = localeFromURL;
39-
}
4034

4135
// Detect users language
4236
let userLanguage = window.navigator.userLanguage || window.navigator.language;
@@ -45,9 +39,8 @@ userLanguage = userLanguage.substr(0, 2);
4539
// If users language exists in our locates, redirect to show them the correct language
4640
// only if locale doesn't already exist in URL
4741
const langs = languages.map((e) => e.value);
48-
if (localeFromURL.trim().length < 2 && langs.includes(userLanguage)) {
42+
if (langs.includes(userLanguage)) {
4943
locale = userLanguage;
50-
router.push(`/${userLanguage}`);
5144
}
5245

5346
// Create VueI18n instance with options

src/router.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const router = new Router({
99
mode: 'history',
1010
routes: [
1111
{
12-
path: '/:locale?',
12+
path: '/',
1313
name: 'index',
1414
component: Index
1515
},

src/views/errors/404.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<h2 class="text-xl">
88
Sorry, page not found!
99
</h2>
10-
<p>
10+
<p class="max-w-lg mx-auto">
1111
The page you are looking for might have been
1212
removed, had its name changed, or is temporarily unavailable.
1313
</p>

src/views/index.vue

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
:href="$siteDomain"
1212
class="hover:text-blue-500"
1313
>
14+
<font-awesome-icon
15+
:icon="['fab', 'github']"
16+
class="mr-1"
17+
/>
1418
{{ $siteDomain }}
1519
</a>
1620
</p>

0 commit comments

Comments
 (0)