Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ulixee
GitHub Repository: ulixee/secret-agent
Path: blob/main/website/src/main.js
1028 views
1
import 'prismjs/themes/prism.css';
2
import '~/assets/style/index.scss';
3
4
import CoreLayout from './layouts/CoreLayout.vue';
5
import BasicLayout from './layouts/BasicLayout.vue';
6
7
import Section from '~/components/Section.vue';
8
import Feature from '~/components/Feature.vue';
9
import Card from '~/components/Card';
10
11
import Typography from 'typography';
12
import Prism from 'vue-prismjs';
13
14
const typography = new Typography({
15
baseFontSize: '16.5px',
16
baseLineHeight: 1.6,
17
scaleRatio: 1.9,
18
headerFontFamily: [
19
'Jost',
20
'Helvetica',
21
'Helvetica Neue',
22
'Segoe UI',
23
'Helvetica',
24
'Arial',
25
'sans-serif',
26
],
27
bodyFontFamily: [
28
'Jost',
29
'Helvetica',
30
'Helvetica Neue',
31
'Segoe UI',
32
'Helvetica',
33
'Arial',
34
'sans-serif',
35
],
36
});
37
38
export default function(Vue, { head, router }) {
39
Vue.component('CoreLayout', CoreLayout);
40
Vue.component('BasicLayout', BasicLayout);
41
Vue.component('Section', Section);
42
Vue.component('Feature', Feature);
43
Vue.component('Card', Card);
44
Vue.component('Prism', Prism);
45
46
head.style.push({
47
type: 'text/css',
48
cssText: typography.toString(),
49
});
50
51
router.options.scrollBehavior = (to, from, savedPosition) => {
52
if (savedPosition) {
53
return savedPosition;
54
}
55
if (to.hash) {
56
const navHeight = document.querySelector('nav').offsetHeight;
57
const docRect = document.documentElement.getBoundingClientRect();
58
const elemRect = document.querySelector(to.hash).getBoundingClientRect();
59
60
return {
61
x: elemRect.left - docRect.left,
62
y: elemRect.top - docRect.top - navHeight,
63
};
64
}
65
return { x: 0, y: -50 };
66
};
67
}
68
69