mirror of
https://github.com/aykhans/slash-e.git
synced 2025-04-20 22:07:15 +00:00
chore: add toast to reset button
This commit is contained in:
parent
e7cf0c2f79
commit
c4f38f1de6
@ -1,4 +1,5 @@
|
||||
import { Select, Option, Button } from "@mui/joy";
|
||||
import { toast } from "react-hot-toast";
|
||||
import useViewStore from "../stores/v1/view";
|
||||
import Dropdown from "./common/Dropdown";
|
||||
import Icon from "./Icon";
|
||||
@ -8,19 +9,24 @@ const OrderSetting = () => {
|
||||
const order = viewStore.getOrder();
|
||||
const { field, direction } = order;
|
||||
|
||||
const handleReset = () => {
|
||||
viewStore.setOrder({ field: "name", direction: "asc" });
|
||||
toast.success("Order reset");
|
||||
};
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
trigger={
|
||||
<button className="p-1 mr-2">
|
||||
<Icon.ListFilter className="w-5 h-auto text-gray-600" />
|
||||
<Icon.ListFilter className="w-5 h-auto text-gray-500" />
|
||||
</button>
|
||||
}
|
||||
actions={
|
||||
<div className="w-52 p-2 pt-0 gap-2 flex flex-col justify-start items-start" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="w-full flex flex-row justify-between items-center mt-1">
|
||||
<span className="text-sm font-medium">View order</span>
|
||||
<Button size="sm" variant="plain" color="neutral" onClick={() => viewStore.setOrder({ field: "name", direction: "asc" })}>
|
||||
<Icon.RefreshCw className="w-4 h-auto" />
|
||||
<Button size="sm" variant="plain" color="neutral" onClick={handleReset}>
|
||||
<Icon.RefreshCw className="w-4 h-auto text-gray-500" />
|
||||
</Button>
|
||||
</div>
|
||||
<div className="w-full flex flex-row justify-between items-center">
|
||||
|
@ -48,7 +48,7 @@ const Home: React.FC = () => {
|
||||
</div>
|
||||
<div className="w-full flex flex-row justify-between items-center mb-4">
|
||||
<div className="flex flex-row justify-start items-center">
|
||||
<Button className="shadow" variant="soft" size="sm" onClick={() => setShowCreateShortcutDialog(true)}>
|
||||
<Button className="hover:shadow" variant="soft" size="sm" onClick={() => setShowCreateShortcutDialog(true)}>
|
||||
<Icon.Plus className="w-5 h-auto" /> New
|
||||
</Button>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user