cozy/src/components/AddressBar.astro
2023-06-04 21:35:42 +02:00

82 lines
1.5 KiB
Text

---
import Form, { FormGroup } from "@astro-reactive/form";
import { Validators } from "@astro-reactive/validator";
export interface Props {
url: string;
}
const { url } = Astro.props;
const form = new FormGroup([
{
name: "url",
value: url,
placeholder: "Put the URL here",
validators: [Validators.required, Validators.minLength(11)],
},
]);
---
<div class="address-bar">
<Form
formGroups={form}
showValidationHints
submitControl={{
type: "submit",
name: "submit",
value: "Get cozy!",
}}
/>
<nav>
<a href="/"
>📚 Library</a
>
<a target="_blank" href="https://github.com/ayoayco/cozy"
>⭐️ GitHub</a
>
<a class="nav-badge" href="https://www.npmjs.com/package/@ayco/cozy"><img alt"NPM Version" src="https://img.shields.io/npm/v/@ayco/cozy?label=alpha&logo=npm" /></a>
</nav>
</div>
<style is:inline>
.address-bar {
background-color:antiquewhite;
text-align: center;
padding: 0.5em;
width: 100%;
}
input {
width: 100%;
text-align: center;
border: 0px;
border-radius: 5px;
padding: 0.5rem;
}
input[type="text"] {
border: 2px solid brown;
}
input[type="submit"] {
width: 150px;
margin-top: 0.5em;
background-color: brown;
color: white;
font-weight: bolder;
}
nav {
margin: 0.5em 0;
}
nav a:hover {
text-decoration: underline;
}
nav a {
color: brown;
text-decoration: none;
}
nav img {
display: inline;
vertical-align: middle;
}
</style>