Skip to content

Commit

Permalink
Fixing keyword adding/storage hook
Browse files Browse the repository at this point in the history
  • Loading branch information
brynnb committed Sep 6, 2024
1 parent 1ca83e9 commit 10e1da3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions packages/storage/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ import { createStorage, StorageType, type BaseStorage, SessionAccessLevel } from
import { exampleThemeStorage } from './exampleThemeStorage';

export { exampleThemeStorage, createStorage, StorageType, SessionAccessLevel, BaseStorage };
export { keywordsStorage } from './keywordsStorage';
32 changes: 16 additions & 16 deletions pages/popup/src/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,26 @@ const Popup = () => {
))}
</ul>
</div>
<ToggleButton>Toggle light/dark mode</ToggleButton>
{/* <ToggleButton>Toggle light/dark mode</ToggleButton> */}
</header>
</div>
);
};

const ToggleButton = (props: ComponentPropsWithoutRef<'button'>) => {
const theme = useStorageSuspense(exampleThemeStorage);
return (
<button
className={
props.className +
' ' +
'font-bold mt-4 py-1 px-4 rounded shadow hover:scale-105 ' +
(theme === 'light' ? 'bg-white text-black shadow-black' : 'bg-black text-white')
}
onClick={exampleThemeStorage.toggle}>
{props.children}
</button>
);
};
// const ToggleButton = (props: ComponentPropsWithoutRef<'button'>) => {
// const theme = useStorageSuspense(exampleThemeStorage);
// return (
// <button
// className={
// props.className +
// ' ' +
// 'font-bold mt-4 py-1 px-4 rounded shadow hover:scale-105 ' +
// (theme === 'light' ? 'bg-white text-black shadow-black' : 'bg-black text-white')
// }
// onClick={exampleThemeStorage.toggle}>
// {props.children}
// </button>
// );
// };

export default withErrorBoundary(withSuspense(Popup, <div> Loading ... </div>), <div> Error Occur </div>);

0 comments on commit 10e1da3

Please sign in to comment.