Skip to content

Commit

Permalink
Minor fixes to Heading component; correct imports and default props.
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Apr 30, 2024
1 parent d3b11e6 commit 23a0f0d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions client/src/components/Common/Heading.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<script setup lang="ts">
import { library } from "@fortawesome/fontawesome-svg-core";
import { faAngleDoubleDown, faAngleDoubleUp } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { computed } from "vue";
library.add(faAngleDoubleDown, faAngleDoubleUp);
interface Props {
h1?: boolean;
h2?: boolean;
Expand All @@ -20,12 +24,14 @@ interface Props {
const props = withDefaults(defineProps<Props>(), {
collapse: "none",
icon: "",
size: "lg",
});
defineEmits(["click"]);
const sizeClass = computed(() => {
return `h-${props.size ?? "lg"}`;
return `h-${props.size}`;
});
const collapsible = computed(() => {
Expand Down Expand Up @@ -55,7 +61,12 @@ const element = computed(() => {
<div v-else class="stripe"></div>
<component
:is="element"
:class="[sizeClass, props.bold ? 'font-weight-bold' : '', collapsible ? 'collapsible' : '', props.truncate ? 'truncate' : '']">
:class="[
sizeClass,
props.bold ? 'font-weight-bold' : '',
collapsible ? 'collapsible' : '',
props.truncate ? 'truncate' : '',
]">
@click="$emit('click')">
<slot />
</component>
Expand Down

0 comments on commit 23a0f0d

Please sign in to comment.