-
Notifications
You must be signed in to change notification settings - Fork 31
[최권진] sprint7, 8 #138
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
The head ref may contain hidden characters: "React-\uCD5C\uAD8C\uC9C4"
[최권진] sprint7, 8 #138
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,21 @@ | ||
| import React from "react"; | ||
|
|
||
| export interface FormInputType { | ||
| id: string; | ||
| type?: string; | ||
| label?: string; | ||
| value?: string; | ||
| placeholder?: string; | ||
| onBlur?: (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이벤트핸들러 타입을 가져다 쓰셔도 됩니다 :) onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>; |
||
| error?:string; | ||
| hidden?: boolean; | ||
| className?: string; | ||
| rightIcon?: React.ReactNode; | ||
| accept?: string; | ||
| onChange?: (e:React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void; | ||
| ref?:React.Ref<HTMLInputElement | HTMLTextAreaElement>; | ||
| } | ||
|
|
||
| const FormInput = ({ | ||
| id, | ||
| type = "text", | ||
|
|
@@ -13,7 +29,7 @@ const FormInput = ({ | |
| accept, | ||
| ref, | ||
| ...rest | ||
| }) => { | ||
| }:FormInputType) => { | ||
| return ( | ||
| <div className={`${hidden ? "hidden" : "mb-[24px]"}`}> | ||
| {label && !hidden && ( | ||
|
|
@@ -25,11 +41,9 @@ const FormInput = ({ | |
| {type === "textarea" ? ( | ||
| <textarea | ||
| id={id} | ||
| ref={ref} | ||
| type={type} | ||
| ref={ref as React.Ref<HTMLTextAreaElement>} | ||
| placeholder={placeholder} | ||
| onBlur={onBlur} | ||
| accept={accept} | ||
| {...rest} | ||
| className={`input-primary resize-none px-4 py-3 h-[282px] ${ | ||
| error ? "border border-red-500 mb-[8px]" : "" | ||
|
|
@@ -38,7 +52,7 @@ const FormInput = ({ | |
| ) : ( | ||
| <input | ||
| id={id} | ||
| ref={ref} | ||
| ref={ref as React.Ref<HTMLInputElement>} | ||
| type={type} | ||
| placeholder={placeholder} | ||
| onBlur={onBlur} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import React from "react"; | ||
| import { Link } from "react-router-dom"; | ||
| import { MainBannerPropsType } from "./MainTypes"; | ||
|
|
||
|
|
||
| const MainBanner = ({ | ||
| title, | ||
|
|
@@ -9,14 +10,20 @@ const MainBanner = ({ | |
| showButton, | ||
| height, | ||
| margintop, | ||
| }) => { | ||
| }:MainBannerPropsType) => { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이건 중요한 거는 아닌데 컴포넌트 프랍스는 보통 컴포넌트 안에서만 쓰이다보니 컴포넌트 안에 정의하는 게 편할 때가 많습니다 :) |
||
| return ( | ||
| <div | ||
| className="w-full bg-[#cfe5ff] flex justify-center overflow-hidden pc:h-[540px] tablet:h-[771px] mobile:h-[540px]" | ||
| style={{ marginTop: margintop }} | ||
| > | ||
| <div className="w-[356px] h-[200px] flex flex-col relative right-[1rem] pc:top-[12.5rem] tablet:top-[7rem] mobile:top-[2rem] pc:left-0 tablet:left-[18rem] mobile:left-[13rem] "> | ||
| <span className="h-[112px] font-[700] text-[#374151] break-words leading-[56px] pc:w-[300px] tablet:w-[1920px] mobile:w-[270px] pc:text-left tablet:text-left mobile:text-center pc:text-[40px] tablet:text-[40px] mobile:text-[32px] "> | ||
| <div | ||
| className={`w-[356px] h-[200px] flex flex-col relative right-[1rem] | ||
| pc:top-[12.5rem] tablet:top-[7rem] mobile:top-[2rem] | ||
| pc:left-0 tablet:left-[18rem] ${ | ||
| title === "믿을 수 있는" ? "left-[12rem]" : "left-[13rem]" | ||
| }`} | ||
| > | ||
| <span className="h-[112px] font-[700] text-[#374151] break-words leading-[56px] pc:w-[300px] tablet:w-[1920px] mobile:w-[270px] pc:text-left tablet:text-left mobile:text-center pc:text-[40px] tablet:text-[40px] mobile:text-[32px]"> | ||
| {title} | ||
| {title === "믿을 수 있는" ? <br /> : null} | ||
| {title2} | ||
|
|
@@ -36,9 +43,14 @@ const MainBanner = ({ | |
| src={image} | ||
| alt="panda-image" | ||
| style={{ height: height }} | ||
| className={ | ||
| "h-[21.25rem] relative object-contain pc:top-[12.5rem] tablet:top-[26.9rem] mobile:top-[17.8rem] pc:right-0 tablet:right-[170px] mobile:right-[8.5rem] pc:min-w-[746px] tablet:min-w-[746px] mobile:min-w-[375px] " | ||
| } | ||
| className={`h-[21.25rem] relative object-contain | ||
| ${ | ||
| title === "믿을 수 있는" | ||
| ? "top-[250px] tablet:top-[400px] pc:top-[150px]" | ||
| : "pc:top-[12.5rem] tablet:top-[26.9rem] mobile:top-[17.8rem]" | ||
| } | ||
| pc:right-0 tablet:right-[170px] mobile:right-[8.5rem] | ||
| pc:min-w-[746px] tablet:min-w-[746px] mobile:min-w-[375px]`} | ||
| /> | ||
| </div> | ||
| ); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { InputHTMLAttributes } from "react";
이렇게 타입을 정의하시면 기본적인 input type들(id, type, value, placeholder 등)은 추가로 정의하지 않으셔도 됩니다!