mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-16 06:17:42 +01:00
* Ignore linting for examples in docs * Formatting JSX single attribute per line * Separte `format` and `lint:format` in package.json * Bump prettier version * Run format
24 lines
565 B
TypeScript
24 lines
565 B
TypeScript
import { ref, inject, Ref } from 'vue';
|
|
|
|
export const CATEGORY_VIEW_CONTEXT = Symbol('categoryView');
|
|
|
|
interface CategoryViewContext {
|
|
selectedCategory: Ref<string>;
|
|
categoryCounts: Ref<Record<string, number>>;
|
|
}
|
|
|
|
export const categoryViewContext = {
|
|
selectedCategory: ref(''),
|
|
categoryCounts: ref({}),
|
|
};
|
|
|
|
export function useCategoryView(): CategoryViewContext {
|
|
const context = inject<CategoryViewContext>(CATEGORY_VIEW_CONTEXT);
|
|
|
|
if (!context) {
|
|
throw new Error('useCategoryView must be used with categoryView context');
|
|
}
|
|
|
|
return context;
|
|
}
|