Skip to content

Commit

Permalink
refactor(portfolio): hide the portfolio if there are no items
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusjrcavalcanti committed Aug 18, 2024
1 parent 06d0042 commit 0e4feab
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 43 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"project": "./tsconfig.json"
},
"rules": {
"import/prefer-default-export": "off"
"import/prefer-default-export": "off",
"@next/next/no-img-element": "off",
"react/require-default-props": "off"
}
}
47 changes: 8 additions & 39 deletions src/app/(homepage)/_components/Portfolio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,14 @@ import {
import { Card, CardContent } from "@/components/ui/card";
import { type CarouselApi } from "@/components/ui/carousel";

export function Portfolio() {
const items = [
{
index: 0,
imgSrc: "/team.jpg",
title: "Projeto 1",
description:
"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout...",
},
{
index: 1,
imgSrc: "/team.jpg",
title: "Projeto 2",
description:
"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout...",
},
{
index: 2,
imgSrc: "/team.jpg",
title: "Projeto 3",
description:
"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search",
},
{
index: 3,
imgSrc: "/team.jpg",
title: "Projeto 4",
description:
"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search",
},
{
index: 4,
imgSrc: "/team.jpg",
title: "Projeto 5",
description:
"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search",
},
// Adicione mais projetos conforme necessário
];
export interface PortfolioItem {
index: number;
imgSrc: string;
title: string;
description: string;
}

export function Portfolio({ items }: { items?: PortfolioItem[] }) {
// Estados para controlar o item ativo em cada carrossel
// Sim, tem dois carroseis mas você só vê um, processe 2 veja um :D
const [activeIndexMobile, setActiveIndexMobile] = useState(0);
Expand Down Expand Up @@ -111,6 +79,7 @@ export function Portfolio() {

const activeIndex = isDesktop ? activeIndexDesktop : activeIndexMobile;

if (!items || !items.length) return <div />;
return (
<section className="flex h-auto w-full flex-col items-center justify-center bg-blue-900 p-4 px-2 font-primary text-white-100 sm:px-4 lg:h-screen lg:items-start lg:px-4 xl:px-28 2xl:px-44">
<h2 className="decorated-border mt-16 w-full px-4 text-start text-3xl font-bold md:text-4xl">
Expand Down
5 changes: 2 additions & 3 deletions src/app/(homepage)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { About } from "./_components/About";
import { About } from "./_components/About";
import { Contact } from "./_components/Contact";
import { Header } from "./_components/Header";
import { Portfolio } from "./_components/Portfolio";
Expand All @@ -16,5 +16,4 @@ export default function Home() {
</main>
</>
);
}

}

0 comments on commit 0e4feab

Please sign in to comment.