Skip to content

refactor(frontend): rabbit-review #55

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

Merged
merged 3 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/components/Community/hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const Hero: React.FC<IHero> = ({ heroData }) => {
src={background.url}
alt="Hero Image Background"
fill
priority
className="absolute left-0 top-0 z-[-1] h-full object-cover"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const LearnMore: React.FC<CooperativeLearnMoreSection> = ({
src={background.url}
alt="Learn more Image Background"
fill
priority
className="rounded-2xl object-cover"
/>
</div>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/Cooperative/hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const Hero: React.FC<IHero> = ({ heroData }) => {
src={background.url}
alt="Hero Image Background"
fill
priority
className="absolute left-0 top-0 z-[-1] h-full object-cover"
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Dropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const Dropdown: React.FC<IDropwdownProps> = ({ items, value, onChange }) => {
<div
className={clsx(
"absolute z-10 mt-2 rounded-2xl border border-stroke bg-background-1",
"flex max-h-[300px] w-[200px] flex-col gap-4 p-[10px] md:w-[348px]",
"flex max-h-[300px] w-[200px] flex-col gap-4 overflow-auto p-[10px] md:w-[348px]",
isOpen ? "visible" : "hidden",
)}
>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/Earn/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const Hero: React.FC<IHero> = ({ heroData }) => {
src={background.url}
alt="Hero Image Background"
fill
priority
className="absolute left-0 top-0 z-[-1] h-full object-cover"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const KlerosScoutSection: React.FC<IKlerosScoutSection> = ({
<Image
width={128}
height={128}
priority
src={productIcon.url}
alt="Product Icon"
/>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/ForBuilders/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const Hero: React.FC<IHero> = ({ heroData }) => {
alt="Hero Image Background"
width="1440"
height="835"
priority
className="absolute left-0 top-0 z-[-1] h-full object-cover object-left"
/>
</div>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/PNKToken/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const Hero: React.FC<IHero> = ({ heroData }) => {
src={background.url}
alt="Hero Image Background"
fill
priority
className="absolute left-0 top-0 z-[-1] h-full object-cover"
/>
</div>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const Pagination: React.FC<IPagination> = ({
{Array.from(Array(numPages), (_, index) => (
<button
key={index}
aria-label={`Go to page ${index + 1}`}
aria-current={currentPage === index + 1 ? "page" : undefined}
className={clsx(
"h-4 w-4 rounded-full transition-all",
currentPage === index + 1
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/ResearchDevelopment/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const Hero: React.FC<IHero> = ({ heroData }) => {
src={background.url}
alt="Hero Image Background"
fill
priority
className="absolute left-0 top-0 z-[-1] h-full object-cover"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Testimonials: React.FC<{ testimonials: Testimonial[] }> = ({
itemsPerPage * (page - 1),
Math.min(testimonials.length, itemsPerPage * page),
),
[itemsPerPage, page],
[testimonials, itemsPerPage, page],
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ const KlerosBook: React.FC<IKlerosBook> = ({
)}
>
<div className="max-w-457 relative h-[536px] w-full flex-shrink-0 lg:h-[717px] lg:w-[457px]">
<Image src={bookCover.url} alt="Book Cover" fill className="!w-fit" />
<Image
src={bookCover.url}
alt="Book Cover"
fill
priority
className="!w-fit"
/>
</div>
<div className="space-y-16">
<div className="space-y-6">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ interface IPublicationCard {
const PublicationCard: React.FC<IPublicationCard> = ({ publication }) => {
return (
<div className="flex flex-col items-start rounded-2xl border border-stroke p-6">
{(publication as TeamPublication)?.authors ? (
{isTeamPublication(publication) ? (
<>
<h2 className="mb-6 text-xl font-medium text-primary-text">
{publication.topic}
</h2>
<p className="mb-8 text-secondary-text">
{(publication as TeamPublication).authors}
</p>
<p className="mb-8 text-secondary-text">{publication.authors}</p>
</>
) : (
<p className="mb-8 text-secondary-text">{publication.topic}</p>
Expand All @@ -36,3 +34,9 @@ const PublicationCard: React.FC<IPublicationCard> = ({ publication }) => {
);
};
export default PublicationCard;

function isTeamPublication(
publication: TeamPublication | ThirdPartyPublication,
): publication is TeamPublication {
return "authors" in publication;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const TeamPublications: React.FC<{ teamPublications: TeamPublication[] }> = ({
itemsPerPage * (page - 1),
Math.min(teamPublications.length, itemsPerPage * page),
),
[itemsPerPage, page],
[teamPublications, itemsPerPage, page],
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ThirdPartyPublications: React.FC<{
itemsPerPage * (page - 1),
Math.min(thirdPartyPublications.length, itemsPerPage * page),
),
[itemsPerPage, page],
[thirdPartyPublications, itemsPerPage, page],
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ResearchCard: React.FC<Research> = ({ field, icon }) => {
)}
>
<Image src={icon.url} alt="document" width={64} height={64} />
<label className="text-lg text-primary-text">{field}</label>
<p className="text-lg text-primary-text">{field}</p>
</div>
);
};
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/home/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const Hero: React.FC<IHero> = ({ heroData }) => {
alt="Hero Image Background"
width="1440"
height="835"
priority
className="absolute left-0 top-0 z-[-1] h-full object-cover object-left"
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/hooks/useScreenSize.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useEffect, useState } from "react";
type ScreenSize = "sm" | "md" | "lg";

export const useScreenSize = () => {
const [screenSize, setScreenSize] = useState<ScreenSize>();
const [screenSize, setScreenSize] = useState<ScreenSize>("lg");

useEffect(() => {
const handleResize = () => {
Expand Down
21 changes: 21 additions & 0 deletions frontend/src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,27 @@ body {
color: var(--foreground);
background: var(--background);
font-family: Urbanist, Helvetica, sans-serif;

/* scollbar */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background-color: #42498f;
border-radius: 16px;
transition:
opacity 0.15s,
background-color 0.15s,
border-color 0.15s,
width 0.15s;
}

scrollbar-width: thin;
scrollbar-color: #42498f transparent;
}

@layer utilities {
Expand Down