Skip to content

Commit

Permalink
#IMP-021: Update theme toggle button (#70)
Browse files Browse the repository at this point in the history
* Style: remove dark and light text from theme toggle button

* Chore: update snapshot

* Test: remove dark and light text from test
  • Loading branch information
Pet3r1512 authored Nov 11, 2024
1 parent 1cbbb78 commit a044095
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ exports[`Render Header > Should match snapshot 1`] = `
class="lg:flex items-center gap-x-5 hidden"
>
<button
class="h-8 lg:h-10 px-5 py-2 w-auto rounded-full lg:text-lg bg-gray-500 dark:bg-gray-200 transition-all dark:text-black text-white duration-150 ease-linear flex items-center justify-center"
class="!size-8 rounded-full flex items-center justify-center bg-gray-500 dark:bg-gray-200 transition-all duration-150 ease-linear"
data-testid="theme-togger"
>
πŸŒ™ Dark
πŸŒ™
</button>
<div
class="border-l-2 border-black-main dark:border-white h-[25px]"
Expand Down Expand Up @@ -359,10 +359,10 @@ exports[`Render Header > Should match snapshot 1`] = `
class="lg:flex items-center gap-x-5 hidden"
>
<button
class="h-8 lg:h-10 px-5 py-2 w-auto rounded-full lg:text-lg bg-gray-500 dark:bg-gray-200 transition-all dark:text-black text-white duration-150 ease-linear flex items-center justify-center"
class="!size-8 rounded-full flex items-center justify-center bg-gray-500 dark:bg-gray-200 transition-all duration-150 ease-linear"
data-testid="theme-togger"
>
πŸŒ™ Dark
πŸŒ™
</button>
<div
class="border-l-2 border-black-main dark:border-white h-[25px]"
Expand Down
10 changes: 5 additions & 5 deletions src/components/Layouts/ThemeToggle.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ describe("ThemeToggle", () => {
);

const button = screen.getByTestId("theme-togger");
expect(button).toHaveTextContent("πŸŒ™ Dark");
expect(button).toHaveTextContent("πŸŒ™");

fireEvent.click(button);
expect(button).toHaveTextContent("Light β˜€οΈ");
expect(button).not.toHaveTextContent("πŸŒ™ Dark");
expect(button).toHaveTextContent("β˜€οΈ");
expect(button).not.toHaveTextContent("πŸŒ™");

fireEvent.click(button);
expect(button).toHaveTextContent("πŸŒ™ Dark");
expect(button).not.toHaveTextContent("Light β˜€οΈ");
expect(button).toHaveTextContent("πŸŒ™");
expect(button).not.toHaveTextContent("β˜€οΈ");
});
});
4 changes: 2 additions & 2 deletions src/components/Layouts/ThemeToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ const ThemeToggle = ({ className }: { className?: string }) => {
data-testid="theme-togger"
onClick={toggleTheme}
className={cn(
"h-8 lg:h-10 px-5 py-2 w-auto rounded-full lg:text-lg bg-gray-500 dark:bg-gray-200 transition-all dark:text-black text-white duration-150 ease-linear flex items-center justify-center",
"!size-8 rounded-full flex items-center justify-center bg-gray-500 dark:bg-gray-200 transition-all duration-150 ease-linear",
className
)}
>
{theme === "light" ? "πŸŒ™ Dark" : "Light β˜€οΈ"}
{theme === "light" ? "πŸŒ™" : "β˜€οΈ"}
</button>
);
};
Expand Down

0 comments on commit a044095

Please sign in to comment.