feat: add compact view feature to Kanban components
- Introduced `compactView` prop in `KanbanBoard`, `KanbanColumn`, and `TaskCard` for a streamlined task display. - Updated `KanbanFilters` to include a toggle for compact view, enhancing user experience. - Adjusted rendering logic in `TaskCard` to conditionally display task details based on the compact view state.
This commit is contained in:
@@ -4,7 +4,6 @@ import { useState } from 'react';
|
||||
import { TaskPriority } from '@/lib/types';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { Input } from '@/components/ui/Input';
|
||||
import { TagDisplay } from '@/components/ui/TagDisplay';
|
||||
import { useTasksContext } from '@/contexts/TasksContext';
|
||||
|
||||
export interface KanbanFilters {
|
||||
@@ -12,6 +11,7 @@ export interface KanbanFilters {
|
||||
tags?: string[];
|
||||
priorities?: TaskPriority[];
|
||||
showCompleted?: boolean;
|
||||
compactView?: boolean;
|
||||
}
|
||||
|
||||
interface KanbanFiltersProps {
|
||||
@@ -51,6 +51,13 @@ export function KanbanFilters({ filters, onFiltersChange }: KanbanFiltersProps)
|
||||
});
|
||||
};
|
||||
|
||||
const handleCompactViewToggle = () => {
|
||||
onFiltersChange({
|
||||
...filters,
|
||||
compactView: !filters.compactView
|
||||
});
|
||||
};
|
||||
|
||||
const handleClearFilters = () => {
|
||||
onFiltersChange({});
|
||||
};
|
||||
@@ -79,6 +86,28 @@ export function KanbanFilters({ filters, onFiltersChange }: KanbanFiltersProps)
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Bouton vue compacte */}
|
||||
<Button
|
||||
variant={filters.compactView ? "primary" : "ghost"}
|
||||
onClick={handleCompactViewToggle}
|
||||
className="flex items-center gap-2"
|
||||
title={filters.compactView ? "Vue détaillée" : "Vue compacte"}
|
||||
>
|
||||
<svg
|
||||
className="w-4 h-4"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
{filters.compactView ? (
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 6h16M4 10h16M4 14h16M4 18h16" />
|
||||
) : (
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 6h16M4 12h16M4 18h16" />
|
||||
)}
|
||||
</svg>
|
||||
{filters.compactView ? 'Détaillée' : 'Compacte'}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={() => setIsExpanded(!isExpanded)}
|
||||
@@ -174,7 +203,7 @@ export function KanbanFilters({ filters, onFiltersChange }: KanbanFiltersProps)
|
||||
<div className="space-y-1 text-sm">
|
||||
{filters.search && (
|
||||
<div className="text-slate-300">
|
||||
Recherche: <span className="text-cyan-400">"{filters.search}"</span>
|
||||
Recherche: <span className="text-cyan-400">“{filters.search}”</span>
|
||||
</div>
|
||||
)}
|
||||
{filters.priorities?.length && (
|
||||
|
||||
Reference in New Issue
Block a user