-
Notifications
You must be signed in to change notification settings - Fork 480
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
Enhanced Styling Updates: Conditional 'Completed' Tags and Export Button Design #9499
base: develop
Are you sure you want to change the base?
Changes from 2 commits
b429f9d
7a383b3
b6ec446
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -150,8 +150,20 @@ export function KanbanSection<T extends { id: string }>( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="sticky top-0 rounded-xl bg-secondary-200 pt-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="mx-2 flex items-center justify-between rounded-lg border border-secondary-300 bg-white p-4"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div>{section.title}</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
className={`mx-2 flex items-center justify-between rounded-lg border p-4 ${ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
section.id === "COMPLETED" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
? "border-green-500 bg-green-500 " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
: "border-secondary-300 bg-white" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}`} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{section.id === "COMPLETED" ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<span className="font-bold text-white">{section.title}</span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) : ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
section.title | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+153
to
+166
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 Extract status constants and simplify conditional rendering The current implementation has several areas for improvement:
Consider this refactor: + const SECTION_STATUS = {
+ COMPLETED: 'COMPLETED'
+ } as const;
+
+ const getSectionHeaderClass = (status: string) =>
+ status === SECTION_STATUS.COMPLETED
+ ? "border-green-500 bg-green-500"
+ : "border-secondary-300 bg-white";
- <div
- className={`mx-2 flex items-center justify-between rounded-lg border p-4 ${
- section.id === "COMPLETED"
- ? "border-green-500 bg-green-500 "
- : "border-secondary-300 bg-white"
- }`}
- >
- <div>
- {section.id === "COMPLETED" ? (
- <span className="font-bold text-white">{section.title}</span>
- ) : (
- section.title
- )}
- </div>
+ <div className={`mx-2 flex items-center justify-between rounded-lg border p-4 ${getSectionHeaderClass(section.id)}`}>
+ <span className={section.id === SECTION_STATUS.COMPLETED ? "font-bold text-white" : ""}>
+ {section.title}
+ </span> 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<span className="ml-2 rounded-lg bg-secondary-300 px-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{typeof totalCount === "undefined" ? "..." : totalCount} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,6 +116,7 @@ export default function BoardView() { | |
<h3 className="flex h-8 items-center text-xs"> | ||
{board}{" "} | ||
<ExportButton | ||
tooltip={`${board}`} | ||
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 Add translation and improve accessibility for tooltips The tooltip text should be translated and accessible. - tooltip={`${board}`}
+ tooltip={t(`resource_board_export_tooltip`, { board: t(board.toLowerCase()) })}
+ aria-label={t(`resource_board_export_aria_label`, { board: t(board.toLowerCase()) })} Also, ensure these translation keys are added to your i18n files: {
"resource_board_export_tooltip": "Export {{board}} resources",
"resource_board_export_aria_label": "Export resources from {{board}} board"
} |
||
action={async () => { | ||
const { data } = await request( | ||
routes.downloadResourceRequests, | ||
|
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.
🛠️ Refactor suggestion
Consider using a dedicated prop for completion status
Using the tooltip text to determine completion status mixes presentation with business logic. This approach is fragile and could break if tooltip text changes.
Consider adding a dedicated prop: