UNPKG

@fred78290/vue3-content-placeholders

Version:

Vue3 Components for rendering animated content placeholders like facebook

189 lines 5.22 kB
@keyframes vueContentPlaceholdersAnimation { 0% { transform: translate3d(-30%, 0, 0); } 100% { transform: translate3d(100%, 0, 0); } } .vue3-content-placeholders-heading { display: flex; } [class^=vue3-content-placeholders-] + .vue3-content-placeholders-heading { margin-top: 20px; } .vue3-content-placeholders-heading__img { position: relative; overflow: hidden; height: 15px; background: #eee; width: 60px; height: 60px; margin-right: 15px; } .vue3-content-placeholders-is-rounded .vue3-content-placeholders-heading__img { border-radius: 6px; } .vue3-content-placeholders-is-centered .vue3-content-placeholders-heading__img { margin-left: auto; margin-right: auto; } .vue3-content-placeholders-is-animated .vue3-content-placeholders-heading__img::before { content: ""; position: absolute; top: 0; left: 0; width: 100vw; max-width: 1000px; height: 100%; background: linear-gradient(to right, transparent 0%, #e1e1e1 15%, transparent 30%); animation-duration: 1.5s; animation-fill-mode: forwards; animation-iteration-count: infinite; animation-name: vueContentPlaceholdersAnimation; animation-timing-function: linear; } .vue3-content-placeholders-heading__content { display: flex; flex: 1; flex-direction: column; justify-content: center; } .vue3-content-placeholders-heading__title { position: relative; overflow: hidden; height: 15px; background: #eee; width: 85%; margin-bottom: 10px; background: #ccc; } .vue3-content-placeholders-is-rounded .vue3-content-placeholders-heading__title { border-radius: 6px; } .vue3-content-placeholders-is-centered .vue3-content-placeholders-heading__title { margin-left: auto; margin-right: auto; } .vue3-content-placeholders-is-animated .vue3-content-placeholders-heading__title::before { content: ""; position: absolute; top: 0; left: 0; width: 100vw; max-width: 1000px; height: 100%; background: linear-gradient(to right, transparent 0%, #e1e1e1 15%, transparent 30%); animation-duration: 1.5s; animation-fill-mode: forwards; animation-iteration-count: infinite; animation-name: vueContentPlaceholdersAnimation; animation-timing-function: linear; } .vue3-content-placeholders-heading__subtitle { position: relative; overflow: hidden; height: 15px; background: #eee; width: 90%; } .vue3-content-placeholders-is-rounded .vue3-content-placeholders-heading__subtitle { border-radius: 6px; } .vue3-content-placeholders-is-centered .vue3-content-placeholders-heading__subtitle { margin-left: auto; margin-right: auto; } .vue3-content-placeholders-is-animated .vue3-content-placeholders-heading__subtitle::before { content: ""; position: absolute; top: 0; left: 0; width: 100vw; max-width: 1000px; height: 100%; background: linear-gradient(to right, transparent 0%, #e1e1e1 15%, transparent 30%); animation-duration: 1.5s; animation-fill-mode: forwards; animation-iteration-count: infinite; animation-name: vueContentPlaceholdersAnimation; animation-timing-function: linear; } [class^=vue3-content-placeholders-] + .vue3-content-placeholders-text { margin-top: 20px; } .vue3-content-placeholders-text__line { position: relative; overflow: hidden; height: 15px; background: #eee; width: 100%; margin-bottom: 10px; } .vue3-content-placeholders-is-rounded .vue3-content-placeholders-text__line { border-radius: 6px; } .vue3-content-placeholders-is-centered .vue3-content-placeholders-text__line { margin-left: auto; margin-right: auto; } .vue3-content-placeholders-is-animated .vue3-content-placeholders-text__line::before { content: ""; position: absolute; top: 0; left: 0; width: 100vw; max-width: 1000px; height: 100%; background: linear-gradient(to right, transparent 0%, #e1e1e1 15%, transparent 30%); animation-duration: 1.5s; animation-fill-mode: forwards; animation-iteration-count: infinite; animation-name: vueContentPlaceholdersAnimation; animation-timing-function: linear; } .vue3-content-placeholders-text__line:nth-child(4n+1) { width: 80%; } .vue3-content-placeholders-text__line:nth-child(4n+2) { width: 100%; } .vue3-content-placeholders-text__line:nth-child(4n+3) { width: 70%; } .vue3-content-placeholders-text__line:nth-child(4n+4) { width: 85%; } .vue3-content-placeholders-img { position: relative; overflow: hidden; height: 15px; background: #eee; width: 100%; height: 120px; } .vue3-content-placeholders-is-rounded .vue3-content-placeholders-img { border-radius: 6px; } .vue3-content-placeholders-is-centered .vue3-content-placeholders-img { margin-left: auto; margin-right: auto; } .vue3-content-placeholders-is-animated .vue3-content-placeholders-img::before { content: ""; position: absolute; top: 0; left: 0; width: 100vw; max-width: 1000px; height: 100%; background: linear-gradient(to right, transparent 0%, #e1e1e1 15%, transparent 30%); animation-duration: 1.5s; animation-fill-mode: forwards; animation-iteration-count: infinite; animation-name: vueContentPlaceholdersAnimation; animation-timing-function: linear; } [class^=vue3-content-placeholders-] + .vue3-content-placeholders-img { margin-top: 20px; }