Skip to content

Commit

Permalink
use local storage for nav layout
Browse files Browse the repository at this point in the history
  • Loading branch information
narthur committed Dec 5, 2024
1 parent 99a7193 commit 815a426
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/organisms/passageNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import clsx from 'clsx';
import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl';

import { useLocalStorage } from '~src/lib/hooks/useLocalStorage';

import { PassageNavigationFragment } from './__generated__/passageNavigation';
import BookGrid from './bookGrid';
import BookList from './bookList';
Expand Down Expand Up @@ -58,7 +60,10 @@ export default function PassageNavigation({ books }: Props): JSX.Element {
const [selectedBook, setSelectedBook] = useState<string | number | null>(
null,
);
const [selectedView, setSelectedView] = useState<'grid' | 'list'>('grid');
const [selectedView, setSelectedView] = useLocalStorage<'grid' | 'list'>(
'passageNavLayout',
'grid',
);

return (
<div className={styles.wrapper}>
Expand Down

0 comments on commit 815a426

Please sign in to comment.