mirror of
https://github.com/projectsend/projectsend.git
synced 2026-09-22 03:23:23 +00:00
6e47d76ba6
Client file sharing, rebuilt from the ground up: a private area per client, resumable uploads, folders, groups and categories, sharing with expiry dates and download limits, comments, file versions, an activity log, a REST API, and sixteen languages. This repository begins here. ProjectSend 2 was developed privately, and that development history is not published — the previous generation remains available, with its own history, at projectsend/legacy. Free software under the GNU General Public License v2, or (at your option) any later version.
22 lines
981 B
TypeScript
22 lines
981 B
TypeScript
import { LayoutGrid, List } from 'lucide-react';
|
|
|
|
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';
|
|
import { useTranslation } from '@/hooks/use-translation';
|
|
import { type ViewMode } from '@/hooks/use-view-mode';
|
|
|
|
/** List/grid switcher for a file listing — see useViewMode for persistence. */
|
|
export function ViewModeToggle({ value, onChange }: { value: ViewMode; onChange: (mode: ViewMode) => void }) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<ToggleGroup type="single" value={value} onValueChange={(next) => next && onChange(next as ViewMode)} className="rounded-md border p-0.5">
|
|
<ToggleGroupItem value="list" size="sm" aria-label={t('List view')}>
|
|
<List className="size-4" />
|
|
</ToggleGroupItem>
|
|
<ToggleGroupItem value="grid" size="sm" aria-label={t('Grid view')}>
|
|
<LayoutGrid className="size-4" />
|
|
</ToggleGroupItem>
|
|
</ToggleGroup>
|
|
);
|
|
}
|