diff --git a/src/App.tsx b/src/App.tsx index 9510877..2b680fc 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,11 +4,15 @@ import Footer from "./components/Footer"; function App() { return ( -
+ <> - + +
+ +
+
+ ); } diff --git a/src/components/CharacterCardSmall.test.tsx b/src/components/CharacterCardSmall.test.tsx index b75859f..4bb2c3b 100644 --- a/src/components/CharacterCardSmall.test.tsx +++ b/src/components/CharacterCardSmall.test.tsx @@ -34,7 +34,7 @@ describe("CharacterCardSmall", () => { />, ); - const image = screen.getByAltText("character image"); + const image = screen.getByAltText("Rick Sanchez"); expect(image).toHaveAttribute("src", "rick.jpg"); }); diff --git a/src/components/CharacterCardSmall.tsx b/src/components/CharacterCardSmall.tsx index 358b2c8..28aed51 100644 --- a/src/components/CharacterCardSmall.tsx +++ b/src/components/CharacterCardSmall.tsx @@ -24,11 +24,15 @@ export default function CharacterCardSmall({
- character image + {name}

{name}

-
diff --git a/src/components/CharacterDetailCard.tsx b/src/components/CharacterDetailCard.tsx index 8b60415..d0e2a8c 100644 --- a/src/components/CharacterDetailCard.tsx +++ b/src/components/CharacterDetailCard.tsx @@ -150,10 +150,10 @@ export default function CharacterDetailCard({
globe-icon - +

Origin

{character.origin.name} - +
diff --git a/src/components/Searchbar.tsx b/src/components/Searchbar.tsx index b123de9..3d47b79 100644 --- a/src/components/Searchbar.tsx +++ b/src/components/Searchbar.tsx @@ -18,6 +18,7 @@ export default function Searchbar({ name="search" className="searchfield" placeholder="Enter a character name..." + aria-label="Search characters" value={searchQuery} onChange={(event) => onSearchChange(event.target.value)} /> diff --git a/src/components/__snapshots__/CharacterCardSmall.test.tsx.snap b/src/components/__snapshots__/CharacterCardSmall.test.tsx.snap index a9a10af..75e79e3 100644 --- a/src/components/__snapshots__/CharacterCardSmall.test.tsx.snap +++ b/src/components/__snapshots__/CharacterCardSmall.test.tsx.snap @@ -17,7 +17,7 @@ exports[`CharacterCardSmall > matches snapshot 1`] = ` class="character-info" > character image diff --git a/src/main.tsx b/src/main.tsx index b273eb5..d0a8775 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,10 +1,10 @@ import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; -import { QueryClient, QueryClientProvider } from '@tanstack/react-query' +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import "./index.css"; import App from "./App.tsx"; -const queryClient = new QueryClient() +const queryClient = new QueryClient(); createRoot(document.getElementById("root")!).render( diff --git a/src/pages/CharactersPage.tsx b/src/pages/CharactersPage.tsx index bb82d10..f6edca4 100644 --- a/src/pages/CharactersPage.tsx +++ b/src/pages/CharactersPage.tsx @@ -185,10 +185,10 @@ export default function CharactersPage() { } return ( -
+
-
+
{filteredCharacters.map((character) => ( setSelectedCharacter(character)} /> ))} -
+
-
+
+
{renderFilterOptions()}
+ {selectedCharacter && ( handleToggleFavorite(selectedCharacter.id)} /> )} - +
); } diff --git a/src/pages/HeroPage.tsx b/src/pages/HeroPage.tsx index c1ac4a1..3c163de 100644 --- a/src/pages/HeroPage.tsx +++ b/src/pages/HeroPage.tsx @@ -5,8 +5,8 @@ import "./HeroPage.css"; function HeroPage() { return ( -
-
+
+
Rick and Morty @@ -31,8 +31,8 @@ function HeroPage() { src={HeroImage} alt="Rick and Morty characters" /> -
-
+ + ); } diff --git a/src/utils/filterCharacters.ts b/src/utils/filterCharacters.ts index 34b612c..e391cb6 100644 --- a/src/utils/filterCharacters.ts +++ b/src/utils/filterCharacters.ts @@ -4,8 +4,11 @@ export type FilterCategory = "favorite" | "gender" | "species" | "status"; export type SelectedFilters = Record; export function filterCharacters( -// Takes in all characters, the value in the search field and the chosen filters -characters: Character[], searchQuery: string, selectedFilters: SelectedFilters, favoriteCharacterIds: number[], + // Takes in all characters, the value in the search field and the chosen filters + characters: Character[], + searchQuery: string, + selectedFilters: SelectedFilters, + favoriteCharacterIds: number[], ): Character[] { return characters.filter((character) => { //Checks whether each character's name matches with the search and if the character's gender, specie or status is checked off in the filter @@ -29,6 +32,12 @@ characters: Character[], searchQuery: string, selectedFilters: SelectedFilters, selectedFilters.status.length === 0 || selectedFilters.status.includes(character.status.toLowerCase()); //Returns the result of the checks mentioned above - return matchesSearch && matchesFavorite && matchesGender && matchesSpecies && matchesStatus; + return ( + matchesSearch && + matchesFavorite && + matchesGender && + matchesSpecies && + matchesStatus + ); }); }