-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
refactor-66: Disable other option when three categories is selected #69
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
let commonProps: string = 'px-3 py-1 rounded-3xl font-normal text-sm'; | ||
export const categoryProps = (category: string, selected: boolean = false) => { | ||
export const categoryProps = (category: string, selected: boolean = false, disable: boolean = false) => { | ||
switch (category) { | ||
case 'Travel': | ||
return `${commonProps} ${selected ? `bg-pink-500` : `bg-pink-100`}`; | ||
return `${commonProps} ${selected ? `bg-pink-500` : disable ? `bg-slate-100 text-slate-400` : `bg-pink-100`}`; | ||
|
||
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. Okay, I guess we have to figure out a more optimized version of getting this done, 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. Sir @krishnaacharyaa, can I remove category-props. and fixed it? 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. Sir @krishnaacharyaa Plz let me know whenver #67 is merged I will fixed the above comment and push it. 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.
Actually, we are introducing new component called
Sure |
||
case 'Nature': | ||
return `${commonProps} ${selected ? `bg-green-500` : `bg-green-100`}`; | ||
return `${commonProps} ${selected ? `bg-green-500` : disable ? `bg-slate-100 text-slate-400` : `bg-green-100`}`; | ||
|
||
case 'City': | ||
return `${commonProps} ${selected ? `bg-yellow-500` : `bg-yellow-100`}`; | ||
return `${commonProps} ${selected ? `bg-yellow-500` : disable ? `bg-slate-100 text-slate-400` : `bg-yellow-100`}`; | ||
|
||
case 'Adventure': | ||
return `${commonProps} ${selected ? `bg-blue-500` : `bg-blue-100`}`; | ||
return `${commonProps} ${selected ? `bg-blue-500` : disable ? `bg-slate-100 text-slate-400` : `bg-blue-100`}`; | ||
|
||
case 'Beaches': | ||
return `${commonProps} ${selected ? `bg-purple-500` : `bg-purple-100`}`; | ||
return `${commonProps} ${selected ? `bg-purple-500` : disable ? `bg-slate-100 text-slate-400` : `bg-purple-100`}`; | ||
|
||
case 'Landmarks': | ||
return `${commonProps} ${selected ? `bg-red-500` : `bg-red-100`}`; | ||
return `${commonProps} ${selected ? `bg-red-500` : disable ? `bg-slate-100 text-slate-400` : `bg-red-100`}`; | ||
|
||
default: | ||
return `${commonProps} ${selected ? `bg-orange-500` : `bg-orange-100`}`; | ||
return `${commonProps} ${selected ? `bg-orange-500` : disable ? `bg-slate-100 text-slate-400` : `bg-orange-100`}`; | ||
} | ||
}; |
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.
Can you kindly optimize this even further, refactoring it to a new function which would simplify this process further.
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.
Ok @krishnaacharyaa I will do that