Skip to content

Commit

Permalink
[refactor] Cleanup hooks types names
Browse files Browse the repository at this point in the history
  • Loading branch information
rtivital committed Sep 21, 2023
1 parent 7a3c9f0 commit 65a0e5b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/mantine-hooks/src/use-local-storage/create-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useWindowEvent } from '../use-window-event/use-window-event';

export type StorageType = 'localStorage' | 'sessionStorage';

export interface IStorageProperties<T> {
export interface StorageProperties<T> {
/** Storage key */
key: string;

Expand Down Expand Up @@ -45,7 +45,7 @@ export function createStorage<T>(type: StorageType, hookName: string) {
getInitialValueInEffect = true,
deserialize = deserializeJSON,
serialize = (value: T) => serializeJSON(value, hookName),
}: IStorageProperties<T>) {
}: StorageProperties<T>) {
const readStorageValue = useCallback(
(skipStorage?: boolean): T => {
if (
Expand Down
4 changes: 2 additions & 2 deletions src/mantine-hooks/src/use-local-storage/use-local-storage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createStorage, IStorageProperties } from './create-storage';
import { createStorage, StorageProperties } from './create-storage';

export function useLocalStorage<T = string>(props: IStorageProperties<T>) {
export function useLocalStorage<T = string>(props: StorageProperties<T>) {
return createStorage<T>('localStorage', 'use-local-storage')(props);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createStorage, IStorageProperties } from '../use-local-storage/create-storage';
import { createStorage, StorageProperties } from '../use-local-storage/create-storage';

export function useSessionStorage<T = string>(props: IStorageProperties<T>) {
export function useSessionStorage<T = string>(props: StorageProperties<T>) {
return createStorage<T>('sessionStorage', 'use-session-storage')(props);
}

0 comments on commit 65a0e5b

Please sign in to comment.