nyanimedb/modules/frontend/src/components/LayoutSwitch/LayoutSwitch.tsx
nihonium 86e3df2205
Some checks failed
Build and Deploy Go App / build (push) Failing after 11m37s
Build and Deploy Go App / deploy (push) Has been skipped
feat: /titles page with search and sort functionality. Website header added
2025-11-22 05:49:03 +03:00

28 lines
783 B
TypeScript

import React from "react";
import { Squares2X2Icon, Bars3Icon } from "@heroicons/react/24/solid";
export type LayoutSwitchProps = {
layout: "square" | "horizontal"
setLayout: (value: React.SetStateAction<"square" | "horizontal">) => void
};
export function LayoutSwitch({
layout,
setLayout
}: LayoutSwitchProps) {
return (
<div className="flex justify-end">
<button
className="p-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition"
onClick={() =>
setLayout(prev => (prev === "square" ? "horizontal" : "square"))
}>
{layout === "square"
? <Squares2X2Icon className="w-6 h-6" />
: <Bars3Icon className="w-6 h-6" />
}
</button>
</div>
);
}