chore: use reactive props

This commit is contained in:
Daniel Chen
2024-10-16 13:25:13 -04:00
parent 5fd2150beb
commit 6bf5d77a01
8 changed files with 41 additions and 43 deletions

View File

@@ -1,20 +1,22 @@
<script setup lang="ts">
import type { Color, ViewportLength } from "csstype";
const props = withDefaults(
defineProps<{
href?: string;
id?: string;
color?: Color;
darkcolor?: Color;
title?: string;
clearstyles?: boolean;
forceheight?: ViewportLength<"rem">;
}>(),
{ color: "pink", darkcolor: "#c88994", clearstyles: false }
);
const {
color = "pink",
darkcolor = "#c88994",
clearstyles = false,
...props
} = defineProps<{
href?: string;
id?: string;
color?: Color;
darkcolor?: Color;
title?: string;
clearstyles?: boolean;
forceheight?: ViewportLength<"rem">;
}>();
const padding = props.clearstyles ? "0" : "1rem";
const padding = clearstyles ? "0" : "1rem";
const height = props.forceheight ?? "100%";
// v-bind DOES NOT WORK on initial render
@@ -23,8 +25,8 @@ const height = props.forceheight ?? "100%";
const cssVars = {
"--padding": padding,
"--height": height,
"--color": props.color,
"--darkcolor": props.darkcolor,
"--color": color,
"--darkcolor": darkcolor,
};
</script>