2022-08-08 17:49:35 -04:00
|
|
|
<script setup lang="ts">
|
2022-08-09 15:37:32 -04:00
|
|
|
import type { Color, ViewportLength } from "csstype";
|
|
|
|
|
|
|
|
// fix ReferenceError: _unref is not defined
|
|
|
|
// https://github.com/nuxt/framework/issues/5546
|
|
|
|
import { unref as _unref } from "vue";
|
2022-08-08 17:49:35 -04:00
|
|
|
|
2022-08-09 11:43:20 -04:00
|
|
|
const {
|
|
|
|
href,
|
2022-08-12 20:44:27 -04:00
|
|
|
id,
|
2022-08-09 11:43:20 -04:00
|
|
|
color = "pink",
|
2022-08-09 16:25:23 -04:00
|
|
|
darkcolor = "#c88994",
|
2022-08-09 11:43:20 -04:00
|
|
|
title,
|
|
|
|
clearstyles = false,
|
2022-08-09 15:37:32 -04:00
|
|
|
forceheight,
|
2022-08-09 11:43:20 -04:00
|
|
|
} = defineProps<{
|
2022-08-08 17:49:35 -04:00
|
|
|
href?: string;
|
2022-08-12 20:44:27 -04:00
|
|
|
id?: string;
|
2022-08-08 17:49:35 -04:00
|
|
|
color?: Color;
|
2022-08-09 16:25:23 -04:00
|
|
|
darkcolor?: Color;
|
2022-08-08 17:49:35 -04:00
|
|
|
title?: string;
|
2022-08-09 11:43:20 -04:00
|
|
|
clearstyles?: boolean;
|
2022-08-09 15:37:32 -04:00
|
|
|
forceheight?: ViewportLength<"rem">;
|
2022-08-08 17:49:35 -04:00
|
|
|
}>();
|
2022-08-09 11:43:20 -04:00
|
|
|
|
|
|
|
const padding = clearstyles ? "0" : "1rem";
|
2022-08-10 10:56:49 -04:00
|
|
|
const height = forceheight ?? "100%";
|
|
|
|
|
|
|
|
// v-bind DOES NOT WORK on initial render
|
|
|
|
// so unfortunately we have to use the old way
|
|
|
|
|
|
|
|
const cssVars = {
|
|
|
|
"--padding": padding,
|
|
|
|
"--height": height,
|
|
|
|
"--color": color,
|
|
|
|
"--darkcolor": darkcolor,
|
|
|
|
};
|
2022-08-08 17:49:35 -04:00
|
|
|
</script>
|
2022-07-22 16:08:55 -04:00
|
|
|
|
2022-07-22 15:32:00 -04:00
|
|
|
<template>
|
2022-08-12 20:44:27 -04:00
|
|
|
<a
|
|
|
|
class="no-underline inline-block flex flex-col items-stretch"
|
|
|
|
:href="href"
|
|
|
|
:id="id"
|
|
|
|
>
|
2022-08-10 10:56:49 -04:00
|
|
|
<div class="container box" :style="cssVars">
|
2022-08-08 17:49:35 -04:00
|
|
|
<p class="m-0 w-full title">{{ title }}</p>
|
2022-08-08 18:41:29 -04:00
|
|
|
<div class="main-content">
|
|
|
|
<slot />
|
|
|
|
</div>
|
2022-08-08 17:49:35 -04:00
|
|
|
</div>
|
|
|
|
</a>
|
2022-07-22 15:32:00 -04:00
|
|
|
</template>
|
2022-07-22 16:08:55 -04:00
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.container {
|
2022-08-08 17:49:35 -04:00
|
|
|
/* make sure width is good for fullscreen 1080p,
|
|
|
|
* fullscreen 1080p at 1.25 scaling,
|
|
|
|
* mobile
|
|
|
|
*/
|
|
|
|
width: 28rem;
|
2022-08-10 10:56:49 -04:00
|
|
|
height: var(--height);
|
|
|
|
border: 0.5rem solid var(--color);
|
2022-08-08 17:49:35 -04:00
|
|
|
border-radius: 0.5rem;
|
2022-08-09 19:31:13 -04:00
|
|
|
transition: transform 0.2s ease;
|
|
|
|
box-shadow: 0 0.1rem 0.5rem 0 gray;
|
|
|
|
}
|
|
|
|
|
|
|
|
.container:hover,
|
|
|
|
.container:active {
|
|
|
|
transform: scale(1.05);
|
2022-08-08 17:49:35 -04:00
|
|
|
}
|
|
|
|
|
2022-08-09 16:25:23 -04:00
|
|
|
html.dark .container {
|
2022-08-10 11:12:36 -04:00
|
|
|
border: 0.5rem solid var(--darkcolor);
|
2022-08-09 19:31:13 -04:00
|
|
|
box-shadow: 0 0.1rem 0.5rem 0 black;
|
2022-08-09 16:25:23 -04:00
|
|
|
}
|
|
|
|
|
2022-08-08 17:49:35 -04:00
|
|
|
.main-content {
|
2022-08-10 10:56:49 -04:00
|
|
|
padding: var(--padding);
|
2022-08-08 17:49:35 -04:00
|
|
|
padding-top: 0;
|
2022-08-09 15:54:17 -04:00
|
|
|
overflow-wrap: break-word;
|
2022-08-08 17:49:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
.title {
|
2022-08-10 10:56:49 -04:00
|
|
|
background: var(--color);
|
2022-08-08 17:49:35 -04:00
|
|
|
}
|
|
|
|
|
2022-08-09 16:25:23 -04:00
|
|
|
html.dark .title {
|
2022-08-10 11:12:36 -04:00
|
|
|
background: var(--darkcolor);
|
2022-08-09 16:25:23 -04:00
|
|
|
}
|
|
|
|
|
2022-08-08 17:49:35 -04:00
|
|
|
@media screen and (max-width: 600px) {
|
|
|
|
.container {
|
2022-08-09 16:00:55 -04:00
|
|
|
width: 90vw;
|
2022-08-08 17:49:35 -04:00
|
|
|
}
|
2022-07-22 16:08:55 -04:00
|
|
|
}
|
|
|
|
</style>
|