public/components/HomeStatBox.vue

65 lines
1.2 KiB
Vue
Raw Normal View History

<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-09 11:43:20 -04:00
const {
href,
color = "pink",
title,
clearstyles = false,
2022-08-09 15:37:32 -04:00
forceheight,
2022-08-09 11:43:20 -04:00
} = defineProps<{
href?: string;
color?: Color;
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-09 11:43:20 -04:00
const padding = clearstyles ? "0" : "1rem";
2022-08-09 15:37:32 -04:00
const height = forceheight ?? "auto";
</script>
2022-07-22 16:08:55 -04:00
2022-07-22 15:32:00 -04:00
<template>
2022-08-09 15:37:32 -04:00
<a class="no-underline inline-block flex" :href="href">
<div class="container box">
<p class="m-0 w-full title">{{ title }}</p>
2022-08-08 18:41:29 -04:00
<div class="main-content">
<slot />
</div>
</div>
</a>
2022-07-22 15:32:00 -04:00
</template>
2022-07-22 16:08:55 -04:00
<style scoped>
.container {
/* make sure width is good for fullscreen 1080p,
* fullscreen 1080p at 1.25 scaling,
* mobile
*/
width: 28rem;
2022-08-09 15:37:32 -04:00
height: v-bind(height);
border: 0.5rem solid v-bind(color);
border-radius: 0.5rem;
}
.main-content {
2022-08-09 11:43:20 -04:00
padding: v-bind(padding);
padding-top: 0;
2022-08-09 15:54:17 -04:00
overflow-wrap: break-word;
}
.title {
background: v-bind(color);
}
@media screen and (max-width: 600px) {
.container {
2022-08-09 16:00:55 -04:00
width: 90vw;
}
2022-07-22 16:08:55 -04:00
}
</style>