Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat/#131] 태그 기능 수정 #142

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading