Skip to content

Commit

Permalink
Explore Endpoints landing page
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits committed Mar 5, 2024
1 parent 0f7c046 commit 115be09
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 44 deletions.
46 changes: 44 additions & 2 deletions src/app/(sidebar)/explore-endpoints/[[...pages]]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,55 @@
"use client";

import { Routes } from "@/constants/routes";
import { usePathname } from "next/navigation";
import { Card, Icon, Text } from "@stellar/design-system";

import { InfoCards } from "@/components/InfoCards";
import { Routes } from "@/constants/routes";

const infoCards = [
{
id: "soroban-rpc",
title: "RPC Endpoints",
description: "TODO: add text",
buttonLabel: "See docs",
buttonIcon: <Icon.LinkExternal01 />,
buttonAction: () =>
window.open("https://soroban.stellar.org/api/methods", "_blank"),
},
{
id: "horizon",
title: "Horizon Endpoints",
description: "TODO: add text",
buttonLabel: "Go to docs",
buttonIcon: <Icon.LinkExternal01 />,
buttonAction: () =>
window.open(
"https://developers.stellar.org/api/horizon/resources/",
"_blank",
),
},
];

export default function ExploreEndpoints() {
const pathname = usePathname();

if (pathname === Routes.EXPLORE_ENDPOINTS) {
return <div>Endpoints landing</div>;
return (
<>
<Card>
<div className="CardText">
<Text size="lg" as="h1" weight="medium">
Endpoints
</Text>

<Text size="sm" as="p">
TODO: add text
</Text>
</div>
</Card>
<InfoCards infoCards={infoCards} />
</>
);
}

return renderPage(pathname);
Expand Down
28 changes: 3 additions & 25 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"use client";

import { useRouter } from "next/navigation";
import { Card, Link, Text, Button, Icon } from "@stellar/design-system";
import { Card, Link, Text, Icon } from "@stellar/design-system";

import { NextLink } from "@/components/NextLink";
import { LayoutContentContainer } from "@/components/layout/LayoutContentContainer";
import { InfoCards } from "@/components/InfoCards";
import { Routes } from "@/constants/routes";

export default function Introduction() {
Expand Down Expand Up @@ -85,30 +86,7 @@ export default function Introduction() {
</div>
</Card>

<div className="IntroCards">
{infoCards.map((c) => (
<Card key={c.id}>
<Text size="md" as="h2" weight="medium">
{c.title}
</Text>

<Text size="sm" as="p">
{c.description}
</Text>

<div>
<Button
variant="secondary"
size="md"
icon={c.buttonIcon}
onClick={c.buttonAction}
>
{c.buttonLabel}
</Button>
</div>
</Card>
))}
</div>
<InfoCards infoCards={infoCards} />

{/* TODO: add TOS and Privacy */}
</LayoutContentContainer>
Expand Down
32 changes: 32 additions & 0 deletions src/components/InfoCards/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Button, Card, Text } from "@stellar/design-system";
import { InfoCard } from "@/types/types";
import "./styles.scss";

export const InfoCards = ({ infoCards }: { infoCards: InfoCard[] }) => {
return (
<div className="InfoCards">
{infoCards.map((c) => (
<Card key={c.id}>
<Text size="md" as="h2" weight="medium">
{c.title}
</Text>

<Text size="sm" as="p">
{c.description}
</Text>

<div>
<Button
variant="secondary"
size="md"
icon={c.buttonIcon}
onClick={c.buttonAction}
>
{c.buttonLabel}
</Button>
</div>
</Card>
))}
</div>
);
};
18 changes: 18 additions & 0 deletions src/components/InfoCards/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@use "../../styles/utils.scss" as *;

.InfoCards {
display: grid;
gap: pxToRem(12px);
grid-template-columns: 1fr 1fr;

.Card {
display: flex;
flex-direction: column;
gap: pxToRem(8px);
justify-content: space-between;

:nth-child(2) {
flex: 1;
}
}
}
17 changes: 0 additions & 17 deletions src/styles/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -299,20 +299,3 @@
margin-bottom: 0 !important;
}
}

.IntroCards {
display: grid;
gap: pxToRem(12px);
grid-template-columns: 1fr 1fr;

.Card {
display: flex;
flex-direction: column;
gap: pxToRem(8px);
justify-content: space-between;

:nth-child(2) {
flex: 1;
}
}
}
9 changes: 9 additions & 0 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ export type StatusPageScheduled = {
components: StatusPageComponent[];
incident_updates: StatusPageIncident[];
};

export type InfoCard = {
id: string;
title: string;
description: string;
buttonLabel: string;
buttonIcon?: React.ReactNode;
buttonAction: () => void;
};

0 comments on commit 115be09

Please sign in to comment.