-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use enhanced select for CurseForge strategy
Signed-off-by: Ryan Cao <[email protected]>
- Loading branch information
Showing
4 changed files
with
107 additions
and
77 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { twMerge } from "tailwind-merge"; | ||
import { type ReactNode } from "react"; | ||
|
||
export const Select = <T extends string>({ | ||
name, | ||
value, | ||
currentValue, | ||
onCheck, | ||
children, | ||
className, | ||
}: { | ||
name: string; | ||
value: T; | ||
currentValue: T; | ||
onCheck?: (v: T) => void | Promise<void>; | ||
className?: string; | ||
children?: ReactNode | ReactNode[]; | ||
}) => { | ||
return ( | ||
<label | ||
className={twMerge( | ||
"flex w-full flex-col items-start gap-y-2 rounded-md p-4 hover:cursor-pointer", | ||
value === currentValue ? "bg-indigo-500 text-white" : "bg-neutral-100 dark:bg-neutral-800", | ||
className, | ||
)} | ||
> | ||
<input | ||
type="radio" | ||
className="sr-only" | ||
name={name} | ||
value={value} | ||
checked={value === currentValue} | ||
onChange={(ev) => { | ||
if (onCheck && ev.target.value) onCheck(ev.target.value as T); | ||
}} | ||
/> | ||
{children} | ||
</label> | ||
); | ||
}; |
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
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