-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from manuartero/dev
v0.5.0
- Loading branch information
Showing
17 changed files
with
156 additions
and
59 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export function readCollectionFromLocalStorage() { | ||
return null; | ||
} | ||
|
||
export function writeCollectionToLocalStorage() { | ||
return; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { CardPackage } from "services/cards"; | ||
|
||
const LOCAL_STORAGE_KEY = "collection"; | ||
|
||
export function readCollectionFromLocalStorage() { | ||
const savedPackages = localStorage.getItem(LOCAL_STORAGE_KEY); | ||
let collection: Record<CardPackage, boolean> | null = null; | ||
if (savedPackages) { | ||
try { | ||
collection = JSON.parse(savedPackages); | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
} | ||
return collection; | ||
} | ||
|
||
export function writeCollectionToLocalStorage( | ||
collection: Record<CardPackage, boolean> | ||
) { | ||
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(collection)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import c from "classnames"; | ||
|
||
type Props = { | ||
show: boolean; | ||
children: React.ReactNode; | ||
}; | ||
|
||
export function Tooltip({ show, children }: Props) { | ||
return ( | ||
<div | ||
className={c( | ||
show ? "opacity-1" : "opacity-0", | ||
"absolute z-10", | ||
"bg-gray-800 text-white text-sm py-1 px-2 rounded-md", | ||
"top-full left-1/2 transform -translate-x-1/2", | ||
"show-up-transition pointer-events-none" | ||
)} | ||
> | ||
{children} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { useCallback, useState } from "react"; | ||
|
||
export function useBool(): [boolean, () => void] { | ||
const [value, setValue] = useState(false); | ||
const toggle = useCallback(() => setValue((v) => !v), []); | ||
return [value, toggle]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters