-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat]:Timesheet Skeleton Calendar-View (#3419)
* feat:timesheet skeleton calendar-view * coderabbitai * feat: optimize SelectionBar component with reusable ActionButton and improved class handling * coderabbitai * coderabbitai
- Loading branch information
1 parent
8f94a71
commit 1bbb370
Showing
5 changed files
with
108 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
apps/web/app/[locale]/timesheet/[memberId]/components/SelectionBar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { cn } from "@/lib/utils"; | ||
import { useTranslations } from "next-intl"; | ||
|
||
type ActionButtonProps = { | ||
label: string; | ||
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void; | ||
}; | ||
|
||
const ActionButton = ({ label, onClick }: ActionButtonProps) => ( | ||
<button | ||
className="bg-white font-semibold h-8 px-3 rounded-lg text-[#282048] dark:text-white dark:bg-primary-light" | ||
onClick={onClick} | ||
> | ||
{label} | ||
</button> | ||
); | ||
|
||
interface SelectionBarProps { | ||
fullWidth: boolean; | ||
selectedCount: number; | ||
onApprove: () => void; | ||
onReject: () => void; | ||
onDelete: () => void; | ||
onClearSelection: () => void; | ||
} | ||
|
||
export const SelectionBar = ({ | ||
fullWidth, | ||
selectedCount, | ||
onApprove, | ||
onReject, | ||
onDelete, | ||
onClearSelection | ||
}: SelectionBarProps) => { | ||
const t = useTranslations() | ||
return ( | ||
<div | ||
className={cn( | ||
"bg-[#E2E2E2CC] fixed dark:bg-slate-800 opacity-85 h-16 z-50 bottom-5 left-1/2 transform -translate-x-1/2 shadow-lg rounded-2xl flex items-center justify-between gap-x-4 px-4", | ||
fullWidth && "x-container" | ||
)} | ||
> | ||
<div className="flex items-center justify-start gap-x-4"> | ||
<div className="flex items-center justify-center gap-x-2 text-[#282048] dark:text-[#7a62d8]"> | ||
<div className="bg-primary dark:bg-primary-light text-white rounded-full h-7 w-7 flex items-center justify-center font-bold"> | ||
<span>{selectedCount}</span> | ||
</div> | ||
<span>selected</span> | ||
</div> | ||
<ActionButton | ||
label={t("pages.timesheet.TIMESHEET_ACTION_APPROVE_SELECTED")} | ||
onClick={onApprove} | ||
/> | ||
<ActionButton | ||
label={t("pages.timesheet.TIMESHEET_ACTION_REJECT_SELECTED")} | ||
onClick={onReject} | ||
/> | ||
<ActionButton | ||
label={t("pages.timesheet.TIMESHEET_ACTION_DELETE_SELECTED")} | ||
onClick={onDelete} | ||
/> | ||
</div> | ||
<button | ||
onClick={onClearSelection} | ||
className="font-semibold h-8 px-3 rounded-lg text-[#3826A6] dark:text-primary-light" | ||
aria-label="Clear Selection" | ||
> | ||
Clear Selection | ||
</button> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters