-
Notifications
You must be signed in to change notification settings - Fork 6
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: FloatButton 컴포넌트 구현 #21
base: dev
Are you sure you want to change the base?
Conversation
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.
확인했습니다 수고하셨습니다~ ㅎㅎ
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.
@@ -0,0 +1,99 @@ | |||
/* 기본 버튼 스타일 */ |
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.
module.css 에 있는 주석들 다 제거하면 좋을 거 같아요!
src/libs/floatbutton/FloatButton.tsx
Outdated
@@ -0,0 +1,42 @@ | |||
// FloatButton.tsx |
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.
여기도 주석제거!
src/libs/floatbutton/FloatButton.tsx
Outdated
@@ -0,0 +1,42 @@ | |||
// FloatButton.tsx | |||
import React from "react"; |
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.
이거 tsconfig 떙기면 없어져도 되는 코드인데 dev 브랜치 pull 땡기시고 warning이랑 error나는 부분 고쳐주세요!
src/libs/floatbutton/FloatButton.tsx
Outdated
children, | ||
icon, | ||
text, | ||
...rest |
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.
이거 rest가 아니라 props로 저희 통일하는거 어떨까요?!
import styles from "./FloatButton.module.css"; | ||
import { FloatButtonProps } from "./FloatButton.type"; | ||
|
||
const FloatButton = ({ |
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.
forwardref로 감싸줘서 부모에서 직접 플로팅버튼 dom 요소에 접근해서 제어할 수 있게 해주면 유연성과 확장성 면에서 더 좋을 거 같아요!!
플로팅 버튼을 state 값에 따라 모달이나 팝업을 띄워도 되겠지만 fab를 통한 애니메이션, 및 인터렉션 작용을 사용처에서 원한다면 이에 대해 직접 접근해서 더 좋은 ux를 만들어줄 수 있도록 forwardref로 열어주는게 좋아보여서요!!!
import React, { ButtonHTMLAttributes } from "react"; | ||
|
||
interface FloatButtonOwnProps { | ||
size?: "small" | "medium" | "large"; // 버튼 크기 |
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.
여기도 주석제거해주세요ㅎㅎ
position: fixed; | ||
bottom: 16px; | ||
right: 16px; | ||
display: flex; |
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.
음 저희 글자 컬러색이 현재 검은색으로 자동 박혀있는데 저희 디폴트 컬러값이 파란색이니까 하얀색으로 일단 넣어주는거 어떨까요?
그럼 배경색이 너무 밝을때 안보이지 않을까? 하실 수 있지만 지금 현식님은 배경색 디폴트 파란색 색상 외에 자유롭게 설정할 수 있도록 하셨는데 추후 디자이너 분과 함께이면 배경색을 아예 열어둘지, 어느정도 테마 색상을 갖고가서 이 안에서 설정할 수 있도록 할지 등 논의에 따라 배경색 관련 코드를 수정할 수도 있기에
일단 디폴트 색상에 맞춰서 글씨 색을 하얀색으로 박고 가는게 나을거 같다는 생각입니다!
> | ||
{icon && <span className={styles.icon}>{icon}</span>} | ||
{text && <span className={styles.text}>{text}</span>} | ||
{children} |
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.
음 궁금한게 text랑 icon을 저렇게 다 넣어둔 상황이라면 저는 children은 빼도 된다고 생각합니다.
여기서 논의해보고 싶은게 icon과 text를 저렇게 따로 두셨는데 저런 경우 사용처에서 icon과 text를 모두 입력할 시, 순서가 icon, text로 고정적으로 박히게 되는데(물론 두 개 다 사용할까? 라는 의문이 있지만) 저는 차라리 저렇게 따로 두는 것보다 children 하나로 그냥 넣어서 icon이든 text든 사용처에서 알아서 넣도록 하는게 맞아보여요.
추가적으로 icon과 text 따로 둔다면, 각각 className을 지정하셨는데 해당 스타일 코드가 따로 없는걸로 보아 icon과 text className 관련 코드도 정리하는게 나을 거 같습니다!!
안녕하세요... 제가 또 왔습니다. 근데 react에서는 import 자동이 잘 되긴 하지만, nextJS에서는 ssr 구조라 그런지 타입 선언 파일이 없어서 모듈 자체를 불러오지 못해 자동 import 또한 제대로 동작하지 않는 것 같습니다. 그렇기 때문에 dts({
insertTypesEntry: true,
}), |
1️⃣ 어떤 작업을 했나요? (Summary)
FloatButton 컴포넌트 구현을 했습니다.
2️⃣ 알아두시면 좋아요!
버튼의 추가 속성 =>
size
,color
,position
,shape
,children
,icon
,text
size
버튼의 size 속성으로
small
,medium
,large
총 3가지로 만들었습니다.children
버튼의 콘텐트가 담기는 children입니다.
{...rest}
3️⃣ 추후 작업
4️⃣ 체크리스트 (Checklist)
dev
브랜치의 최신 코드를pull
받았나요?