Skip to content

Commit 7a8e482

Browse files
committed
move example components
1 parent 68257ce commit 7a8e482

27 files changed

+52
-89
lines changed

docs/plugins/global.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import Vue from 'vue'
2-
import VueFinalModal from 'vue-final-modal/lib/VueFinalModal.vue'
32

3+
import VueFinalModal from 'vue-final-modal/lib/VueFinalModal.vue'
44
Vue.component('VueFinalModal', VueFinalModal)
5+
6+
import components from '../../example/src/components/index.js'
7+
Object.keys(components).forEach(name => {
8+
Vue.component(name, components[name])
9+
})

example/src/App.vue

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,12 @@
11
<template>
22
<div id="app" class="p-4">
3-
<vue-final-modal
4-
v-model="showModal"
5-
classes="flex justify-center items-center"
6-
content-class="w-2/3 max-h-1/2 p-4 bg-white dark:bg-gray-900 border dark:border-gray-800 rounded overflow-auto"
7-
>
8-
<h2 class="text-2xl mb-2"># Simple Modal</h2>
9-
<p>
10-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget lacus
11-
et urna tincidunt imperdiet. Sed sagittis nisl sed felis molestie, quis
12-
aliquet nulla iaculis. Maecenas risus quam, dictum a magna sit amet,
13-
rutrum sagittis turpis. Nulla lobortis ipsum a est tincidunt, vel
14-
lobortis dolor dignissim. Mauris cursus condimentum interdum. Ut
15-
venenatis purus a purus semper, sed posuere arcu dapibus. Proin non
16-
metus tempus, accumsan ante eu, ullamcorper felis. Sed sed justo non
17-
felis iaculis finibus. Nam ipsum diam, consectetur eget efficitur id,
18-
malesuada dignissim magna. Sed sagittis, turpis ac posuere lacinia,
19-
risus massa ornare eros, vitae condimentum lorem ante eget nisi. Proin
20-
eget ornare lacus, suscipit lacinia turpis. Nam eu ante sed libero
21-
tristique consequat eu non sapien.
22-
</p>
23-
</vue-final-modal>
24-
<button class="base-button" @click="showModal = true">Simple</button>
3+
<TailwindSimple />
4+
<TailwindLockScroll />
5+
<TailwindHideOverlay />
6+
<TailwindClickToClose />
7+
<TailwindPreventClick />
8+
<TailwindStackable />
9+
<TailwindScrollable />
10+
<TailwindAttach />
2511
</div>
2612
</template>
27-
28-
<script>
29-
export default {
30-
data: () => ({
31-
showModal: false
32-
})
33-
}
34-
</script>
35-
36-
<style scoped>
37-
.base-button {
38-
@apply px-2 py-1 border rounded;
39-
}
40-
</style>

example/src/components/BaseButton.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<template>
2+
<button class="base-button" v-on="$listeners">
3+
<slot></slot>
4+
</button>
5+
</template>
6+
7+
<style scoped>
8+
.base-button {
9+
@apply mb-2 px-2 py-1 border rounded;
10+
}
11+
</style>

docs/components/global/BaseGithubCorner.vue renamed to example/src/components/BaseGithubCorner.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
></a>
2929
</template>
3030

31-
<style lang="css" scoped>
31+
<style scoped>
3232
.github-corner:hover .octo-arm {
3333
animation: octocat-wave 560ms ease-in-out;
3434
}

docs/components/global/basic/BasicOptions.vue renamed to example/src/components/basic/BasicOptions.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,7 @@
8989
id="attach"
9090
class="relative w-full h-64 mt-8 p-4 border rounded dark:bg-gray-700"
9191
>
92-
<base-button
93-
@click="
94-
attach = '#attach'
95-
showModal = true
96-
"
92+
<base-button @click="openAttach"
9793
>Attach to here and open modal</base-button
9894
>
9995
</div>
@@ -131,6 +127,12 @@ export default {
131127
attach: this.attach ? '#attach' : false
132128
}
133129
}
130+
},
131+
methods: {
132+
openAttach() {
133+
this.attach = '#attach'
134+
this.showModal = true
135+
}
134136
}
135137
}
136138
</script>

docs/components/global/basic/BasicPlainStyleCodepen.vue renamed to example/src/components/basic/BasicPlainStyleCodepen.vue

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,3 @@
1818
<a href="https://codepen.io">CodePen</a>.
1919
</iframe>
2020
</template>
21-
22-
<script>
23-
export default {
24-
data: () => ({
25-
showModal: false
26-
})
27-
}
28-
</script>
29-
30-
<style>
31-
.modal-container {
32-
display: flex;
33-
justify-content: center;
34-
align-items: center;
35-
}
36-
.modal-content {
37-
position: relative;
38-
width: 50%;
39-
max-height: 300px;
40-
padding: 16px;
41-
overflow: auto;
42-
background-color: #fff;
43-
border-radius: 4px;
44-
}
45-
.modal-close {
46-
position: absolute;
47-
top: 0;
48-
right: 0;
49-
display: flex;
50-
justify-content: center;
51-
align-items: center;
52-
width: 32px;
53-
height: 32px;
54-
margin: 8px 8px 0 0;
55-
cursor: pointer;
56-
}
57-
.modal-close::hover {
58-
color: gray;
59-
}
60-
</style>

example/src/components/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const requireModule = require.context('.', true, /\.vue$/)
2+
const modules = {}
3+
4+
requireModule.keys().forEach(fileName => {
5+
let moduleName = fileName.replace(/(\.\/|\.vue)/g, '')
6+
moduleName = moduleName.split('/')[moduleName.split('/').length - 1]
7+
8+
modules[moduleName] = {
9+
...requireModule(fileName).default
10+
}
11+
})
12+
13+
export default modules

0 commit comments

Comments
 (0)