mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
Update sidebar.tsx
This commit is contained in:
parent
2952d44884
commit
11b369de8d
1 changed files with 34 additions and 62 deletions
|
@ -167,6 +167,38 @@ export function Sidebar() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const SidebarGame = ({ game }: { game: LibraryGame }) => (
|
||||||
|
<li
|
||||||
|
key={game.id}
|
||||||
|
className={cn("sidebar__menu-item", {
|
||||||
|
"sidebar__menu-item--active":
|
||||||
|
location.pathname === `/game/${game.shop}/${game.objectId}`,
|
||||||
|
"sidebar__menu-item--muted": game.download?.status === "removed",
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="sidebar__menu-item-button"
|
||||||
|
onClick={(event) => handleSidebarGameClick(event, game)}
|
||||||
|
>
|
||||||
|
{game.iconUrl ? (
|
||||||
|
<img
|
||||||
|
className="sidebar__game-icon"
|
||||||
|
src={game.iconUrl}
|
||||||
|
alt={game.title}
|
||||||
|
loading="lazy"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<SteamLogo className="sidebar__game-icon" />
|
||||||
|
)}
|
||||||
|
|
||||||
|
<span className="sidebar__menu-item-button-label">
|
||||||
|
{getGameTitle(game)}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside
|
<aside
|
||||||
ref={sidebarRef}
|
ref={sidebarRef}
|
||||||
|
@ -213,37 +245,7 @@ export function Sidebar() {
|
||||||
{sortedLibrary
|
{sortedLibrary
|
||||||
.filter((game) => game.favorite)
|
.filter((game) => game.favorite)
|
||||||
.map((game) => (
|
.map((game) => (
|
||||||
<li
|
<SidebarGame key={game.id} game={game} />
|
||||||
key={game.id}
|
|
||||||
className={cn("sidebar__menu-item", {
|
|
||||||
"sidebar__menu-item--active":
|
|
||||||
location.pathname ===
|
|
||||||
`/game/${game.shop}/${game.objectId}`,
|
|
||||||
"sidebar__menu-item--muted":
|
|
||||||
game.download?.status === "removed",
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="sidebar__menu-item-button"
|
|
||||||
onClick={(event) => handleSidebarGameClick(event, game)}
|
|
||||||
>
|
|
||||||
{game.iconUrl ? (
|
|
||||||
<img
|
|
||||||
className="sidebar__game-icon"
|
|
||||||
src={game.iconUrl}
|
|
||||||
alt={game.title}
|
|
||||||
loading="lazy"
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<SteamLogo className="sidebar__game-icon" />
|
|
||||||
)}
|
|
||||||
|
|
||||||
<span className="sidebar__menu-item-button-label">
|
|
||||||
{getGameTitle(game)}
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
@ -262,37 +264,7 @@ export function Sidebar() {
|
||||||
{filteredLibrary
|
{filteredLibrary
|
||||||
.filter((game) => !game.favorite)
|
.filter((game) => !game.favorite)
|
||||||
.map((game) => (
|
.map((game) => (
|
||||||
<li
|
<SidebarGame key={game.id} game={game} />
|
||||||
key={game.id}
|
|
||||||
className={cn("sidebar__menu-item", {
|
|
||||||
"sidebar__menu-item--active":
|
|
||||||
location.pathname ===
|
|
||||||
`/game/${game.shop}/${game.objectId}`,
|
|
||||||
"sidebar__menu-item--muted":
|
|
||||||
game.download?.status === "removed",
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="sidebar__menu-item-button"
|
|
||||||
onClick={(event) => handleSidebarGameClick(event, game)}
|
|
||||||
>
|
|
||||||
{game.iconUrl ? (
|
|
||||||
<img
|
|
||||||
className="sidebar__game-icon"
|
|
||||||
src={game.iconUrl}
|
|
||||||
alt={game.title}
|
|
||||||
loading="lazy"
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<SteamLogo className="sidebar__game-icon" />
|
|
||||||
)}
|
|
||||||
|
|
||||||
<span className="sidebar__menu-item-button-label">
|
|
||||||
{getGameTitle(game)}
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue