Skip to content

Commit

Permalink
fix for resource select box
Browse files Browse the repository at this point in the history
  • Loading branch information
RedBeardEth committed Dec 14, 2024
1 parent ef44514 commit a74c7f8
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 24 deletions.
2 changes: 1 addition & 1 deletion landing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@dojoengine/utils": "1.0.3-alpha.2",
"@graphql-codegen/schema-ast": "^4.1.0",
"@graphql-typed-document-node/core": "^3.2.0",
"@headlessui/react": "^1.7.18",
"@headlessui/react": "^2.2.0",
"@parcel/watcher": "^2.4.1",
"@radix-ui/react-checkbox": "^1.1.2",
"@radix-ui/react-collapsible": "^1.1.1",
Expand Down
2 changes: 0 additions & 2 deletions landing/src/components/ui/SelectResources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ export const SelectSingleResource = ({
value={selectedResourceIds[index]}
onChange={(value) => {
const updatedResourceIds = [...selectedResourceIds];
console.log(updatedResourceIds);
console.log(index);
updatedResourceIds[index] = value;
setSelectedResourceIds(updatedResourceIds);

Expand Down
19 changes: 10 additions & 9 deletions landing/src/components/ui/elements/ListSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactComponent as CaretDown } from "@/assets/icons/common/caret-down-fill.svg";
import { ReactComponent as Checkmark } from "@/assets/icons/common/checkmark.svg";
import { Listbox, Transition } from "@headlessui/react";
import { Listbox, ListboxButton, ListboxOption, ListboxOptions, Transition } from "@headlessui/react";
import clsx from "clsx";
import { Fragment, ReactNode, useMemo } from "react";

Expand Down Expand Up @@ -30,8 +30,8 @@ function ListSelect(props: ListSelectProps) {
<div className={clsx("w-full", props.className, "z-100")}>
<Listbox value={props.value} onChange={props.onChange} disabled={props.disabled}>
{({ open }) => (
<div className="relative ">
<Listbox.Button
<div>
<ListboxButton
className={clsx(
"flex items-center relative cursor-pointer text-xs py-1 min-h-[32px] z-0 w-full bg-gold/10 hover:bg-gold/20 px-2",
)}
Expand All @@ -45,7 +45,7 @@ function ListSelect(props: ListSelectProps) {
/>
</div>
</span>
</Listbox.Button>
</ListboxButton>
<Transition
as={Fragment}
show={open}
Expand All @@ -58,14 +58,15 @@ function ListSelect(props: ListSelectProps) {
leaveTo="opacity-0"
>
<div className="fixed z-50 w-min text-xs">
<Listbox.Options
<ListboxOptions
anchor="bottom start"
className={clsx(
"z-50 w-full rounded-md py-1 max-h-72 overflow-scroll z-100 border border-gold/10 no-scrollbar",
"z-50 rounded-md py-1 max-h-72 overflow-scroll z-100 border border-gold/10 no-scrollbar",
props.style === "black" ? "bg-brown" : " bg-brown",
)}
>
{props.options.map((option) => (
<Listbox.Option
<ListboxOption
key={option.id}
className={({ active }) =>
`overflow-visible relative cursor-pointer z-50 select-none py-2 flex items-center pl-8 text-gold ${
Expand All @@ -90,9 +91,9 @@ function ListSelect(props: ListSelectProps) {
) : null}
</>
)}
</Listbox.Option>
</ListboxOption>
))}
</Listbox.Options>
</ListboxOptions>
</div>
</Transition>
</div>
Expand Down
119 changes: 107 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a74c7f8

Please sign in to comment.