Skip to content
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
Binary file added public/images/ccip/ccip-hero-bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/ccip/ccip-hero.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions src/components/LayoutHero/LayoutHero.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
import { buttonVariants, Typography } from "@chainlink/blocks"
import styles from "./LayoutHero.module.css"

interface Props {
title: string
description: string
buttons: Array<{
label: string
link: string
}>
image: string
}

const { title, description, buttons = [], image } = Astro.props as Props
---

<section class={styles.layoutHero}>
<div class={styles.heroContentWrapper}>
<div class={styles.heroContent}>
<h2 class={styles.heroTitle}>{title}</h2>
<Typography variant="body-s" color="muted">{description}</Typography>
<div class={styles.heroButtons}>
{
buttons.map((button, index) => (
<a
href={button.link}
class={buttonVariants({
variant: index === 0 ? "primary" : "tertiary",
size: "sm",
})}
>
{button.label}
</a>
Comment on lines +26 to +34

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be using a block button?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way that they look to be used in the UI is as links. Being semantically correct, should we not use anchors with button styling (for navigating) rather than buttons? I think doing would be inconsequential compared to doing it this way. let me know what you think

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you said is actually correct, but the solution for that is different.

The "button component" as an "asChild" property, that will allow it to use the Child element: https://blocks.chain.link/?path=/docs/blocks-button--docs

So for example if I do

<BlockButton asChild><a></a></BlockButton>

It will not render the Button but just apply the style to the Anchor tag!

(this is a common practice also in shadCn)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! That results in less code too so I will do it that way

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bug with the component where it won't render when using asChild because of returning multiple react children. Tried to briefly troubleshoot, but even their example doesn't work

))
}
</div>
</div>
<div class={styles.heroImage}>
<img src={image} alt={title} />
</div>
</div>

<img class={styles.heroBackgroundImg} src="/images/ccip/ccip-hero-bg.png" />
</section>
64 changes: 64 additions & 0 deletions src/components/LayoutHero/LayoutHero.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
.layoutHero {
display: flex;
flex-direction: column;
gap: var(--space-8x);
margin: 0 auto;
background-color: var(--gray-100);
position: relative;
width: 100%;
height: 345px;
border-left: 1px solid var(--border);
border-right: 1px solid var(--border);
border-bottom: 1px solid var(--border);
}

.heroContent {
display: flex;
flex-direction: column;
padding-left: 55px;
width: 100%;
height: 100%;
justify-content: center;
max-width: 540px;
}

.heroContentWrapper {
display: flex;
position: relative;
z-index: 2;
width: 100%;
height: 100%;
}

.heroBackgroundImg {
position: absolute;
right: 0;
z-index: 1;
}
.heroTitle {
font-size: 3rem;
line-height: 50px;
color: var(--gray-950);
margin-bottom: var(--space-3x);
letter-spacing: -0.48px;
font-weight: 400;
}

.heroButtons {
display: flex;
flex-wrap: wrap;
gap: var(--space-4x);
margin-top: var(--space-8x);
}

.heroImage {
display: flex;
position: absolute;
bottom: 35px;
right: 0;
}

.heroImage img {
max-width: 100%;
height: auto;
}
84 changes: 84 additions & 0 deletions src/components/LayoutHero/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# LayoutHero Component

## What is it?

The LayoutHero component is a reusable hero section that displays a title, description, call-to-action buttons, and an optional image. It's perfect for landing pages or the top of important pages where you want to grab attention and guide users to take action.

## How to Use It

### Basic Usage

To use the LayoutHero component in your page, you'll need to import it and provide some information:

```astro
---
import { LayoutHero } from "@components"
---

<LayoutHero
title="Welcome to Our Documentation"
description="Learn how to build amazing applications with our platform"
buttons={[
{ label: "Get Started", link: "/quickstart" },
{ label: "View Documentation", link: "/docs" },
]}
image="/images/hero-image.png"
/>
```

### What Each Part Does

**title** (Required)

- This is the main heading that appears at the top
- Make it clear and attention-grabbing
- Example: "Welcome to Chainlink Docs"

**description** (Required)

- A short paragraph explaining what this page or section is about
- Keep it concise but informative
- Example: "Learn how to connect your smart contracts to real-world data"

**buttons** (Required)

- An array of buttons that link to other pages
- Each button needs two things:
- `label`: The text shown on the button
- `link`: Where the button takes you when clicked
- The first button will be blue (primary action)
- The second button will be white (secondary action)
- You can have 0, 1, or 2 buttons

**image** (Required)

- The path to an image file you want to display
- The image appears on the right side on larger screens
- Below the text on mobile devices
- Example: "/images/my-hero-image.png"

## Examples

### With Only One Button

```astro
<LayoutHero
title="Start Building Today"
description="Get started with our comprehensive guides and tutorials"
buttons={[{ label: "Get Started", link: "/quickstart" }]}
/>
```

### With Image and Two Buttons

```astro
<LayoutHero
title="CCIP Cross-Chain Protocol"
description="Send tokens and messages across blockchains securely and reliably"
buttons={[
{ label: "Try CCIP", link: "/ccip/getting-started" },
{ label: "Learn More", link: "/ccip/concepts" },
]}
image="/images/ccip-hero.png"
/>
```
3 changes: 3 additions & 0 deletions src/components/LeftSidebar/leftSidebar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ details[open] > .navGroupTitle {

.quickLinks {
margin-top: 60px;
display: flex;
flex-direction: column;
gap: var(--space-2x);
}

.headerLink {
Expand Down
15 changes: 10 additions & 5 deletions src/layouts/DocsV3Layout/DocsV3Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as CONFIG from "~/config"
import LeftSidebar from "~/components/LeftSidebar/LeftSidebar.astro"
import PageContent from "~/components/PageContent/PageContent.astro"
import { TabGrid } from "~/components/TabGrid/TabGrid"
import LayoutHero from "~/components/LayoutHero/LayoutHero.astro"

interface Props {
frontmatter: BaseFrontmatter
Expand Down Expand Up @@ -134,6 +135,15 @@ const exampleTutorials = [
<LeftSidebar currentPage={currentPage} section={frontmatter.section} />
</aside>
<div id="grid-main">
<LayoutHero
title="Build with CCIP"
description="CCIP makes it simple to move data, messages, and tokens across blockchains. Connect smart contracts on different networks as if they were one system, whether transferring stablecoins, powering cross-chain apps, or running multi-chain DeFi."
buttons={[
{ label: "Get the SDK", link: "#" },
{ label: "API Doc", link: "#" },
]}
image="/images/ccip/ccip-hero.png"
/>
<PageContent {titleHeading}>
<TabGrid header="Tutorials" client:visible tabs={exampleTutorials} />
<slot />
Expand Down Expand Up @@ -181,11 +191,6 @@ const exampleTutorials = [
max-width: 1505px;
}

#grid-left,
#left-bg {
background: #fafbfd;
}

#grid-left,
#grid-right {
display: flex;
Expand Down
4 changes: 2 additions & 2 deletions src/styles/index.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
/*
* Global styles and CSS variables
*
*
* This file contains:
* 1. CSS reset and base styles
* 2. Global CSS variables for theming
Expand Down
Loading