UNPKG

@prefecthq/prefect-ui-library

Version:

This library is the Vue and Typescript component library for [Prefect 2](https://github.com/PrefectHQ/prefect) and [Prefect Cloud 2](https://www.prefect.io/cloud/). _The components and utilities in this project are not meant to be used independently_.

18 lines (15 loc) 560 B
import { useLocalStorage } from '@prefecthq/vue-compositions' import { computed } from 'vue' import { ViewOption } from '@/types/viewOption' import { getCacheKey } from '@/utilities/cache' const viewModeLocalStorageKey = getCacheKey('prefect-ui-library-view-mode') const defaultValue: ViewOption = 'grid' const { value: viewMode, set: setViewMode } = useLocalStorage<ViewOption>(viewModeLocalStorageKey, defaultValue) export const activeViewMode = computed({ get() { return viewMode.value }, set(value: ViewOption) { setViewMode(value) }, })