mirror of
https://github.com/KevinMidboe/vue-js-modal.git
synced 2026-01-21 00:45:40 +00:00
Created ssr demo and moved csr to a sub-folder + rebuild
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<modal name="conditional-modal"
|
||||
:adaptive="true"
|
||||
@before-open="beforeOpen">
|
||||
<div style="padding:30px; text-align: center">
|
||||
Hello!
|
||||
</div>
|
||||
</modal>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'ConditionalModal',
|
||||
methods: {
|
||||
beforeOpen (event) {
|
||||
console.log('Event:', event)
|
||||
console.log('Params:', event.params)
|
||||
|
||||
if (event.params.show === false) {
|
||||
event.stop()
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
90
demo/client_side_rendering/src/components/DemoErrorModal.vue
Normal file
90
demo/client_side_rendering/src/components/DemoErrorModal.vue
Normal file
@@ -0,0 +1,90 @@
|
||||
<template>
|
||||
<modal name="error-modal"
|
||||
:classes="['v--modal', 'error-modal', hasBugs && 'has-bugs']"
|
||||
:pivot-y="0.2"
|
||||
:width="400"
|
||||
:height="300"
|
||||
@before-open="beforeOpen"
|
||||
@before-close="beforeClose">
|
||||
<div class="error-modal-content">
|
||||
<div class="bugs-label">bugs: {{bugCount}}</div>
|
||||
<button @click="createBug">Create a bug</button>
|
||||
<button @click="fixBug">Fix a bug</button>
|
||||
|
||||
<div style="padding: 10px;">
|
||||
You will be able to close the window only if you have fixed all the bugs :)
|
||||
</div>
|
||||
<sub :style="{opacity: hasBugs ? 1 : 0}">
|
||||
{{bugCount}} bugs to fix
|
||||
</sub>
|
||||
</div>
|
||||
</modal>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'DemoErrorModal',
|
||||
data () {
|
||||
return {
|
||||
bugCount: 0,
|
||||
message: '',
|
||||
hasBugs: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
createBug () {
|
||||
this.bugCount++
|
||||
},
|
||||
|
||||
fixBug () {
|
||||
this.bugCount = Math.max(this.bugCount - 1, 0)
|
||||
this.hasBugs = false
|
||||
},
|
||||
|
||||
beforeOpen (event) {
|
||||
this.bugCount = Math.round(Math.random() * 3) + 1
|
||||
},
|
||||
|
||||
beforeClose (event) {
|
||||
if (this.bugCount > 0) {
|
||||
this.hasBugs = true
|
||||
/*
|
||||
Stopping close event execution
|
||||
*/
|
||||
event.stop()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
||||
.error-modal {
|
||||
transition: box-shadow 1s;
|
||||
|
||||
&.has-bugs {
|
||||
box-shadow: 0 24px 80px -2px rgba(255, 0, 0, .6) !important;
|
||||
}
|
||||
}
|
||||
|
||||
.error-modal-content {
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
|
||||
.bugs-label {
|
||||
text-transform: uppercase;
|
||||
font-size: 60px;
|
||||
font-weight: 300;
|
||||
letter-spacing: 2px;
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
button {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
sub {
|
||||
color: #EC625F;
|
||||
transition: opacity 0.25s;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
228
demo/client_side_rendering/src/components/DemoLoginModal.vue
Normal file
228
demo/client_side_rendering/src/components/DemoLoginModal.vue
Normal file
@@ -0,0 +1,228 @@
|
||||
<template>
|
||||
<modal name="demo-login" transition="pop-out" :width="modalWidth" :height="400">
|
||||
<div class="box">
|
||||
<div class="box-part" id="bp-left">
|
||||
<div class="partition" id="partition-register">
|
||||
<div class="partition-title">CREATE ACCOUNT</div>
|
||||
<div class="partition-form">
|
||||
<form autocomplete="false">
|
||||
|
||||
<div class="autocomplete-fix">
|
||||
<input type="password">
|
||||
</div>
|
||||
|
||||
<input id="n-email" type="text" placeholder="Email">
|
||||
<input id="n-username" type="text" placeholder="Username">
|
||||
<input id="n-password2" type="password" placeholder="Password">
|
||||
</form>
|
||||
|
||||
<div style="margin-top: 42px">
|
||||
</div>
|
||||
|
||||
<div class="button-set">
|
||||
<button id="goto-signin-btn">Sign In</button>
|
||||
<button id="register-btn">Register</button>
|
||||
</div>
|
||||
|
||||
<button class="large-btn github-btn">connect with <span>github</span></button>
|
||||
<button class="large-btn facebook-btn">connect with <span>facebook</span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-part" id="bp-right">
|
||||
<div class="box-messages">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</modal>
|
||||
</template>
|
||||
<script>
|
||||
const MODAL_WIDTH = 656
|
||||
|
||||
export default {
|
||||
name: 'DemoLoginModal',
|
||||
data () {
|
||||
return {
|
||||
modalWidth: MODAL_WIDTH
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.modalWidth = window.innerWidth < MODAL_WIDTH
|
||||
? MODAL_WIDTH / 2
|
||||
: MODAL_WIDTH
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
$background_color: #404142;
|
||||
$github_color: #DBA226;
|
||||
$facebook_color: #3880FF;
|
||||
|
||||
.box {
|
||||
background: white;
|
||||
overflow: hidden;
|
||||
width: 656px;
|
||||
height: 400px;
|
||||
border-radius: 2px;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 0 40px black;
|
||||
color: #8b8c8d;
|
||||
font-size: 0;
|
||||
|
||||
.box-part {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
vertical-align: top;
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
width: 50%;
|
||||
|
||||
&#bp-right {
|
||||
background: url("/static/panorama.jpg") no-repeat top left;
|
||||
border-left: 1px solid #eee;
|
||||
}
|
||||
}
|
||||
|
||||
.box-messages {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.box-error-message {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
|
||||
height: 0;
|
||||
line-height: 32px;
|
||||
padding: 0 12px;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
font-size: 11px;
|
||||
color: white;
|
||||
background: #F38181;
|
||||
}
|
||||
|
||||
.partition {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.partition-title {
|
||||
box-sizing: border-box;
|
||||
padding: 30px;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
letter-spacing: 1px;
|
||||
font-size: 20px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.partition-form {
|
||||
padding: 0 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
input[type=password],
|
||||
input[type=text] {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 4px;
|
||||
width: 100%;
|
||||
font-size: 12px;
|
||||
line-height: 2;
|
||||
border: 0;
|
||||
border-bottom: 1px solid #DDDEDF;
|
||||
padding: 4px 8px;
|
||||
font-family: inherit;
|
||||
transition: 0.5s all;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
button {
|
||||
background: white;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
padding: 10px;
|
||||
letter-spacing: 1px;
|
||||
font-family: "Open Sans", sans-serif;
|
||||
font-weight: 400;
|
||||
min-width: 140px;
|
||||
margin-top: 8px;
|
||||
color: #8b8c8d;
|
||||
cursor: pointer;
|
||||
border: 1px solid #DDDEDF;
|
||||
text-transform: uppercase;
|
||||
transition: 0.1s all;
|
||||
font-size: 10px;
|
||||
outline: none;
|
||||
&:hover {
|
||||
border-color: mix(#DDDEDF, black, 90%);
|
||||
color: mix(#8b8c8d, black, 80%);
|
||||
}
|
||||
}
|
||||
|
||||
.large-btn {
|
||||
width: 100%;
|
||||
background: white;
|
||||
|
||||
span {
|
||||
font-weight: 600;
|
||||
}
|
||||
&:hover {
|
||||
color: white !important;
|
||||
}
|
||||
}
|
||||
|
||||
.button-set {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
#register-btn,
|
||||
#signin-btn {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.facebook-btn {
|
||||
border-color: $facebook_color;
|
||||
color: $facebook_color;
|
||||
&:hover {
|
||||
border-color: $facebook_color;
|
||||
background: $facebook_color;
|
||||
}
|
||||
}
|
||||
|
||||
.github-btn {
|
||||
border-color: $github_color;
|
||||
color: $github_color;
|
||||
&:hover {
|
||||
border-color: $github_color;
|
||||
background: $github_color;
|
||||
}
|
||||
}
|
||||
|
||||
.autocomplete-fix {
|
||||
position: absolute;
|
||||
visibility: hidden;
|
||||
overflow: hidden;
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.pop-out-enter-active,
|
||||
.pop-out-leave-active {
|
||||
transition: all 0.5s;
|
||||
}
|
||||
|
||||
.pop-out-enter,
|
||||
.pop-out-leave-active {
|
||||
opacity: 0;
|
||||
transform: translateY(24px);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<modal name="dog-profile"
|
||||
classes="cute-dog-profile-photo"
|
||||
transition="scale"
|
||||
:height="260"
|
||||
:width="260"
|
||||
@opened="opened">
|
||||
<div slot="top-right" class="ct-top-right">
|
||||
HIDE THE DOGGY
|
||||
</div>
|
||||
<img src="/static/cute_dog.gif" />
|
||||
</modal>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'InputFocusModal',
|
||||
methods: {
|
||||
opened (event) {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.cute-dog-profile-photo {
|
||||
background-color: transparent;
|
||||
border-radius: 100%;
|
||||
box-shadow: 0 2px 20px 0 rgba(0, 0, 0, 0.4);
|
||||
border: 1px solid rgba(255, 255, 255, 0.65);
|
||||
|
||||
img {
|
||||
width: 260px;
|
||||
height: 260px;
|
||||
}
|
||||
}
|
||||
|
||||
.ct-top-right {
|
||||
cursor: pointer;
|
||||
padding-top: 20px;
|
||||
padding-right: 30px;
|
||||
font-weight: 600;
|
||||
color: white;
|
||||
text-shadow: 0 0px 20px black;
|
||||
}
|
||||
|
||||
.scale-enter-active,
|
||||
.scale-leave-active {
|
||||
transition: all 0.5s;
|
||||
}
|
||||
|
||||
.scale-enter,
|
||||
.scale-leave-active {
|
||||
opacity: 0;
|
||||
transform: scale(0.3) translateY(24px);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<modal name="input-focus-modal"
|
||||
:height="150"
|
||||
:adaptive="true"
|
||||
@opened="opened">
|
||||
<div style="padding: 30px; text-align: center">
|
||||
<input class="huge-font" type="text" placeholder="email" ref="email">
|
||||
</div>
|
||||
</modal>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'InputFocusModal',
|
||||
methods: {
|
||||
opened (event) {
|
||||
console.log(this.$refs.email)
|
||||
// this.$refs.email.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
input.huge-font {
|
||||
font-size: 70px;
|
||||
font-weight: 100;
|
||||
text-align: center;
|
||||
min-width: auto;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
33
demo/client_side_rendering/src/components/ModesTable.vue
Normal file
33
demo/client_side_rendering/src/components/ModesTable.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width: 20%">Modes:</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Simple</b></td>
|
||||
<td>Yet another boring modal :)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Adaptive</b></td>
|
||||
<td>Tries to adjust to the page size</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Resizable</b></td>
|
||||
<td>
|
||||
Has a small arrow on the bottom-right corner (customizable) that you can drag to change the size of the modal
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Draggable</b></td>
|
||||
<td>
|
||||
Allows to drag modal on the screen
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'ModesTable'
|
||||
}
|
||||
</script>
|
||||
103
demo/client_side_rendering/src/components/PropsTable.vue
Normal file
103
demo/client_side_rendering/src/components/PropsTable.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<table class="props">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(prop, name) in props">
|
||||
<td>
|
||||
{{name}}
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="Array.isArray(prop.type)">
|
||||
{{prop.type.map(v => v.name).join(' / ')}}
|
||||
</template>
|
||||
<template v-else>
|
||||
<span>{{prop.type.name}}</span>
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
{{prop.default}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'PropsTable',
|
||||
data () {
|
||||
return {
|
||||
props: {
|
||||
name: {
|
||||
required: true,
|
||||
type: String,
|
||||
},
|
||||
delay: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
resizable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
adaptive: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
transition: {
|
||||
type: String,
|
||||
},
|
||||
classes: {
|
||||
type: [String, Array],
|
||||
default: 'v--modal',
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
default: 600
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 300
|
||||
},
|
||||
minWidth: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
minHeight: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
pivotX: {
|
||||
type: Number,
|
||||
default: 0.5
|
||||
},
|
||||
pivotY: {
|
||||
type: Number,
|
||||
default: 0.5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
table.props {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
border-collapse: collapse;
|
||||
|
||||
td, th {
|
||||
border: 1px solid #eee;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user