This repository has been archived by the owner on Jan 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Gregor Zweig
committed
Oct 3, 2021
1 parent
54448ef
commit f7f15bf
Showing
3 changed files
with
75 additions
and
29 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
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 |
---|---|---|
@@ -1,22 +1,37 @@ | ||
<template> | ||
<button class="hover:bg-teal-900 w-8 h-8 rounded" :class="computedClasses"> | ||
<slot /> | ||
<button | ||
class="flex items-center justify-center p-2 rounded-sm" | ||
:class="computedClasses" | ||
@click="onClick" | ||
> | ||
<component :is="icon" v-if="icon" class="w-5 h-5" /> | ||
<slot v-else /> | ||
</button> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from "vue"; | ||
import { computed, PropType } from "vue"; | ||
const props = defineProps({ | ||
/** Icon Component, to be displayed */ | ||
icon: { | ||
type: [Function, Object], | ||
required: true, | ||
}, | ||
isActive: { | ||
type: Boolean, | ||
required: true, | ||
}, | ||
onClick: { | ||
type: Function as PropType<() => void>, | ||
required: true, | ||
}, | ||
}); | ||
const computedClasses = computed(() => { | ||
return { | ||
"bg-teal-900 text-teal-50": props.isActive, | ||
"bg-gray-400 text-gray-100": props.isActive, | ||
"hover:bg-gray-200": !props.isActive, | ||
}; | ||
}); | ||
</script> |