-
Notifications
You must be signed in to change notification settings - Fork 7
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
1 parent
b3ccea9
commit fc89e03
Showing
5 changed files
with
263 additions
and
86 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
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,154 @@ | ||
<template lang="pug"> | ||
a.tile-button( | ||
:class="computedClasses" | ||
:href="href" | ||
@mouseenter="$emit('hover:start')" | ||
@mouseleave="$emit('hover:end')" | ||
@click="(e) => emit('click', e)" | ||
) | ||
.tile-button__shadow | ||
.tile-button__back | ||
.tile-button__front | ||
//- .tile-button__icon | ||
//- Icon(:icon="info.icon" class="icon" :style="{ color: info.color }") | ||
.tile-button__label | ||
slot {{ label }} | ||
|
||
|
||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref, computed, type PropType } from 'vue'; | ||
const props = defineProps<{ | ||
label?: string; | ||
href?: string; | ||
}>(); | ||
const emit = defineEmits(['click']); | ||
const computedClasses = computed(() => ({})); | ||
</script> | ||
|
||
<style scoped> | ||
@property --tile-thickness { | ||
syntax: "<length>"; | ||
inherits: true; | ||
initial-value: 0px; | ||
} | ||
.tile-button { | ||
--tile-radius: 6px; | ||
--tile-edge-color: #222; | ||
cursor: pointer; | ||
text-decoration: none; | ||
border-radius: var(--tile-radius); | ||
position: relative; | ||
font-weight: bold; | ||
transition: --tile-thickness .2s cubic-bezier(.3, .7, .4, 1);; | ||
transform: translate(var(--tile-thickness), var(--tile-thickness)); | ||
will-change: transform; | ||
outline-offset: 4px; | ||
:focus:not(:focus-visible) { | ||
outline: none; | ||
} | ||
/* slower slide back in */ | ||
transition: --tile-thickness .6s cubic-bezier(.3, .7, .4, 1); | ||
&:hover, &:focus { | ||
--tile-thickness: 4px; | ||
/* slide out more quickly */ | ||
transition: --tile-thickness .25s cubic-bezier(.3, .7, .4, 1.5); | ||
} | ||
&:active { | ||
--tile-thickness: 2px !important; | ||
transition: --tile-thickness 34ms; | ||
} | ||
} | ||
.tile-button__front { | ||
background: var(--brand-purple); | ||
border-radius: inherit; | ||
color: white; | ||
padding: 2px 16px; | ||
height: 100%; | ||
position: relative; | ||
z-index: 3; | ||
display: grid; | ||
align-items: center; | ||
justify-content: center; | ||
border: 1px solid var(--tile-edge-color); | ||
/* background: linear-gradient( | ||
var(--spin), | ||
var(--brand-purple) 0%, | ||
var(--brand-red) 100% | ||
); */ | ||
} | ||
.tile-button__back { | ||
border-radius: inherit; | ||
background: #888; | ||
position: absolute; | ||
will-change: transform; | ||
transform: translate(calc(-1 * var(--tile-thickness)), calc(-1 * var(--tile-thickness))); | ||
width: 100%; | ||
height: 100%; | ||
bottom: 0; | ||
z-index: 2; | ||
border: 1px solid var(--tile-edge-color); | ||
/* 3d top face */ | ||
&:before { | ||
content: ''; | ||
/* right: calc(-.2 * var(--tile-radius)); */ | ||
left: calc(var(--tile-thickness) + var(--tile-radius) / 2); | ||
right: calc(-.25 * var(--tile-thickness)); | ||
height: calc(var(--tile-thickness)); | ||
border-top-right-radius: 2px; | ||
/* background: var(--tile-shadow-color); */ | ||
position: absolute; | ||
transform: skewX(45deg); | ||
/* box-shadow: inset 0px -4px 4px rgba(0,0,0,.3); */ | ||
background: #AAA; | ||
/* border-top: 1px solid var(--tile-edge-color); */ | ||
border-right: 1px solid var(--tile-edge-color); | ||
} | ||
/* 3d left face */ | ||
&:after { | ||
content: ''; | ||
top: calc(var(--tile-thickness) + var(--tile-radius) / 2); | ||
bottom: calc(-.25 * var(--tile-thickness)); | ||
width: calc(var(--tile-thickness)); | ||
border-bottom-left-radius: 2px; | ||
background: var(--tile-shadow-color); | ||
background: #555; | ||
position: absolute; | ||
transform: skewY(45deg); | ||
/* border-left: 1px solid var(--tile-edge-color); */ | ||
border-bottom: 1px solid var(--tile-edge-color); | ||
/* box-shadow: inset -4px 0px 4px rgba(0,0,0,.3); */ | ||
} | ||
} | ||
.tile-button__shadow { | ||
height: calc(1.1 * var(--tile-thickness)); | ||
position: absolute; | ||
bottom: 1px; | ||
left: calc(var(--tile-radius)/4); | ||
right: calc(var(--tile-thickness)/2); | ||
box-shadow: calc(-2.5 * var(--tile-thickness)) calc(1 * var(--tile-thickness)) var(--tile-thickness) rgba(0,0,0,.3); | ||
transform: skewX(45deg); | ||
z-index: 1; | ||
} | ||
</style> |
Oops, something went wrong.