Skip to content

Commit

Permalink
Merge pull request #3 from trickeydan/dgt/hardware-repo-links
Browse files Browse the repository at this point in the history
Add ability to link to hardware repo
  • Loading branch information
hughrawlinson authored Jun 5, 2024
2 parents 5ee61af + 4475bfa commit 0edb59b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions hexpansions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"unique_name": "Demo hexpansion name",
"description": "An example hexpansion description",
"shop_link": "https://example.com",
"hardware_repo": "https://example.com",
"homepage": "https://example.com"
}]
11 changes: 10 additions & 1 deletion src/components/Hexpansion.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const {
homepage,
unique_name,
shop_link,
hardware_repo,
image_url: image_url_prop,
description,
} = Astro.props;
Expand Down Expand Up @@ -41,7 +42,10 @@ const image_url = image_url_prop
/>
)}
<p>{description}</p>
{shop_link ? <a href={shop_link}>Buy</a> : null}
<div class="link-container">
{shop_link ? <a class="link" href={shop_link}>Buy</a> : null}
{hardware_repo ? <a class="link" href={hardware_repo}>Hardware Source</a> : null}
</div>
</article>
)
}
Expand All @@ -62,4 +66,9 @@ const image_url = image_url_prop
a {
color: #aaa;
}
a.link:not(:nth-child(2)) {
border-left: 1px solid white;
margin-left: .7vw !important;
padding-left: .7vw !important;
}
</style>
1 change: 1 addition & 0 deletions src/hexpansion_schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const hexpansion_description = z.object({
homepage: z.optional(z.string()),
description: z.string(),
shop_link: z.optional(z.string()),
hardware_repo: z.optional(z.string().url()),
image_url: z.optional(z.string()),
})

Expand Down

0 comments on commit 0edb59b

Please sign in to comment.