Skip to content

Commit

Permalink
fix(#16): add ripple effect to space action menu toggle button
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRichel committed Jan 26, 2021
1 parent c0aa2ac commit ecd8121
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/animations.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@keyframes ripple {
0% {
transform: scale(0);
}
75% {
transform: scale(1.3);
}
100% {
opacity: 0;
}
}
17 changes: 17 additions & 0 deletions src/components/space-action-menu/SpaceActionMenu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@

&__btn {
color: $color-tertiary-dark;

// Ripple effect
&.clicked {
&:after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
background-color: $color-primary;
transform: scale(0);
animation-name: ripple;
animation-duration: 0.5s;
}
}
}

&__container {
Expand Down
9 changes: 9 additions & 0 deletions src/components/space-action-menu/SpaceActionMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div class="space-action-menu" v-click-away="closeMenu">
<BIMDataButton color="default" ghost rounded icon
class="space-action-menu__btn"
:class="{ clicked }"
@click="toggleMenu">
<BIMDataIcon name="ellipsis" size="l" />
</BIMDataButton>
Expand Down Expand Up @@ -81,6 +82,12 @@ export default {
const loading = createLoadingContext(`space-action-${props.space.id}`);
const clicked = ref(false);
const rippleEffect = () => {
clicked.value = true;
setTimeout(() => clicked.value = false, 500);
};
const showMenu = ref(false);
const closeMenu = () => {
closeUpdateForm();
Expand All @@ -89,6 +96,7 @@ export default {
showMenu.value = false;
};
const toggleMenu = () => {
rippleEffect();
closeUpdateForm();
closeDeleteGuard();
loading.value = false;
Expand Down Expand Up @@ -117,6 +125,7 @@ export default {
return {
// References
clicked,
loading,
showDeleteGuard,
showMenu,
Expand Down
2 changes: 2 additions & 0 deletions src/global.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@import '~@bimdata/design-system/dist/scss/elements/_BIMDataScrollbar.scss';

@import './animations.scss';

* {
box-sizing: border-box;
}
Expand Down

0 comments on commit ecd8121

Please sign in to comment.