Skip to content

Commit

Permalink
mod(main): /repository dark theme imporved
Browse files Browse the repository at this point in the history
  • Loading branch information
eliestroun14 committed Aug 20, 2024
1 parent ff42089 commit 853a834
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
21 changes: 5 additions & 16 deletions src/app/repository/page.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
}

.title {
margin-top: 30px;
text-align: center;
font-size: 2em;
margin-bottom: 20px;
Expand All @@ -20,7 +21,7 @@

.repository-list {
list-style-type: none;
margin-top: 0;
margin-top: 50px;
padding-top: 0;
}

Expand Down Expand Up @@ -61,23 +62,11 @@
color: #666;
}

/* Light Theme */
.container.light {
background-color: #ffffff;
color: #000000;
}

/* Dark Theme */
.container.dark {
background-color: #333333;
color: #ffffff;
.container.dark .repository-item:hover {
background-color: #111111;
}

.container.dark .repository-item {
background-color: #444444;
}

.container.dark .repository-item:hover {
background-color: #555555;
background-color: rgba(37, 37, 37, 0.77);
}

12 changes: 9 additions & 3 deletions src/app/repository/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ const RepositoryPage: React.FC = () => {
const [organizations, setOrganizations] = useState<Organization[]>([]);
const [currentOrg, setCurrentOrg] = useState<Organization | null>(null);

useEffect(() => {
const mode = localStorage.getItem("darkMode");
if (mode === "true") {
theme === "light" ? setTheme("dark") : setTheme("light");
} else {
document.documentElement.classList.remove("dark");
}
}, []);

useEffect(() => {
const fetchRepositories = async () => {
try {
Expand Down Expand Up @@ -123,9 +132,6 @@ const RepositoryPage: React.FC = () => {
<>
<div className={`container ${theme}`}>
<h1 className="title">Your Repositories</h1>
<button onClick={toggleTheme} className="theme-toggle">
Switch to {theme === "light" ? "Dark" : "Light"} Theme
</button>
<ul className="repository-list">
{Array.isArray(repositories) && repositories.map((repo) => (
<li key={repo.id} className="repository-item">
Expand Down

0 comments on commit 853a834

Please sign in to comment.