Skip to content

Commit

Permalink
Sort tag and character select items
Browse files Browse the repository at this point in the history
  • Loading branch information
bombies committed Nov 2, 2023
1 parent 396ee83 commit 5dd9fd1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"use client"

import {FC, Fragment, useState} from "react";
import {FC, Fragment} from "react";
import Button from "@/app/(site)/components/Button";
import Select from "@/app/(site)/components/inputs/Select";
import {Chip} from "@nextui-org/chip";
import {SelectItem} from "@nextui-org/react";
import {DreamCharactersState} from "@/app/(site)/(internal)/dashboard/(your-dreams)/components/dreams/hooks/useDreamCharacters";
import {
DreamCharactersState
} from "@/app/(site)/(internal)/dashboard/(your-dreams)/components/dreams/hooks/useDreamCharacters";
import {UseFormRegister} from "react-hook-form";
import PlusIcon from "@/app/(site)/components/icons/PlusIcon";

Expand All @@ -17,8 +19,6 @@ type Props = {
}

const DreamCharacterSelect: FC<Props> = ({onModalOpen, isDisabled, characters, register}) => {
const [modalOpen, setModalOpen] = useState(false)

return (
<Fragment>
<div className="flex gap-4 mb-2">
Expand All @@ -38,7 +38,7 @@ const DreamCharacterSelect: FC<Props> = ({onModalOpen, isDisabled, characters, r
aria-label="Dream Characters"
register={register}
id="characters"
items={characters.data}
items={characters.data.sort((a, b) => a.name.localeCompare(b.name))}
placeholder="Who was in your dream?"
selectionMode={"multiple"}
renderValue={(items) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client"

import {FC, Fragment, useState} from "react";
import {FC, Fragment} from "react";
import Button from "@/app/(site)/components/Button";
import Select from "@/app/(site)/components/inputs/Select";
import {Chip} from "@nextui-org/chip";
Expand All @@ -25,7 +25,7 @@ const DreamTagSelect: FC<Props> = ({onModalOpen, isDisabled, tags, register}) =>
color="cta"
size="sm"
onPress={onModalOpen}
startContent={<PlusIcon width={20} />}
startContent={<PlusIcon width={20}/>}
isDisabled={isDisabled}
>
Add New Tag
Expand All @@ -36,7 +36,7 @@ const DreamTagSelect: FC<Props> = ({onModalOpen, isDisabled, tags, register}) =>
aria-label="Dream Tags"
register={register}
id="tags"
items={tags.data}
items={tags.data.sort((a, b) => a.tag.localeCompare(b.tag))}
placeholder="Describe your dream with one or two words"
selectionMode={"multiple"}
renderValue={(items) => {
Expand Down

0 comments on commit 5dd9fd1

Please sign in to comment.