-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
14 changed files
with
8,077 additions
and
615 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<script setup lang="ts"> | ||
import type { IconDefinition } from '@fortawesome/fontawesome-svg-core' | ||
import type { Component } from 'vue' | ||
interface Props { | ||
icons: { | ||
icon?: IconDefinition | ||
component?: Component, | ||
value: string | ||
}[] | ||
} | ||
const props = defineProps<Props>() | ||
const selected = defineModel<string[]>({ required: true }) | ||
const inital: Record<string, boolean> = {} | ||
const modelValues = ref<Record<string, boolean>>(props.icons.reduce((map, { value }) => { | ||
map[value] = selected.value.includes(value) | ||
return map | ||
}, inital)) | ||
watch(modelValues, () => { | ||
const list: string[] = [] | ||
Object.entries(modelValues.value).forEach(([key, value]) => { | ||
if (value) { | ||
list.push(key) | ||
} | ||
}) | ||
selected.value = list | ||
}, { deep: true }) | ||
</script> | ||
|
||
<template> | ||
<div class="bc-togglebar"> | ||
<BcToggleMultibarButton v-for="icon in props.icons" :key="icon.value" v-model="modelValues[icon.value]" :icon="icon.icon"> | ||
<template #icon> | ||
<slot :name="icon.value"> | ||
<component :is="icon.component" /> | ||
</slot> | ||
</template> | ||
</BcToggleMultibarButton> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
.bc-togglebar { | ||
display: inline-flex; | ||
gap: var(--padding); | ||
padding: 7px 10px; | ||
background-color: var(--container-background); | ||
border: solid 1px var(--container-border-color); | ||
border-radius: var(--border-radius); | ||
} | ||
</style> |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<script setup lang="ts"> | ||
import type { IconDefinition } from '@fortawesome/fontawesome-svg-core' | ||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' | ||
interface Props { | ||
icon?: IconDefinition, | ||
falseIcon?: IconDefinition, | ||
} | ||
const props = defineProps<Props>() | ||
const selected = defineModel<boolean | undefined>({ required: true }) | ||
const icon = computed(() => { | ||
return selected.value || !props.falseIcon ? props.icon : props.falseIcon | ||
}) | ||
</script> | ||
|
||
<template> | ||
<ToggleButton v-model="selected" class="bc-toggle" on-label="" off-icon=""> | ||
<template #icon="slotProps"> | ||
<slot name="icon" v-bind="slotProps"> | ||
<FontAwesomeIcon v-if="icon" :icon="icon" /> | ||
</slot> | ||
</template> | ||
</ToggleButton> | ||
</template> | ||
|
||
<style lang="scss"> | ||
.bc-toggle { | ||
&.p-button { | ||
&.p-togglebutton { | ||
width: 30px; | ||
height: 30px; | ||
padding: 2px; | ||
border-style: none; | ||
&:not(.p-highlight) { | ||
background-color: var(--container-background); | ||
color: var(--container-color); | ||
} | ||
// this is needed as the primvevue ToggleButton adds a yes/no label if none is provided | ||
.p-button-label { | ||
display: none; | ||
} | ||
} | ||
} | ||
} | ||
</style> |
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,3 +1,6 @@ | ||
<script setup lang="ts"> | ||
</script> | ||
|
||
<template> | ||
<div id="iconHolder" class="icon_holder"> | ||
<div> | ||
|
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
Oops, something went wrong.