-
Notifications
You must be signed in to change notification settings - Fork 0
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 #7 from Hkaar/animations
Redesigned components
- Loading branch information
Showing
17 changed files
with
214 additions
and
126 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
import { assert, expect, test } from "vitest"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { Suspense } from "react"; | ||
import Home from "../app/(main)/page"; | ||
import { assert, test } from "vitest"; | ||
|
||
// RESERVED!! STILL FINDING A WAY TO FIX RSC NOT RENDERING | ||
// RESERVED FOR THE FUTURE WHEN ASYNC COMPONENTS WORK IN TESTS | ||
// test("Page", async () => { | ||
// render( | ||
// <Suspense> | ||
// <Home /> | ||
// </Suspense>, | ||
// ); | ||
|
||
// await screen.findByRole("heading", {level: 3, name: "About myself"}); | ||
// render(await (async () => await Home())()); | ||
// expect(screen.getByRole("heading", { level: 3, name: "About myself" })) | ||
// .toBeDefined(); | ||
// }); | ||
|
||
test('temp', () => { assert(5 == 5) }) | ||
test('temp', () => { assert( 5 === 5) }) |
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ import ContactForm from "../ContactForm"; | |
import ContactCard from "../Card/ContactCard"; | ||
import SlideRight from "../Transitions/SlideRight"; | ||
import SlideLeft from "../Transitions/SlideLeft"; | ||
import SlideUp from "../Transitions/SlideUp"; | ||
|
||
export default function ContactSection() { | ||
return ( | ||
|
@@ -18,24 +19,32 @@ export default function ContactSection() { | |
</SectionContent> | ||
|
||
<div className="grid grid-cols-1 md:grid-cols-2 gap-3"> | ||
<ContactCard | ||
title="Email" | ||
icon="material-symbols-light:mail-outline" | ||
> | ||
[email protected] | ||
</ContactCard> | ||
<SlideUp> | ||
<ContactCard | ||
title="Email" | ||
icon="material-symbols-light:mail-outline" | ||
> | ||
[email protected] | ||
</ContactCard> | ||
</SlideUp> | ||
|
||
<ContactCard title="Phone number" icon="mdi-light:phone"> | ||
+62 81237102017 | ||
</ContactCard> | ||
<SlideUp delay={1.4}> | ||
<ContactCard title="Phone number" icon="mdi-light:phone"> | ||
+62 81237102017 | ||
</ContactCard> | ||
</SlideUp> | ||
|
||
<ContactCard title="Twitter / X" icon="logos:x"> | ||
@Hkaar5 | ||
</ContactCard> | ||
<SlideUp delay={1.6}> | ||
<ContactCard title="Twitter / X" icon="logos:x"> | ||
@Hkaar5 | ||
</ContactCard> | ||
</SlideUp> | ||
|
||
<ContactCard title="Github" icon="devicon:github"> | ||
Hkaar | ||
</ContactCard> | ||
<SlideUp delay={1.8}> | ||
<ContactCard title="Github" icon="devicon:github"> | ||
Hkaar | ||
</ContactCard> | ||
</SlideUp> | ||
</div> | ||
</div> | ||
</SlideRight> | ||
|
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 |
---|---|---|
@@ -1,72 +1,77 @@ | ||
import { twMerge } from "tailwind-merge"; | ||
import LinkButton from "../LinkButton"; | ||
import { randomUUID } from "crypto"; | ||
|
||
interface PaginationProps extends React.HTMLAttributes<HTMLElement> { | ||
currentId: number; | ||
href: string; | ||
maxId: number; | ||
query?: boolean | ||
query?: boolean; | ||
} | ||
|
||
const generateIds = (id: number, amount: number, maxId: number) => { | ||
const generateIds = (currentId: number, maxId: number) => { | ||
const results: Array<number> = []; | ||
const totalDisplayed = 3; | ||
|
||
Array(amount).keys().forEach(i => { | ||
if ((id + i) < maxId) { | ||
results.push(id + i); | ||
} else { | ||
results.push(id - i) | ||
} | ||
}); | ||
let start = Math.max(1, currentId - Math.floor(totalDisplayed / 2)); | ||
const end = Math.min(maxId, start + totalDisplayed); | ||
|
||
if (end === maxId) { | ||
start = Math.max(1, maxId - totalDisplayed); | ||
} | ||
|
||
for (let i = start; i < end; i++) { | ||
results.push(i); | ||
} | ||
|
||
return results; | ||
}; | ||
|
||
export default function Pagination( | ||
{ currentId, maxId, href, query, ...props }: PaginationProps, | ||
) { | ||
const idList = generateIds(currentId, 5, maxId).toSorted((a, b) => a - b); | ||
const idList = generateIds(currentId, maxId+1); | ||
|
||
return ( | ||
<div className={twMerge("flex items-center gap-2 w-fit", props.className)}> | ||
{currentId > 0 | ||
? ( | ||
<LinkButton | ||
{currentId > 0 && ( | ||
<LinkButton | ||
className="px-3 py-2" | ||
href={`${href}${query ? '?page=' : '/'}${currentId - 1}`} | ||
icon="mdi-light:arrow-left" | ||
> | ||
href={`${href}${query ? "?page=" : "/"}${currentId - 1}`} | ||
icon="mdi-light:arrow-left" | ||
> | ||
<span className="hidden lg:block"> | ||
Previous | ||
</LinkButton> | ||
) | ||
: null} | ||
</span> | ||
</LinkButton> | ||
)} | ||
|
||
{idList.map((id) => ( | ||
<LinkButton | ||
className="px-3 py-2" | ||
key={`paginator-${randomUUID()}`} | ||
href={`${href}${query ? '?page=' : '/'}${id}`} | ||
type="tertiary" | ||
key={`paginator-${id}`} // Use id as key | ||
href={`${href}${query ? "?page=" : "/"}${id}`} | ||
type={id === currentId ? "primary" : "tertiary"} // Highlight current page | ||
> | ||
<span className="px-1"> | ||
<span | ||
className={twMerge("px-1", id === currentId ? "bg-opacity-50" : "")} | ||
> | ||
{id} | ||
</span> | ||
</LinkButton> | ||
))} | ||
|
||
{currentId < maxId | ||
? ( | ||
<LinkButton | ||
className="px-4 py-2" | ||
href={`${href}${query ? '?page=' : '/'}${currentId + 1}`} | ||
icon="mdi-light:arrow-right" | ||
rightIcon | ||
> | ||
{currentId <= maxId - 1 && ( | ||
<LinkButton | ||
className="px-4 py-2" | ||
href={`${href}${query ? "?page=" : "/"}${currentId + 1}`} | ||
icon="mdi-light:arrow-right" | ||
rightIcon | ||
> | ||
<span className="hidden lg:block"> | ||
Next | ||
</LinkButton> | ||
) | ||
: null} | ||
</span> | ||
</LinkButton> | ||
)} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.