-
Notifications
You must be signed in to change notification settings - Fork 0
#21 refactor: Button 컴포넌트 리팩터링 (tailwind-variants 적용) #22
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
Changes from all commits
0927964
77c081e
6aa8fb1
e81750a
2993ec3
27fbea9
194434e
39a5da2
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.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ import logo from '../../../assets/images/snowCode_logo_mini.svg'; | |||||||||||||||||||||||||||||||||||
| import CourseCard from './CourseCard'; | ||||||||||||||||||||||||||||||||||||
| import {AddIcon} from '../../../assets/svg'; | ||||||||||||||||||||||||||||||||||||
| import type {Course, UserType} from './types'; | ||||||||||||||||||||||||||||||||||||
| import Button from '../Button'; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| const courses: Course[] = [ | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
|
|
@@ -45,10 +46,13 @@ const CourseList = ({userType}: CourseListProps) => { | |||||||||||||||||||||||||||||||||||
| 강의 목록 | ||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||
| {userType === 'admin' && ( | ||||||||||||||||||||||||||||||||||||
| <button className='bg-white border-0 px-3 py-1 rounded-[10px] flex-center gap-[6px] text-base font-medium text-secondary-black cursor-pointer hover:bg-gray'> | ||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||
| color='ghostWhite' | ||||||||||||||||||||||||||||||||||||
| size='compact' | ||||||||||||||||||||||||||||||||||||
| className='hover:opacity-70'> | ||||||||||||||||||||||||||||||||||||
| <AddIcon width={12} height={12} /> | ||||||||||||||||||||||||||||||||||||
| <span>추가</span> | ||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||
| 추가 | ||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+49
to
+55
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. 🛠️ Refactor suggestion | 🟠 Major Add content='mixed' variant for icon + text combination. This Button contains both an icon and text but doesn't specify 🔎 Proposed fix <Button
color='ghostWhite'
size='compact'
+ content='mixed'
className='hover:opacity-70'>
<AddIcon width={12} height={12} />
추가
</Button>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||
| <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.
Missing
type,onMouseEnter, andonMouseLeaveattributes on the button element.The
typeprop is destructured but never applied to the<button>. Additionally,onMouseEnterandonMouseLeaveare accepted as props but remain in the...propsspread—they're passed to thebutton()tv function (which ignores them) instead of being wired to the actual element. This breaks hover interactions in consumers likeLandingPage.🔎 Proposed fix
const Button = ({ children, onClick, type = 'button', disabled = false, + onMouseEnter, + onMouseLeave, + className, ...props }: ButtonProps) => { return ( - <button onClick={onClick} disabled={disabled} className={button(props)}> + <button + type={type} + onClick={onClick} + disabled={disabled} + onMouseEnter={onMouseEnter} + onMouseLeave={onMouseLeave} + className={button({...props, className})}> {children} </button> ); };📝 Committable suggestion
🤖 Prompt for AI Agents