forked from vishnuraghavb/EnBizCard
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
vishnuraghavb
committed
Feb 17, 2021
1 parent
9e462bf
commit 865e4ad
Showing
37 changed files
with
678 additions
and
462 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
.stepC { | ||
margin-left: 0; | ||
margin-right: 0; | ||
} | ||
.toggle-switch:checked { | ||
@apply right-0; | ||
right: 0; | ||
} | ||
#device { | ||
border-radius: 1rem; | ||
width: 100%; | ||
} | ||
.max-hd { | ||
scrollbar-width: none; | ||
-ms-overflow-style: none; | ||
max-height: 100vh; | ||
} | ||
.max-hd::-webkit-scrollbar { | ||
display: none; | ||
} | ||
.theme-one { | ||
scrollbar-width: none; | ||
-ms-overflow-style: none; | ||
} | ||
.theme-one::-webkit-scrollbar { | ||
display: none; | ||
} | ||
.footer { | ||
display: flex; | ||
} | ||
.stepC.actions { | ||
display: grid; | ||
grid-gap: 1.5rem; | ||
justify-content: space-between; | ||
grid-template-columns: repeat(auto-fill, minmax(3rem, auto)); | ||
} | ||
|
||
@media (min-width: 640px) { | ||
.stepC { | ||
margin-left: 0.5rem; | ||
margin-right: 0.5rem; | ||
} | ||
} | ||
@media (min-width: 768px) { | ||
.max-hd { | ||
max-height: 38rem; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<template> | ||
<div | ||
id="notificationContainer" | ||
class="flex justify-center fixed top-0 left-0 right-0 bottom-0 items-center z-30 bg-black bg-opacity-80" | ||
> | ||
<div | ||
class="flex flex-col items-center notification content bg-gray-800 text-gray-100 rounded relative z-50 max-w-sm mx-4 p-2" | ||
> | ||
<div class="mb-2 max-w-sm max-h-80"> | ||
<img ref="image" :src="src" /> | ||
</div> | ||
<div class="flex"> | ||
<button | ||
class="p-3 font-extrabold rounded tracking-wide focus:outline-none select-none bg-gray-700 mr-2 hover:bg-gray-600 focus:bg-gray-600 transition-colors duration-200" | ||
@click="$emit('closeCropper')" | ||
> | ||
Cancel | ||
</button> | ||
<button | ||
class="font-extrabold leading-none tracking-wide select-none flex-shrink-0 p-3 text-white bg-green-600 rounded hover:bg-green-500 focus:bg-green-500 transition-colors duration-200 focus:outline-none" | ||
@click="cropPhoto" | ||
> | ||
Crop photo | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import Cropper from 'cropperjs' | ||
import 'cropperjs/dist/cropper.css' | ||
export default { | ||
props: ['src', 'mime', 'content', 'resizeImage'], | ||
data() { | ||
return { | ||
cropper: {}, | ||
dataURL: null, | ||
blobData: null, | ||
image: {}, | ||
} | ||
}, | ||
methods: { | ||
cropPhoto() { | ||
let vm = this | ||
const canvas = this.cropper.getCroppedCanvas() | ||
let url = canvas.toDataURL(this.mime) | ||
this.content.photo.url = url | ||
this.content.photo.mime = this.mime | ||
canvas.toBlob( | ||
(blob) => { | ||
vm.content.photo.blob = new File([blob], 'photo', { | ||
type: this.mime, | ||
}) | ||
vm.resizeImage('photo', vm.mime) | ||
vm.$emit('closeCropper') | ||
}, | ||
this.mime, | ||
0.8 | ||
) | ||
}, | ||
}, | ||
mounted() { | ||
this.image = this.$refs.image | ||
this.cropper = new Cropper(this.image, { | ||
zoomable: false, | ||
scalable: true, | ||
aspectRatio: 1, | ||
autoCropArea: 1, | ||
responsive: true, | ||
viewMode: 2, | ||
highlight: false, | ||
rotatable: false, | ||
}) | ||
}, | ||
} | ||
</script> |
Oops, something went wrong.