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

[Refactoring] Refactor Separate components to TagItem and TagList #24

Merged
merged 1 commit into from
Nov 24, 2020

Conversation

saseungmin
Copy link
Collaborator

@saseungmin saseungmin commented Nov 24, 2020

πŸš€ 진행 사항

  • μŠ€ν„°λ”” κΈ€ 등둝 νŽ˜μ΄μ§€μ˜ νƒœκ·Έ 뢀뢄을 λ¦¬νŒ©ν† λ§ ν•œλ‹€.
  • ν…ŒμŠ€νŠΈ μˆ˜μ •

- Refactor Separate components to TagItem and TagList
@saseungmin saseungmin added the refactoring λ¦¬νŒ©ν† λ§ μˆ˜μ •μ‚¬ν•­ μˆ˜μ • label Nov 24, 2020
@saseungmin saseungmin merged commit 9a8b904 into CodeSoom:main Nov 24, 2020
@saseungmin saseungmin mentioned this pull request Nov 24, 2020
20 tasks
<TagListWrapper>
{tags.map((tag) => (
<TagItem
key={tag}

Choose a reason for hiding this comment

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

λ™μΌν•œ tagκ°€ 올 κ²½μš°λŠ” μ—†μ„κΉŒμš”?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TagsForm μ»΄ν¬λ„ŒνŠΈμ—μ„œ 쀑볡 값이 μžˆκ±°λ‚˜ 빈 κ°’(value)이면 λ°°μ—΄(inputTags)에 넣어주지 μ•ŠμŠ΅λ‹ˆλ‹€.

  // TagsForm.jsx

  const validateInput = (value) => {
    if (!value || inputTags.includes(value)) {
      return;
    }

    const resultTags = [...inputTags, value];

    setInputTags(resultTags);
    onChange(resultTags);
  };

  //... μƒλž΅
  const handleSubmit = (e) => {
    if (e.key === 'Enter') {
      validateInput(tag.trim());
      setTag('');
    }
  };

@saseungmin saseungmin deleted the refactoring-tag-in-write-page branch November 24, 2020 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring λ¦¬νŒ©ν† λ§ μˆ˜μ •μ‚¬ν•­ μˆ˜μ •
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants