Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
cham0287 committed May 19, 2024
2 parents 1652e6b + 2bc0078 commit 7842a1f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
20 changes: 13 additions & 7 deletions src/components/ui/SelectVisitHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,22 @@ import { VisitHistoryType } from '@/types/collection';

interface Props {
handleSelectOption: (value: VisitHistoryType) => void;
onOpenChange: (value: boolean) => void;
}

export function SelectVisitHistory({
handleSelectOption,
onOpenChange,
}: Props) {
export function SelectVisitHistory({ handleSelectOption }: Props) {
const [isOpen, setIsOpen] = React.useState(false);
console.log(isOpen);
const handleChangeIsOpen = (isOpen: boolean) => {
setIsOpen(isOpen);
};
return (
<Select onValueChange={handleSelectOption} onOpenChange={onOpenChange}>
<SelectTrigger className="h-S-56 w-full focus:border-Green-400">
<Select
onValueChange={handleSelectOption}
onOpenChange={handleChangeIsOpen}
>
<SelectTrigger
className={`h-S-56 w-full ${isOpen ? 'mb-16' : 'mb-0'} focus:border-Green-400`}
>
<SelectValue placeholder="선택" />
</SelectTrigger>
<SelectContent>
Expand Down
10 changes: 2 additions & 8 deletions src/components/ui/modal/LeaveVisitHistoryModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ type Props = {
const LeaveVisitHistoryModal = ({ setIsModalOpen }: Props) => {
const queryClient = useQueryClient();
const [option, setOption] = useState<VisitHistoryType>();
const [isSelectOpen, setIsSelectOpen] = useState(false);
const selectCollectionId = useSelectedCollectionId();
const { setIsComplete, setCompleteContent } = useContext(CompleteContext);
const { setIsSystemError, setType } = useContext(SystemContext);
Expand All @@ -36,7 +35,7 @@ const LeaveVisitHistoryModal = ({ setIsModalOpen }: Props) => {
const handleSelectOption = (value: VisitHistoryType) => setOption(value);
const handleLeaveVisitHistory = async (e: MouseEvent<HTMLButtonElement>) => {
e.preventDefault();
if (!selectCollectionId || !option || !isSelectOpen) return;
if (!selectCollectionId || !option) return;

try {
const reviewHistoryJSON = localStorage.getItem('reviewHistory');
Expand Down Expand Up @@ -103,12 +102,7 @@ const LeaveVisitHistoryModal = ({ setIsModalOpen }: Props) => {
<Close />
</button>
</header>
<SelectVisitHistory
handleSelectOption={handleSelectOption}
onOpenChange={(open) => {
setIsSelectOpen(open);
}}
/>
<SelectVisitHistory handleSelectOption={handleSelectOption} />
<section className="flex justify-between gap-10">
<Button onClick={() => setIsModalOpen(false)}>취소하기</Button>
<Button
Expand Down

1 comment on commit 7842a1f

@vercel
Copy link

@vercel vercel bot commented on 7842a1f May 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.