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

InputText 컴포넌트를 분리한다. #38

Closed
KIMSEI1124 opened this issue Nov 9, 2024 · 0 comments · Fixed by #39
Closed

InputText 컴포넌트를 분리한다. #38

KIMSEI1124 opened this issue Nov 9, 2024 · 0 comments · Fixed by #39
Assignees
Labels
✨ FEATURE 새로운 기능 추가

Comments

@KIMSEI1124
Copy link
Member

📑 개요

import styled from 'styled-components';
import tw from 'twin.macro';

type InputTextProps = {
  $width?: string;
  $isValid?: boolean;
  $void?: boolean;
  $resize?: boolean;
};

const InputDefault = styled.input<InputTextProps>`
  ${tw`
    h-8
    rounded-md
    px-2
    transition

    placeholder:text-gray-300
    hover:outline-gray-400
    focus:!outline-none
    focus:ring
    focus:ring-main
    `}
  ${(props) => (props.$void ? '' : tw`outline outline-1`)}
  ${(props) =>
    props.$isValid === false
      ? tw`outline-label-red text-label-red`
      : tw`outline-gray-300`}
  ${(props) => (props.$width ? `width:${props.$width};` : tw`grow`)}
`;

const InputTitle = styled.input<InputTextProps>`
  ${tw`
      h-8
      bg-transparent
      font-bold
      px-2
      transition

      placeholder:text-gray-300
      hover:border-gray-400
      focus:!outline-none
      focus:border-main
  `}
  ${(props) => (props.$void ? '' : tw`border-b-2`)}
  ${(props) =>
    props.$isValid === false
      ? tw`border-label-red text-label-red`
      : tw`border-gray-300`}
  ${(props) => (props.$width ? `width:${props.$width};` : tw`grow`)}
`;

const InputTextArea = styled.textarea<InputTextProps>`
  ${tw`
    rounded-md
    px-2
    transition

    placeholder:text-gray-300
    hover:outline-gray-400
    focus:!outline-none
    focus:ring
    focus:ring-main
    `}
  ${(props) => (props.$void ? '' : tw`outline outline-1`)}
  ${(props) =>
    props.$isValid === false
      ? tw`outline-label-red text-label-red`
      : tw`outline-gray-300`}
  ${(props) => (props.$width ? `width:${props.$width};` : tw`grow`)}
  ${(props) => (props.$resize === false ? tw`resize-none` : '')}
`;

export { InputDefault, InputTitle, InputTextArea };

해당 컴포넌트를 분리하고 스타일 옵션과 컴포넌트 옵션을 분리합니다.

🚀 상세 작업 내용


  • 스타일 관련 코드 분리
  • 컴포넌트 분리
  • 스토리북 등록
  • 마이그레이션

⏰ 예상 소요 시간


2일

📁 ETC


@KIMSEI1124 KIMSEI1124 added the ✨ FEATURE 새로운 기능 추가 label Nov 9, 2024
@KIMSEI1124 KIMSEI1124 self-assigned this Nov 9, 2024
KIMSEI1124 added a commit that referenced this issue Nov 10, 2024
@KIMSEI1124 KIMSEI1124 linked a pull request Nov 30, 2024 that will close this issue
6 tasks
KIMSEI1124 added a commit that referenced this issue Nov 30, 2024
KIMSEI1124 added a commit that referenced this issue Dec 7, 2024
KIMSEI1124 added a commit that referenced this issue Dec 7, 2024
KIMSEI1124 added a commit that referenced this issue Dec 7, 2024
InputText 컴포넌트를 분리
@github-project-automation github-project-automation bot moved this from 🚀 In Progress to ✅ Done in What's Your Plan Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ FEATURE 새로운 기능 추가
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant