diff --git a/README.md b/README.md
index 3c4c4ff..7112c3c 100644
--- a/README.md
+++ b/README.md
@@ -30,9 +30,9 @@ sudo rsync -av --delete dist/ /var/www/html/project1/
echo "Deploy ferdig!"
```
-
## Prettier use
+
```
npm install
-npm run format
-```
\ No newline at end of file
+npm run format
+```
diff --git a/src/App.css b/src/App.css
index d27aa90..98077d5 100644
--- a/src/App.css
+++ b/src/App.css
@@ -319,3 +319,31 @@
padding-bottom: 4px;
}
}
+
+.modal-overlay {
+ position: fixed;
+ inset: 0;
+ background: rgba(0, 0, 0, 0.6);
+ display: flex;
+ align-items: center;
+ z-index: 100;
+}
+
+.modal-content {
+ background: #fff;
+ border-radius: 12px;
+ padding: 2rem;
+ position: relative;
+ max-width: 320px;
+ text-align: center;
+}
+
+.modal-close {
+ position: absolute;
+ top: 0.5rem;
+ right: 0.5rem;
+ border: none;
+ background: none;
+ font-size: 1.5rem;
+ cursor: pointer;
+}
diff --git a/src/App.tsx b/src/App.tsx
index 7bd108f..5989eee 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -5,6 +5,8 @@ import { listAllPokemon } from './Api';
import { useFavorites } from './useFavorites';
import FavoritesSidebar from './FavoritesSidebar';
import './App.css';
+import type { Pokemon } from './Api';
+import PokemonModal from './PokemonModal';
const SEARCH_STORAGE_KEY = 'pokemon-search';
@@ -14,7 +16,7 @@ function capitalize(text: string): string {
function App() {
const [query, setQuery] = useState(
- () => sessionStorage.getItem(SEARCH_STORAGE_KEY) ?? '',
+ () => sessionStorage.getItem(SEARCH_STORAGE_KEY) ?? ''
);
// TanStack Query håndterer henting og caching av Pokémon-lista.
@@ -29,19 +31,19 @@ function App() {
});
const [submittedQuery, setSubmittedQuery] = useState(
- () => sessionStorage.getItem(SEARCH_STORAGE_KEY) ?? '',
+ () => sessionStorage.getItem(SEARCH_STORAGE_KEY) ?? ''
);
const [error, setError] = useState('');
const { favorites, isFavorite, toggleFavorite } = useFavorites();
+ const [selectedPokemon, setSelectedPokemon] = useState
{error}
- )} + {!isError && error &&{error}
} - {!isError && - !error && + {!isError && + !error && !isPending && - submittedQuery && + submittedQuery && pokemon.length === 0 && (Fant ingen Pokémon som matcher «{submittedQuery}».
)} - {!isError && - !error && - !isPending && - !submittedQuery && ( -Søkeresultatene dine vises her.
- )} - + {!isError && !error && !isPending && !submittedQuery && ( +Søkeresultatene dine vises her.
+ )} {pokemon.map((entry) => (#{pokemon.id}
+ + +