diff options
author | Zero~Informatique | 2019-12-21 03:32:20 +0100 |
---|---|---|
committer | Zero~Informatique | 2019-12-21 03:32:20 +0100 |
commit | 6e7ee4d38fb3630a13d31592f0f6ae9bbe8e1bd6 (patch) | |
tree | 88ebce4634d26daa80718ab1526c728f55a983f0 /viewer/src/components | |
parent | 62005141132da1e9761598fa3e4b35b4dab38a89 (diff) | |
download | ldgallery-6e7ee4d38fb3630a13d31592f0f6ae9bbe8e1bd6.tar.gz |
Implemented global components registration
Moved the fullscreen button as a global component (as demonstration)
Improved the layout CSS
Diffstat (limited to 'viewer/src/components')
-rw-r--r-- | viewer/src/components/LdButtonFullscreen.vue | 25 | ||||
-rw-r--r-- | viewer/src/components/index.ts | 22 |
2 files changed, 47 insertions, 0 deletions
diff --git a/viewer/src/components/LdButtonFullscreen.vue b/viewer/src/components/LdButtonFullscreen.vue new file mode 100644 index 0000000..2302a27 --- /dev/null +++ b/viewer/src/components/LdButtonFullscreen.vue | |||
@@ -0,0 +1,25 @@ | |||
1 | <template> | ||
2 | <fa-icon icon="expand-arrows-alt" class="button-fullscreen" @click="$uiStore.toggleFullscreen()" /> | ||
3 | </template> | ||
4 | |||
5 | <script lang="ts"> | ||
6 | import { Component, Vue } from "vue-property-decorator"; | ||
7 | |||
8 | @Component | ||
9 | export default class LdButtonFullscreen extends Vue {} | ||
10 | </script> | ||
11 | |||
12 | <style lang="scss"> | ||
13 | .button-fullscreen { | ||
14 | position: fixed; | ||
15 | top: 0; | ||
16 | right: 0; | ||
17 | margin: 3px 10px; | ||
18 | opacity: 50%; | ||
19 | font-size: 1.5em; | ||
20 | color: white; | ||
21 | mix-blend-mode: difference; | ||
22 | cursor: pointer; | ||
23 | z-index: 4; | ||
24 | } | ||
25 | </style> | ||
diff --git a/viewer/src/components/index.ts b/viewer/src/components/index.ts new file mode 100644 index 0000000..1406b34 --- /dev/null +++ b/viewer/src/components/index.ts | |||
@@ -0,0 +1,22 @@ | |||
1 | import Vue from 'vue' | ||
2 | |||
3 | const requireComponent = require.context( | ||
4 | '@/components', | ||
5 | false, // Whether or not to look in subfolders | ||
6 | // The regular expression used to match base component filenames | ||
7 | /Ld[A-Z]\w+\.vue$/ | ||
8 | ) | ||
9 | |||
10 | requireComponent.keys().forEach(fileName => { | ||
11 | const componentConfig = requireComponent(fileName) | ||
12 | const componentName = fileName.split('/').pop()!.replace(/\.vue$/, ''); | ||
13 | |||
14 | // Register component globally | ||
15 | Vue.component( | ||
16 | componentName, | ||
17 | // Look for the component options on `.default`, which will | ||
18 | // exist if the component was exported with `export default`, | ||
19 | // otherwise fall back to module's root. | ||
20 | componentConfig.default || componentConfig | ||
21 | ) | ||
22 | }) \ No newline at end of file | ||