Skip to content

Commit

Permalink
Allow selecting icon from list in the GenericIndicator mini-widget
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Aug 9, 2023
1 parent e4c8388 commit 3a72df6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/components/mini-widgets/GenericIndicator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,23 @@
/>
</div>
</div>
<RecycleScroller
v-slot="{ item }"
class="w-full h-40 mt-3"
:items="iconsNames.filter((name) => name.includes(iconSearchString))"
:item-size="40"
:grid-items="6"
>
<span class="m-1 text-white cursor-pointer mdi icon-symbol" :class="[item]" @click="options.iconName = item">
</span>
</RecycleScroller>
</div>
</div>
</Dialog>
</template>

<script setup lang="ts">
import * as MdiExports from '@mdi/js/mdi'
import { toReactive } from '@vueuse/core'
import { computed, onBeforeMount, ref, toRefs, watch } from 'vue'
Expand Down Expand Up @@ -69,6 +80,10 @@ onBeforeMount(() => {
variableMultiplier: 1,
})
}
iconsNames = Object.keys(MdiExports).map((originalName) => {
return originalName.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase())
})
})
const store = useMainVehicleStore()
Expand All @@ -82,6 +97,7 @@ const updateVariableState = (): void => {
watch(store.genericVariables, updateVariableState)
watch(options, updateVariableState)
let iconsNames: string[] = []
const showConfigurationMenu = ref(false)
</script>
Expand Down

0 comments on commit 3a72df6

Please sign in to comment.