diff --git a/front/src/composables/width.ts b/front/src/composables/width.ts index 5d4285d0d..52068960f 100644 --- a/front/src/composables/width.ts +++ b/front/src/composables/width.ts @@ -42,16 +42,12 @@ const styles = { ...widths, ...sizes } as const satisfies Record string)> -const getStyle = (props: Partial) => (key: Key): string => - // @ts-expect-error Typescript is hard +const getStyle = (props: Partial) => (key: Key) => typeof styles[key] === 'function' && key in props - // @ts-expect-error Typescript is hard ? styles[key]( - // TODO: Make the typescript compiler understand `key in props` - // @ts-expect-error Typescript is hard + // @ts-expect-error Typescript is hard. Make the typescript compiler understand `key in props` props[key] ) - : styles[key] // All keys are exclusive diff --git a/front/src/ui/composables/useTags.ts b/front/src/ui/composables/useTags.ts new file mode 100644 index 000000000..1f90fb68b --- /dev/null +++ b/front/src/ui/composables/useTags.ts @@ -0,0 +1,15 @@ +import { computed, ref } from 'vue' +import { useStore } from '~/store' + +/** + * Load and cache all tags + * + * @param current + */ +export const useTags = (current = ref([])) => { + const store = useStore() + + const tags = computed(() => store.state.ui.tags) +} + +// alternative ways to generate tags