Skip to content

Commit

Permalink
use <Link> instead of setLocation
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloose committed Nov 23, 2024
1 parent 5716cad commit 85284bf
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions app/src/pages/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useState } from 'react';
import { Menu, Search, Share2, Plus, Layout, Edit } from "lucide-react";
import { useLocation } from 'wouter';
import { Link, useLocation } from 'wouter';
import styles from "./GalleryDashboard.module.css";
import { UserButton } from "@/components/UserButton";
import { NewGalleryButton } from '@/components/NewGalleryButton';

const galleries = [
{
Expand Down Expand Up @@ -39,16 +40,11 @@ const galleries = [

export const GalleryDashboard = () => {
const [isSidebarOpen, setIsSidebarOpen] = useState(false);
const [_, setLocation] = useLocation();

const toggleSidebar = () => {
setIsSidebarOpen(!isSidebarOpen);
};

const handleNewGallery = () => {
setLocation('/new/edit');
};

return (
<div className={styles.container}>
{isSidebarOpen && (
Expand All @@ -62,10 +58,10 @@ export const GalleryDashboard = () => {
<div className={styles.sidebarContent}>
<h2 className={styles.sidebarTitle}>Menú</h2>
<nav className={styles.sidebarNav}>
<button onClick={handleNewGallery} className={styles.sidebarButton}>
<Link href='/new/edit' className={styles.sidebarButton}>
<Plus className={styles.sidebarIcon} />
<span>Nueva Galería</span>
</button>
</Link>
<button className={styles.sidebarButton}>
<Layout className={styles.sidebarIcon} />
<span>Desplegar Galería</span>
Expand All @@ -87,7 +83,10 @@ export const GalleryDashboard = () => {
<Menu className={styles.menuIcon} />
<span className={styles.srOnly}>Dashboard</span>
</button>
<UserButton />
<div style={{ display: 'flex', flexDirection: 'row', gap: '24px' }}>
<NewGalleryButton />
<UserButton />
</div>
</div>
</header>

Expand Down

0 comments on commit 85284bf

Please sign in to comment.