|
| 1 | +# ToolsUtilitiesGrid |
| 2 | + |
| 3 | +## What it does |
| 4 | + |
| 5 | +This component displays a grid of clickable cards that showcase tools and utilities. Each card includes an icon, title, description, and link. It's perfect for creating a visual directory of resources, tools, or utilities that users can browse and click through to. |
| 6 | + |
| 7 | +## How to use it |
| 8 | + |
| 9 | +1. Import the component in your Astro layout or page: |
| 10 | + |
| 11 | +```astro |
| 12 | +import ToolsUtilitiesGrid from "~/components/ToolsUtilitiesGrid/ToolsUtilitiesGrid.astro" |
| 13 | +``` |
| 14 | + |
| 15 | +2. Create an array of links with the information for each tool/utility you want to display |
| 16 | + |
| 17 | +3. Add the component to your page and pass in the links: |
| 18 | + |
| 19 | +```astro |
| 20 | +<ToolsUtilitiesGrid links={yourLinksArray} /> |
| 21 | +``` |
| 22 | + |
| 23 | +## Example |
| 24 | + |
| 25 | +Here's a complete example showing how to use the component: |
| 26 | + |
| 27 | +```astro |
| 28 | +--- |
| 29 | +import ToolsUtilitiesGrid from "~/components/ToolsUtilitiesGrid/ToolsUtilitiesGrid.astro" |
| 30 | +
|
| 31 | +const toolsAndUtilities = [ |
| 32 | + { |
| 33 | + image: "/images/ccip-logo.svg", |
| 34 | + imageAlt: "CCIP API icon", |
| 35 | + label: "CCIP API", |
| 36 | + link: "/ccip/api", |
| 37 | + description: "An API for message retrieval and lane latency information.", |
| 38 | + }, |
| 39 | + { |
| 40 | + image: "/images/js-logo.svg", |
| 41 | + imageAlt: "JavaScript SDK icon", |
| 42 | + label: "Javascript SDK", |
| 43 | + link: "https://github.com/smartcontractkit/ccip-javascript-sdk", |
| 44 | + description: "Integrate CCIP functionality directly into your web applications for EVM-compatible chains.", |
| 45 | + }, |
| 46 | + { |
| 47 | + image: "/images/hardhat-logo.svg", |
| 48 | + imageAlt: "Hardhat icon", |
| 49 | + label: "Hardhat Starter Kit", |
| 50 | + link: "https://github.com/smartcontractkit/hardhat-starter-kit", |
| 51 | + description: |
| 52 | + "Ready-to-go boilerplate for basic CCIP use cases that help you get started building quickly with Hardhat.", |
| 53 | + }, |
| 54 | +] |
| 55 | +--- |
| 56 | +
|
| 57 | +<ToolsUtilitiesGrid links={toolsAndUtilities} /> |
| 58 | +``` |
| 59 | + |
| 60 | +## What you need to provide |
| 61 | + |
| 62 | +Each item in your `links` array needs these fields: |
| 63 | + |
| 64 | +| Field | What it is | Example | |
| 65 | +| --------------- | ----------------------------------------------------------- | -------------------------------------------------------------- | |
| 66 | +| **image** | The full path to the icon/logo image | `"/images/ccip-logo.svg"` | |
| 67 | +| **imageAlt** | Description of the image for accessibility | `"CCIP API icon"` | |
| 68 | +| **label** | The title/name of the tool or utility | `"CCIP API"` | |
| 69 | +| **link** | Where the card should link to (can be internal or external) | `"/ccip/api"` or `"https://github.com/..."` | |
| 70 | +| **description** | A short description explaining what the tool does | `"An API for message retrieval and lane latency information."` | |
| 71 | + |
| 72 | +## Where to put images |
| 73 | + |
| 74 | +Place your icon/logo images in the `/public/images/` directory, and reference them with the full path starting with `/images/`. |
| 75 | + |
| 76 | +For example, if you use `image: "/images/my-tool-logo.svg"`, the actual file should be at: |
| 77 | + |
| 78 | +``` |
| 79 | +/public/images/my-tool-logo.svg |
| 80 | +``` |
| 81 | + |
| 82 | +You can also use images from other locations by providing the full path (e.g., `"/assets/logos/my-logo.png"`). |
0 commit comments