Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to link to hardware repo #3

Merged
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
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
Loading