diff --git a/components/decohelp/pages/interfaces.ts b/components/decohelp/pages/interfaces.ts
index 3d92a502..da02bce4 100644
--- a/components/decohelp/pages/interfaces.ts
+++ b/components/decohelp/pages/interfaces.ts
@@ -4,7 +4,7 @@ import Image from "deco-sites/std/components/Image.tsx";
import { Section } from "deco/blocks/section.ts";
export interface Props {
- Title: string;
+ Title?: string;
Version?: string;
/** @description Breadcrumb label for the home link */
homeLabel: string;
diff --git a/components/decohelp/pages/ui/Content/Content.tsx b/components/decohelp/pages/ui/Content/Content.tsx
index 625651a5..f16d307d 100644
--- a/components/decohelp/pages/ui/Content/Content.tsx
+++ b/components/decohelp/pages/ui/Content/Content.tsx
@@ -79,9 +79,11 @@ export default function Page({
-
- {Title}
-
+ {Title && (
+
+ {Title}
+
+ )}
{Version && Version.length > 0 && (
{Version}
diff --git a/fresh.gen.ts b/fresh.gen.ts
index aa82cdaf..e23522e7 100644
--- a/fresh.gen.ts
+++ b/fresh.gen.ts
@@ -9,11 +9,10 @@ import * as $3 from "./routes/api/case.tsx";
import * as $4 from "./routes/api/leads.tsx";
import * as $5 from "./routes/api/ranking.ts";
import * as $6 from "./routes/api/webinar.tsx";
-import * as $7 from "./routes/docs/[...slug].tsx";
-import * as $8 from "./routes/gfm.css.ts";
-import * as $9 from "./routes/hackathon4.ts";
-import * as $10 from "./routes/index.tsx";
-import * as $11 from "./routes/proxy/image/index.tsx";
+import * as $7 from "./routes/gfm.css.ts";
+import * as $8 from "./routes/hackathon4.ts";
+import * as $9 from "./routes/index.tsx";
+import * as $10 from "./routes/proxy/image/index.tsx";
import * as $$0 from "./islands/CampHeader.tsx";
import * as $$1 from "./islands/CampMentor.tsx";
import * as $$2 from "./islands/Case.tsx";
@@ -43,11 +42,10 @@ const manifest = {
"./routes/api/leads.tsx": $4,
"./routes/api/ranking.ts": $5,
"./routes/api/webinar.tsx": $6,
- "./routes/docs/[...slug].tsx": $7,
- "./routes/gfm.css.ts": $8,
- "./routes/hackathon4.ts": $9,
- "./routes/index.tsx": $10,
- "./routes/proxy/image/index.tsx": $11,
+ "./routes/gfm.css.ts": $7,
+ "./routes/hackathon4.ts": $8,
+ "./routes/index.tsx": $9,
+ "./routes/proxy/image/index.tsx": $10,
},
islands: {
"./islands/CampHeader.tsx": $$0,
diff --git a/islands/LiveProjects.tsx b/islands/LiveProjects.tsx
index 15017975..3d0b52ef 100644
--- a/islands/LiveProjects.tsx
+++ b/islands/LiveProjects.tsx
@@ -1 +1 @@
-export { default } from "deco-sites/starting/sections/Live Projects/ProjectsGrid.tsx";
\ No newline at end of file
+export { default } from "deco-sites/starting/sections/Live Projects/ProjectsGrid.tsx";
diff --git a/loaders/denoLoader.ts b/loaders/denoLoader.ts
index 2e1cef9e..e90e4c3e 100644
--- a/loaders/denoLoader.ts
+++ b/loaders/denoLoader.ts
@@ -1,5 +1,6 @@
import { MDFileContent } from "deco-sites/starting/components/ui/Types.tsx";
import type { LoaderContext } from "deco/types.ts";
+import { redirect } from "deco/mod.ts";
/** @title {{{path}}} */
export interface Doc {
@@ -21,6 +22,14 @@ const loader = async (
const documentSlug = rest.join("/");
const path = props.docsPath ?? "docs";
+ if (documentSlug === "") {
+ const returnUrl = new URL(_req.url);
+ returnUrl.pathname = `/${path}/${language}/overview`;
+ return redirect(returnUrl.href, 307) as unknown as ReturnType<
+ typeof loader
+ >; // redirect, component won't be resolved, so don't need the data;
+ }
+
const url = new URL(
`../${path}/${documentSlug}/${language}.md`,
import.meta.url,
diff --git a/routes/docs/[...slug].tsx b/routes/docs/[...slug].tsx
deleted file mode 100644
index 481441b9..00000000
--- a/routes/docs/[...slug].tsx
+++ /dev/null
@@ -1,306 +0,0 @@
-// Copied mostly from: https://github.com/denoland/fresh/blob/744a10e5911df38bff779686c86ca10fb4589dfe/www/routes/docs/%5B...slug%5D.tsx
-import { Head } from "$fresh/runtime.ts";
-import { Handlers, PageProps } from "$fresh/server.ts";
-import {
- frontMatter,
- gfm,
-} from "deco-sites/starting/components/utils/markdown.ts";
-
-import DocsTitle from "deco-sites/starting/components/ui/docs/DocsTitle.tsx";
-import { TableOfContentsEntry } from "deco-sites/starting/components/ui/docs/docs.ts";
-import DocsSidebar from "../../components/ui/docs/DocsSidebar.tsx";
-import Footer from "../../sections/Footer.tsx";
-import {
- getMenuDataForLanguage,
- getNextAndPreviousPost,
- getTitleForPost,
- MenuData,
-} from "../../docs/toc.ts";
-import NewLandingHeader from "../../components/ui/docs/NewLandingHeader.tsx";
-import Header from "../../sections/Header.tsx";
-
-interface Data {
- page: Page;
-}
-
-interface Page extends Pick {
- markdown: string;
- data: Record;
- menu: MenuData;
- language: string;
-}
-
-export const handler: Handlers = {
- async GET(req, ctx) {
- const reqUrl = new URL(req.url);
-
- const slug = ctx.params.slug;
- const [language, ...rest] = slug.split("/");
-
- if (!rest?.length) {
- return new Response(null, {
- status: 307,
- headers: {
- location: `/docs/${language || "en"}/overview`,
- },
- });
- }
-
- const documentSlug = rest.join("/");
-
- try {
- const url = new URL(
- `../../docs/${documentSlug}/${language}.md`,
- import.meta.url,
- );
-
- const fileContent = await Deno.readTextFile(url);
- const { body, attrs } = frontMatter>(fileContent);
-
- const menu = getMenuDataForLanguage(language as "pt" | "en");
-
- const title = getTitleForPost(language as "en", documentSlug) ||
- "Document";
-
- const page = {
- markdown: body,
- data: attrs ?? {},
- slug: documentSlug,
- title,
- href: reqUrl.pathname,
- language,
- menu,
- };
- const resp = ctx.render({ page });
- return resp;
- } catch (err) {
- return ctx.renderNotFound();
- }
- },
-};
-
-export default function DocsPage(props: PageProps) {
- let description;
-
- const lang = props.data.page.language;
- const languageLink = props.url.pathname.replaceAll(
- "/" + props.data.page.language + "/",
- `/${props.data.page.language === "en" ? "pt" : "en"}/`,
- );
-
- if (props.data.page.data.description) {
- description = String(props.data.page.data.description);
- }
-
- return (
- <>
-
- {props.data.page?.title ?? "Not Found"} | deco.cx docs
-
- {description && }
-
-
-
-
-
-
-
- {/* Fix mobile sidebar */}
-
-
-
- {/* Desktop Sidebar */}
-
-
-
-
-
-
- >
- );
-}
-
-function Content(props: { page: Page }) {
- const _html = gfm.render(props.page.markdown, { allowIframes: true });
- const html = _html.replaceAll(
- /( href="https:\/\/(?!www.deco)).*?/g,
- ' target="_blank"$1',
- );
-
- return (
-
-
- {props.page.data.since && (
-
- Version: {props.page.data.since}
-
- )}
-
-
-
- );
-}
-
-const button = "p-2 bg-gray-100 w-full border border-gray-200 grid";
-
-function ForwardBackButtons(props: { slug: string; language: string }) {
- const nextLabel = props.language === "en" ? "Next" : "Próximo";
- const previousLabel = props.language === "en" ? "Previous" : "Anterior";
-
- const { next, previous } = getNextAndPreviousPost(
- props.language as "en",
- props.slug,
- );
- const upper = "text-sm text-gray-600";
- const category = "font-normal";
- const lower = "text-gray-900 font-medium";
-
- return (
-
- );
-}
diff --git a/sections/Live Projects/Hero.tsx b/sections/Live Projects/Hero.tsx
index d7ec6917..7819662f 100644
--- a/sections/Live Projects/Hero.tsx
+++ b/sections/Live Projects/Hero.tsx
@@ -3,37 +3,36 @@ import type { Image as DecoImage } from "deco-sites/std/components/types.ts";
/** @title {{{title}}} - {{{href}}} */
export interface Props {
- Banner?:{
+ Banner?: {
bannerHero?: DecoImage;
bannerHeroMobile?: DecoImage;
titleImg?: string;
- }
+ };
headline?: string;
headlineSubtitle?: string;
- ctaButtons?:{
+ ctaButtons?: {
titleGreenButton?: string;
hrefGreenButton?: string;
titleWhiteButton?: string;
hrefWhiteButton?: string;
- }
+ };
}
export default function Hero({
Banner = {
- bannerHero: "",
- bannerHeroMobile: "",
- titleImg:"Escolha uma Imagem",
+ bannerHero: "",
+ bannerHeroMobile: "",
+ titleImg: "Escolha uma Imagem",
},
headline = "Live Projects",
headlineSubtitle =
"Com mais de 100 implementações bem-sucedidas só no Brasil, a deco.cx é a plataforma de Frontend que você precisa para levar seu site ao próximo nível. Seja B2B ou B2C, nossa solução é comprovada no mercado para oferecer uma experiência de compra excepcional!",
ctaButtons = {
- titleGreenButton: "Agende uma demo",
+ titleGreenButton: "Agende uma demo",
hrefGreenButton: "",
- titleWhiteButton: "Customer Stories",
+ titleWhiteButton: "Customer Stories",
hrefWhiteButton: "",
- }
-
+ },
}: Props) {
return (
diff --git a/sections/Live Projects/ProjectsGrid.tsx b/sections/Live Projects/ProjectsGrid.tsx
index fb39eb51..af64bd86 100644
--- a/sections/Live Projects/ProjectsGrid.tsx
+++ b/sections/Live Projects/ProjectsGrid.tsx
@@ -21,7 +21,6 @@ export interface Template {
image?: Screenshot[];
}
-
export interface TemplateInfo {
label?: string;
category?: string;
@@ -68,25 +67,43 @@ function CardText(
)}
{description && (
-
)}
-
);
}
function TemplatesGrid(props: Props) {
const id = `category-cards-${useId()}`;
const {
- indexCategories = ['Todos','Fashion', 'PET', 'Farma', 'B2B', 'Saúde', 'Outros'],
+ indexCategories = [
+ "Todos",
+ "Fashion",
+ "PET",
+ "Farma",
+ "B2B",
+ "Saúde",
+ "Outros",
+ ],
cards = [
{
label: "Feminino",
@@ -101,31 +118,31 @@ function TemplatesGrid(props: Props) {
},
],
layoutCategoryCard = {
- textPosition: "top",
- textAlignment: "center",
+ textPosition: "top",
+ textAlignment: "center",
},
} = props;
const [themes, setThemes] = useState(cards.map(() => 0));
const [classification, setClassification] = useState
({
- categoriaSelecionada: 'Todos',
+ categoriaSelecionada: "Todos",
paginaAtual: 1,
itensPorPagina: 6,
});
- const [mostrarCardsOutrasCategorias, setMostrarCardsOutrasCategorias] = useState(false);
+ const [mostrarCardsOutrasCategorias, setMostrarCardsOutrasCategorias] =
+ useState(false);
const handleChangeCategoria = (novaCategoria: string) => {
- if (novaCategoria === 'Outros') {
- console.log('Clicou em Outros');
+ if (novaCategoria === "Outros") {
+ console.log("Clicou em Outros");
setClassification({
categoriaSelecionada: novaCategoria,
paginaAtual: 1,
itensPorPagina: classification.itensPorPagina,
- });
+ });
setMostrarCardsOutrasCategorias(true);
- }
- else{
+ } else {
setClassification({
categoriaSelecionada: novaCategoria,
paginaAtual: 1,
@@ -145,29 +162,36 @@ function TemplatesGrid(props: Props) {
const { categoriaSelecionada, paginaAtual, itensPorPagina } = classification;
- const itensFiltrados = mostrarCardsOutrasCategorias
- ? cards.filter(item => item.category && !indexCategories.includes(item.category))
- : (categoriaSelecionada === 'Todos'
+ const itensFiltrados = mostrarCardsOutrasCategorias
+ ? cards.filter((item) =>
+ item.category && !indexCategories.includes(item.category)
+ )
+ : (categoriaSelecionada === "Todos"
? cards
- : cards.filter(item => item.category === categoriaSelecionada)
- );
+ : cards.filter((item) => item.category === categoriaSelecionada));
const totalPaginas = Math.ceil(itensFiltrados.length / itensPorPagina);
const primeiroItem = (paginaAtual - 1) * itensPorPagina;
- const ultimoItem = Math.min(primeiroItem + itensPorPagina, itensFiltrados.length);
+ const ultimoItem = Math.min(
+ primeiroItem + itensPorPagina,
+ itensFiltrados.length,
+ );
const itensPaginaAtual = itensFiltrados.slice(primeiroItem, ultimoItem);
return (
-
-