-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from KryptXBSA/new-ui
New UI
- Loading branch information
Showing
92 changed files
with
1,578 additions
and
1,667 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "restricted", | ||
"baseBranch": "main", | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "restricted", | ||
"baseBranch": "main", | ||
"privatePackages": { | ||
"version": true, | ||
"tag": true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"web": minor | ||
--- | ||
|
||
New UI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
typescript: { | ||
ignoreBuildErrors: true, | ||
}, | ||
}; | ||
|
||
export default nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
apps/web/src/app/builder/_components/AddNewFieldArrows.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Button } from "@/components/ui/button"; | ||
import { addItem } from "@/state/state"; | ||
import { | ||
ArrowBigUpDash, | ||
ArrowBigDownDash, | ||
ArrowBigLeftDash, | ||
ArrowBigRightDash, | ||
} from "lucide-react"; | ||
|
||
export function AddNewFieldArrows({ id }: { id: string }) { | ||
return ( | ||
<div className="flex h-[53px] w-[380px] items-center justify-between"> | ||
<Button | ||
className="h-full w-[20%] rounded-lg rounded-r-none border-2 border-r-0" | ||
variant="outline" | ||
size="icon" | ||
onClick={() => addItem(id, "left")} | ||
> | ||
<ArrowBigLeftDash className="h-5 w-5" /> | ||
</Button> | ||
<div className="flex h-full w-full flex-col justify-between"> | ||
<Button | ||
variant="outline" | ||
className="h-full w-full rounded-none border-t-2 border-b-0" | ||
size="icon" | ||
onClick={() => addItem(id, "up")} | ||
> | ||
<ArrowBigUpDash className="h-5 w-5" /> | ||
</Button> | ||
<Button | ||
variant="outline" | ||
className="h-full w-full rounded-none border-b-2" | ||
size="icon" | ||
onClick={() => addItem(id, "down")} | ||
> | ||
<ArrowBigDownDash className="h-5 w-5" /> | ||
</Button> | ||
</div> | ||
<Button | ||
variant="outline" | ||
className="h-full w-[20%] rounded-lg rounded-l-none border-2 border-l-0" | ||
size="icon" | ||
onClick={() => addItem(id, "right")} | ||
> | ||
<ArrowBigRightDash className="h-5 w-5" /> | ||
{/* TODO: This is only shown at dev */} | ||
{id} | ||
</Button> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { MouseEvent, KeyboardEvent } from 'react' | ||
import { | ||
MouseSensor as LibMouseSensor, | ||
KeyboardSensor as LibKeyboardSensor | ||
} from '@dnd-kit/core' | ||
|
||
export class MouseSensor extends LibMouseSensor { | ||
static activators = [ | ||
{ | ||
eventName: 'onMouseDown' as const, | ||
handler: ({ nativeEvent: event }: MouseEvent) => { | ||
return shouldHandleEvent(event.target as HTMLElement) | ||
} | ||
} | ||
] | ||
} | ||
|
||
// export class KeyboardSensor extends LibKeyboardSensor { | ||
// static activators = [ | ||
// { | ||
// eventName: 'onKeyDown' as const, | ||
// handler: ({ nativeEvent: event }: KeyboardEvent<Element>) => { | ||
// return shouldHandleEvent(event.target as HTMLElement) | ||
// } | ||
// } | ||
// ] | ||
// } | ||
|
||
function shouldHandleEvent(element: HTMLElement | null) { | ||
let cur = element | ||
|
||
while (cur) { | ||
if (cur.dataset?.noDnd) { | ||
return false | ||
} | ||
cur = cur.parentElement | ||
} | ||
|
||
return true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Button } from "@/components/ui/button"; | ||
import { Badge } from "@/components/ui/badge"; | ||
import { Settings, Trash } from "lucide-react"; | ||
import { | ||
Accordion, | ||
AccordionContent, | ||
AccordionItem, | ||
AccordionTrigger, | ||
} from "@/components/ui/accordion"; | ||
import { cn } from "@/lib/utils"; | ||
import { useState } from "react"; | ||
import { removeItem } from "@/state/state"; | ||
|
||
export function FormFieldContent({ id }: { id: string }) { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
return ( | ||
<Accordion id={id} className="z-50 h-full" type="single" collapsible> | ||
<AccordionItem value="item-1"> | ||
<div className={cn("flex justify-between gap-2 p-2", { "border-b-2": isOpen })}> | ||
<Badge variant={"outline"} className="font-semibold"> | ||
Task | ||
</Badge> | ||
<div className="flex justify-between gap-2"> | ||
<Button | ||
onClick={()=>removeItem(id)} | ||
data-no-dnd={true} | ||
variant={"ghost"} | ||
className="-ml-2 h-auto p-1 text-secondary-foreground/50 hover:bg-red-500" | ||
> | ||
<Trash /> | ||
</Button> | ||
<AccordionTrigger asChild className="flex justify-between"> | ||
<Button | ||
data-no-dnd={true} | ||
variant={"ghost"} | ||
className="-ml-2 h-auto p-1 text-secondary-foreground/50" | ||
onClick={() => { | ||
setIsOpen(!isOpen); | ||
console.log(id); | ||
}} | ||
> | ||
<Settings /> | ||
</Button> | ||
</AccordionTrigger> | ||
</div> | ||
</div> | ||
<AccordionContent className="px-3 py-4"> | ||
Yes. It adheres to the WAI-ARIA design pattern. | ||
</AccordionContent> | ||
</AccordionItem> | ||
</Accordion> | ||
); | ||
} |
107 changes: 107 additions & 0 deletions
107
apps/web/src/app/builder/_components/FormSettings/FrameworkCombobox.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
"use client" | ||
|
||
import * as React from "react" | ||
import { Check, ChevronsUpDown } from "lucide-react" | ||
|
||
import { cn } from "@/lib/utils" | ||
import { Button } from "@/components/ui/button" | ||
import { | ||
Command, | ||
CommandEmpty, | ||
CommandGroup, | ||
CommandInput, | ||
CommandItem, | ||
CommandList, | ||
} from "@/components/ui/command" | ||
import { | ||
Popover, | ||
PopoverContent, | ||
PopoverTrigger, | ||
} from "@/components/ui/popover" | ||
import type { FormFramework } from "formbuilder-core" | ||
import { useAppState } from "@/state/state"; | ||
|
||
const frameworks: { value: FormFramework; label: string }[] = [ | ||
{ | ||
value: "next", | ||
label: "Next.js", | ||
}, | ||
{ | ||
value: "react", | ||
label: "React", | ||
}, | ||
{ | ||
value: "svelte", | ||
label: "Svelte", | ||
}, | ||
{ | ||
value: "vue", | ||
label: "Vue", | ||
}, | ||
{ | ||
value: "solid", | ||
label: "Solid", | ||
}, | ||
{ | ||
value: "astro", | ||
label: "Astro", | ||
}, | ||
] | ||
|
||
export function FrameworkCombobox() { | ||
const { currentForm, updateFormFramework } = useAppState(); | ||
const [open, setOpen] = React.useState(false) | ||
const [value, setValue] = React.useState(currentForm.framework) | ||
|
||
// React.useEffect(() => { | ||
// setValue(currentForm.framework); | ||
// }, [currentForm]); | ||
|
||
return ( | ||
<Popover open={open} onOpenChange={setOpen}> | ||
<PopoverTrigger asChild> | ||
<Button | ||
variant="outline" | ||
// biome-ignore lint/a11y/useSemanticElements: <explanation> | ||
role="combobox" | ||
aria-expanded={open} | ||
className="w-[200px] justify-between" | ||
> | ||
{value | ||
? frameworks.find((framework) => framework.value === value)?.label | ||
: "Select framework..."} | ||
<ChevronsUpDown className="opacity-50" /> | ||
</Button> | ||
</PopoverTrigger> | ||
<PopoverContent className="w-[200px] p-0"> | ||
<Command> | ||
<CommandInput placeholder="Search framework..." className="h-9" /> | ||
<CommandList> | ||
<CommandEmpty>No framework found.</CommandEmpty> | ||
<CommandGroup> | ||
{frameworks.map((framework) => ( | ||
<CommandItem | ||
key={framework.value} | ||
value={framework.value} | ||
onSelect={(currentValue) => { | ||
setValue(currentValue === value ? "" : currentValue) | ||
updateFormFramework(currentValue) | ||
setOpen(false) | ||
}} | ||
> | ||
{framework.label} | ||
<Check | ||
className={cn( | ||
"ml-auto", | ||
value === framework.value ? "opacity-100" : "opacity-0" | ||
)} | ||
/> | ||
</CommandItem> | ||
))} | ||
</CommandGroup> | ||
</CommandList> | ||
</Command> | ||
</PopoverContent> | ||
</Popover> | ||
) | ||
} |
Oops, something went wrong.