-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #666 from taiwonaf/feat-Hgn-email-template
Feat hgn email template
- Loading branch information
Showing
10 changed files
with
160 additions
and
13 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
src/app/(landing-routes)/about-us/_component.tsx/section-header.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,5 @@ | ||
const SectionHeader = () => { | ||
return <div>section-header</div>; | ||
}; | ||
|
||
export default SectionHeader; |
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
86 changes: 86 additions & 0 deletions
86
src/app/dashboard/(admin)/admin/email/_components/pagination/index.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,86 @@ | ||
import { ChevronLeft, ChevronRight } from "lucide-react"; | ||
import { Dispatch, FC, SetStateAction } from "react"; | ||
|
||
import CustomButton from "~/components/common/common-button/common-button"; | ||
import useGeneratePagesNumbers from "~/hooks/use-generate-pagination"; | ||
|
||
interface IProperties { | ||
currentPage: number; | ||
totalPage: number; | ||
setCurrentPage: Dispatch<SetStateAction<number>>; | ||
isloading: boolean; | ||
} | ||
|
||
const Pigination: FC<IProperties> = ({ | ||
currentPage, | ||
totalPage, | ||
setCurrentPage, | ||
isloading, | ||
}) => { | ||
const { before, after } = useGeneratePagesNumbers(currentPage, totalPage); | ||
return ( | ||
<div className="flex w-full items-center justify-between gap-2 border-t-[1px] border-border px-6 py-4"> | ||
<span className="text-sm font-semibold text-neutral-dark-2"> | ||
Page {currentPage} of {totalPage} | ||
</span> | ||
<div className="flex items-center justify-between gap-1"> | ||
{before.map((item, index) => { | ||
if (item) { | ||
return ( | ||
<CustomButton | ||
key={index} | ||
variant="outline" | ||
className="h-8 w-8" | ||
onClick={() => setCurrentPage(item as number)} | ||
isDisabled={isloading} | ||
> | ||
{item} | ||
</CustomButton> | ||
); | ||
} | ||
})} | ||
<CustomButton | ||
variant="outline" | ||
className="h-8 w-8 border-primary bg-primary/30" | ||
isDisabled={true} | ||
> | ||
{currentPage} | ||
</CustomButton> | ||
{after.map((item, index) => { | ||
if (item) | ||
return ( | ||
<CustomButton | ||
key={index} | ||
variant="outline" | ||
className={`h-8 w-8`} | ||
onClick={() => setCurrentPage(item)} | ||
isDisabled={isloading} | ||
> | ||
{item} | ||
</CustomButton> | ||
); | ||
})} | ||
</div> | ||
<div className="flex w-full max-w-[84px] items-center justify-between gap-4"> | ||
<CustomButton | ||
className="h-8 w-8 p-0" | ||
variant="outline" | ||
isDisabled={currentPage === 1 || isloading} | ||
onClick={() => setCurrentPage((previous) => previous - 1)} | ||
> | ||
<ChevronLeft className="h-5 w-5 text-neutral-dark-1" /> | ||
</CustomButton> | ||
<CustomButton | ||
variant="outline" | ||
className="h-8 w-8 p-0" | ||
isDisabled={currentPage === totalPage || isloading} | ||
onClick={() => setCurrentPage((previous) => previous + 1)} | ||
> | ||
<ChevronRight className="h-5 w-5 text-neutral-dark-1" /> | ||
</CustomButton> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Pigination; |
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
24 changes: 24 additions & 0 deletions
24
...oard/(admin)/admin/email/generate-with-html/_components/generate-field/generate-field.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,24 @@ | ||
"use client"; | ||
|
||
import { useRouter } from "next/navigation"; | ||
|
||
import CustomInput from "~/components/common/input/input"; | ||
|
||
const GenerateField = () => { | ||
const router = useRouter(); | ||
return ( | ||
<div className="mb-6 w-full max-w-[666px]"> | ||
<CustomInput | ||
label="HTML Link" | ||
placeholder="Enter your link here" | ||
isButtonVisible={true} | ||
buttonContent="Generate" | ||
onButtonClick={() => | ||
router.push("/admin/email/generate-with-html/preview-template") | ||
} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default GenerateField; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const useGeneratePagesNumbers = (currentPage: number, totalPage: number) => { | ||
const before = []; | ||
const after = []; | ||
|
||
for (let index = 2; index >= 1; index--) { | ||
if (currentPage - index > 0) { | ||
before.push(currentPage - index); | ||
} | ||
} | ||
|
||
for (let index = 1; index <= 2; index++) { | ||
if (currentPage + index <= totalPage) { | ||
after.push(currentPage + index); | ||
} | ||
} | ||
|
||
return { before, after }; | ||
}; | ||
|
||
export default useGeneratePagesNumbers; |