Skip to content

Commit

Permalink
fix: 송금에서 데스크탑 환경은 복사하기밖에 보이지 않도록 수정 (#735)
Browse files Browse the repository at this point in the history
* feat: 데탑 기본 값을 복사하기로 변경

* fix: select box 클릭시 목록이 없어졌다가 생기는 오류 수정
  • Loading branch information
jinhokim98 authored and Todari committed Oct 10, 2024
1 parent 0417366 commit 401b171
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions client/src/components/Design/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Select = <T extends string | number | readonly string[]>({

return (
<ClickOutsideDetector targetRef={selectRef} onClickOutside={() => setIsOpen(false)}>
<fieldset css={selectStyle}>
<fieldset ref={selectRef} css={selectStyle}>
<SelectInput
labelText={labelText}
placeholder={placeholder ?? ''}
Expand All @@ -31,7 +31,7 @@ const Select = <T extends string | number | readonly string[]>({
setHasFocus={setIsOpen}
/>
{options.length > 0 && (
<ul ref={selectRef} css={optionListStyle(theme, isOpen)}>
<ul css={optionListStyle(theme, isOpen)}>
<Flex flexDirection="column" gap="0.5rem">
{options.map((option, index) => (
<li key={`${option}-${index}`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const useSelect = <T extends string | number | readonly string[]>({defaultValue,
const [isOpen, setIsOpen] = useState(false);
const [value, setValue] = useState(defaultValue);

const selectRef = useRef<HTMLUListElement>(null);
const selectRef = useRef<HTMLFieldSetElement>(null);

const handleSelect = (option: T) => {
setValue(option);
Expand Down
11 changes: 7 additions & 4 deletions client/src/hooks/useSendPage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {useLocation} from 'react-router-dom';
import {useEffect, useState} from 'react';

import {isMobileDevice} from '@utils/detectDevice';

import {SendInfo} from './useReportsPage';
import toast from './useToast/toast';
import useAmplitude from './useAmplitude';
Expand All @@ -9,14 +11,15 @@ export type SendMethod = '복사하기' | '토스' | '카카오페이';
export type OnSend = () => void | Promise<void>;

const useSendPage = () => {
const [sendMethod, setSendMethod] = useState<SendMethod>('토스');
const isMobile = isMobileDevice();
const options: SendMethod[] = isMobile ? ['토스', '카카오페이', '복사하기'] : ['복사하기'];
const defaultValue: SendMethod = isMobile ? '토스' : '복사하기';

const [sendMethod, setSendMethod] = useState<SendMethod>(defaultValue);
const state = useLocation().state as SendInfo;

const {trackSendMoney} = useAmplitude();

const options: SendMethod[] = ['토스', '카카오페이', '복사하기'];
const defaultValue: SendMethod = '토스';

const onSelect = (option: SendMethod) => {
setSendMethod(option);
};
Expand Down

0 comments on commit 401b171

Please sign in to comment.