Skip to content

Commit

Permalink
Merge pull request #142 from DDD-Community/feat/#131
Browse files Browse the repository at this point in the history
[feat/#131] 태그 기능 수정
  • Loading branch information
lkhoony authored Jan 20, 2025
2 parents ed5c0cd + 96d7dc5 commit 011213a
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/components/Modal/CreateCrewModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,11 @@ export const Tag = (props: ITag): React.ReactElement => {
}`}
onClick={onClickHandler}
>
{name}
{`#${name}`}
</div>
)
}

/**
* @todo
* 수정 상태에서
* 이름 : 원래의 이름과 같은 경우에는 중복체크 할 필요 없음
* 수정 : 변경 사항이 있는 경우에만 만들기 활성화
*/

const CreateCrewModal = (props: ModalProps): React.ReactElement => {
const { onClose, onSubmit, isModify } = props

Expand Down Expand Up @@ -70,7 +63,7 @@ const CreateCrewModal = (props: ModalProps): React.ReactElement => {

const onChangeTag = (e: React.ChangeEvent<HTMLInputElement>): void => {
const { value } = e.target
if (/^[^\s]*$/.test(value) && value.length <= 10) setTag(value)
if (/^[^\s\{\}\[\]\/?.,;:|\)*~`!^\-_+<>@\#$%&\\\=\(\'\"]*$/.test(value) && value.length <= 10) setTag(value)
else setIsComposing(false)
}

Expand Down Expand Up @@ -309,9 +302,10 @@ const CreateCrewModal = (props: ModalProps): React.ReactElement => {
{/* tag list */}
<div className="flex gap-1">{createTags(tags)}</div>
{tags.length < 3 && (
<div className="relative grow">
<div className="relative flex grow">
{tag === "" || <span className="leading-7">#</span>}
<input
className="w-full leading-7 outline-none"
className="grow leading-7 outline-none"
value={tag}
onChange={onChangeTag}
onKeyDown={onEnterTag}
Expand Down

0 comments on commit 011213a

Please sign in to comment.