Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding the ability to maintain the placeholder color if desired #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions concerns/loads-assets.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default
default: true
lazyload: Boolean
placeholderColor: String
maintainPlaceholder: Boolean
transition:
type: String
default: 'vv-fade'
Expand Down
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,19 @@ var render = function() {
})
: _vm._e(),
_c("transition", { attrs: { name: _vm.transition } }, [
_vm.placeholderColor && !_vm.showImage
_vm.placeholderColor && !_vm.showImage && !_vm.maintainPlaceholder
? _c("div", {
staticClass: "vv-placeholder",
style: { backgroundColor: _vm.placeholderColor }
})
: _vm._e()
]),
_vm.placeholderColor && !_vm.showImage && _vm.maintainPlaceholder
? _c("div", {
staticClass: "vv-placeholder",
style: { backgroundColor: _vm.placeholderColor }
})
: _vm._e(),
_vm.image && _vm.shouldLoad
? _c(
"div",
Expand Down Expand Up @@ -374,6 +380,7 @@ Logic related to loading assets
},
lazyload: Boolean,
placeholderColor: String,
maintainPlaceholder: Boolean,
transition: {
type: String,
default: 'vv-fade'
Expand Down
7 changes: 6 additions & 1 deletion index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
//- Show a placeholder shape until an asset is loaded
transition(:name='transition')
.vv-placeholder(
v-if='placeholderColor && !showImage'
v-if='placeholderColor && !showImage && !maintainPlaceholder'
:style='{ backgroundColor: placeholderColor }')

//- This keeps the placeholder present
.vv-placeholder(
v-if='placeholderColor && !showImage && maintainPlaceholder'
:style='{ backgroundColor: placeholderColor }')

//- Image asset
//- The wrapper constainer is needed for the object-fit polyfill
.vv-wrapper(v-if='image && shouldLoad')
Expand Down