Updated project

Added animations
This commit is contained in:
Kamil Niemczycki 2021-08-31 23:22:41 +02:00
parent 0bbcf32249
commit 1ccbc2c391
5 changed files with 147 additions and 11 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<button class="btn" :class="{ reverse: isReverse }"> <button class="btn" :class="{ reverse: isReverse }">
<font-awesome-icon class="icon" if="hasIcon" :icon="icon"/> <font-awesome-icon class="icon" v-if="hasIcon" :icon="icon"/>
<span><slot></slot></span> <span><slot></slot></span>
</button> </button>
</template> </template>

View File

@ -0,0 +1,60 @@
<template>
<button class="btn">
<font-awesome-icon class="icon" v-if="hasIcon" :icon="icon"/>
<span><slot></slot></span>
</button>
</template>
<script>
export default {
name: 'GhostButton',
props: {
hasIcon: {
type: Boolean,
default: false
},
icon: String
}
}
</script>
<style lang="scss" scoped>
$btn-gray-color: #4f4f4f;
.btn {
display: flex;
position: relative;
align-items: center;
justify-content: center;
padding: 8px 10px;
background-color: transparent;
color: $btn-gray-color;
font-size: 1.2em;
border: unset;
.icon {
margin-right: 10px;
font-size: 1.3em;
}
&:hover {
&::after {
width: 98%;
}
}
&::after {
content: '';
position: absolute;
left: 0;
right: 0;
bottom: 0;
margin: 0 auto;
width: 30%;
height: 2px;
background-color: $btn-gray-color;
transform: translateY(2px);
transition: width .3s linear;
}
}
</style>

View File

@ -43,6 +43,7 @@
background-color: #fafafa; background-color: #fafafa;
border: 1px solid rgba(0, 0, 0, .025); border: 1px solid rgba(0, 0, 0, .025);
border-radius: 5px; border-radius: 5px;
animation: load-project 2s forwards;
.project-image { .project-image {
grid-area: image; grid-area: image;
@ -86,7 +87,7 @@
} }
} }
@media screen and (min-width: 901px) { @media screen and (min-width: 900px) {
.project { .project {
.more-button { .more-button {
display: flex; display: flex;
@ -151,7 +152,18 @@
} }
} }
@media screen and (max-width: 500px) { @keyframes load-project {
from {
transform: translateY(20px);
opacity: .1;
}
to {
transform: translateY(0);
opacity: 1;
}
}
@media screen and (max-width: 600px) {
.projects .container { .projects .container {
grid-template-columns: 1fr; grid-template-columns: 1fr;
padding: 25px; padding: 25px;

View File

@ -6,11 +6,17 @@
<p>Poniżej przedstawiam Państwu, wybraną przeze mnie, listę projektów.</p> <p>Poniżej przedstawiam Państwu, wybraną przeze mnie, listę projektów.</p>
</div> </div>
</projects> </projects>
<div class="more-button">
<GhostButton @click.native="$router.push('projects')">
RESZTA PROJEKTÓW
</GhostButton>
</div>
</section> </section>
</template> </template>
<script> <script>
import Projects from '../SelectedProjects' import Projects from '../SelectedProjects'
import GhostButton from '../GhostButton'
export default { export default {
name: 'FavoriteProjects', name: 'FavoriteProjects',
@ -73,16 +79,33 @@ export default {
] ]
}, },
components: { components: {
GhostButton,
Projects Projects
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
@import "scss/default"; @import "scss/default";
.selected-projects { .selected-projects {
background-color: #fdfdfd !important; background-color: #fdfdfd !important;
.more-button {
margin-bottom: 45px;
.btn {
margin: 0 auto;
@media screen and (max-width: 600px) {
width: 100%;
}
}
@media screen and (max-width: 600px) {
padding: 0 25px;
}
}
} }
.header-container { .header-container {
@extend .container; @extend .container;

View File

@ -12,6 +12,9 @@
</ul> </ul>
</div> </div>
<projects :projects="projects.active" /> <projects :projects="projects.active" />
<div v-if="projects.active.length === 0" class="loading">
<div class="loading-animation"></div>
</div>
</div> </div>
</template> </template>
@ -26,6 +29,7 @@
position: relative; position: relative;
cursor: pointer; cursor: pointer;
margin-right: 25px; margin-right: 25px;
a { a {
color: var(--text-color); color: var(--text-color);
&:hover { &:hover {
@ -43,17 +47,51 @@
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
width: 100%; width: 0;
height: 2px; height: 2px;
background-color: #A2CF00; background-color: #A2CF00;
transform: translateY(8px); transform: translateY(8px);
animation: load-underline 300ms forwards;
} }
} }
@media screen and (max-width: 450px) {
margin-right: 15px;
}
} }
} }
} }
.projects { .projects {
padding-top: 25px; padding-top: 25px;
padding-bottom: 25px;
}
.loading {
height: 300px;
.loading-animation {
margin: 20px auto;
width: 50px;
height: 50px;
border: 5px solid #f3f3f3;
border-top: 10px #A2CF00 solid;
border-radius: 50%;
animation: loading-animation 1s linear infinite;
}
}
@keyframes loading-animation {
0% {
transform: rotate(0);
}
100% {
transform: rotate(360deg);
}
}
@keyframes load-underline {
from {
width: 0;
}
to {
width: 100%;
}
} }
</style> </style>
@ -172,12 +210,15 @@ export default {
}, },
methods: { methods: {
loadListWhereCategory (category) { loadListWhereCategory (category) {
if (category !== 'wszystkie') { this.projects.active = []
const projects = this.projects.all.filter(project => project.category === category) setTimeout(() => {
this.projects.active = projects if (category !== 'wszystkie') {
} else { const projects = this.projects.all.filter(project => project.category === category)
this.projects.active = this.projects.all this.projects.active = projects
} } else {
this.projects.active = this.projects.all
}
}, 1000)
}, },
changeCategory (category) { changeCategory (category) {
this.categories.active = category this.categories.active = category