Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Nov 16, 2024
1 parent 3dcda7f commit bae1322
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/dashboard/src/components/amount-range.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"use client";

import { Slider } from "@midday/ui/slider";

export default function AmountRange() {
return (
<div className="bg-background text-popover-foreground shadow-lg w-[250px] p-4">
<Slider defaultValue={[50]} max={100} step={1} />
</div>
);
}
19 changes: 19 additions & 0 deletions apps/dashboard/src/components/transactions-search-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
} from "nuqs";
import { useRef, useState } from "react";
import { useHotkeys } from "react-hotkeys-hook";
import AmountRange from "./amount-range";
import { FilterList } from "./filter-list";
import { SelectCategory } from "./select-category";

Expand Down Expand Up @@ -313,6 +314,24 @@ export function TransactionsSearchFilter({
</DropdownMenuSub>
</DropdownMenuGroup>

<DropdownMenuGroup>
<DropdownMenuSub>
<DropdownMenuSubTrigger>
<Icons.Amount className="mr-2 size-4" />
<span>Amount</span>
</DropdownMenuSubTrigger>
<DropdownMenuPortal>
<DropdownMenuSubContent
sideOffset={14}
alignOffset={-4}
className="p-0"
>
<AmountRange />
</DropdownMenuSubContent>
</DropdownMenuPortal>
</DropdownMenuSub>
</DropdownMenuGroup>

<DropdownMenuGroup>
<DropdownMenuSub>
<DropdownMenuSubTrigger>
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"./button": "./src/components/button.tsx",
"./calendar": "./src/components/calendar.tsx",
"./card": "./src/components/card.tsx",
"./slider": "./src/components/slider.tsx",
"./carousel": "./src/components/carousel.tsx",
"./checkbox": "./src/components/checkbox.tsx",
"./collapsible": "./src/components/collapsible.tsx",
Expand Down Expand Up @@ -99,6 +100,7 @@
"@radix-ui/react-scroll-area": "^1.2.0",
"@radix-ui/react-select": "^2.1.2",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slider": "^1.2.1",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.1",
"@radix-ui/react-tabs": "^1.1.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import {
MdOutlineDownload,
MdOutlineEditNote,
MdOutlineEmail,
MdOutlineEqualizer,
MdOutlineExitToApp,
MdOutlineFace,
MdOutlineFactCheck,
Expand Down Expand Up @@ -578,6 +579,7 @@ export const Icons = {
Fence: MdFence,
Refresh: MdRefresh,
Currency: MdAttachMoney,
Amount: MdOutlineEqualizer,
Inventory2: MdInventory2,
Person: MdPerson,
Peolple: MdPeople,
Expand Down
27 changes: 27 additions & 0 deletions packages/ui/src/components/slider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"use client";

import * as SliderPrimitive from "@radix-ui/react-slider";
import * as React from "react";
import { cn } from "../utils";

const Slider = React.forwardRef<
React.ElementRef<typeof SliderPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
>(({ className, ...props }, ref) => (
<SliderPrimitive.Root
ref={ref}
className={cn(
"relative flex w-full touch-none select-none items-center",
className,
)}
{...props}
>
<SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
<SliderPrimitive.Range className="absolute h-full bg-primary" />
</SliderPrimitive.Track>
<SliderPrimitive.Thumb className="block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" />
</SliderPrimitive.Root>
));
Slider.displayName = SliderPrimitive.Root.displayName;

export { Slider };

0 comments on commit bae1322

Please sign in to comment.