Change input on Index.astro to Input component, add defaultStyles prop.
This commit is contained in:
parent
760e1b8ec8
commit
7a39f24182
2 changed files with 32 additions and 25 deletions
|
|
@ -1,11 +1,13 @@
|
||||||
---
|
---
|
||||||
const { inputName, defaultTextContent, height, placeholder } = Astro.props;
|
const { inputName, defaultTextContent, height, placeholder, className, defaultStyles = true } = Astro.props;
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
inputName: string;
|
inputName: string;
|
||||||
defaultTextContent?: string;
|
defaultTextContent?: string;
|
||||||
height: string;
|
height: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
className?: string;
|
||||||
|
defaultStyles?: boolean;
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -15,23 +17,27 @@ interface Props {
|
||||||
placeholder={placeholder || ""}
|
placeholder={placeholder || ""}
|
||||||
value={defaultTextContent || ""}
|
value={defaultTextContent || ""}
|
||||||
type="text"
|
type="text"
|
||||||
|
class={className}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<style>
|
{defaultStyles && <style>
|
||||||
input {
|
input {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: 2px solid var(--background-highlight);
|
border: 2px solid var(--background-highlight);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background-color: var(--accent-color);
|
background-color: var(--accent-color);
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
transition: 0.1s ease-in-out;
|
transition: 0.1s ease-in-out;
|
||||||
}
|
}
|
||||||
input::placeholder {
|
input::placeholder {
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
}
|
}
|
||||||
input:focus {
|
input:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
border: 2px solid var(--text-color);
|
border: 2px solid var(--text-color);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import Layout from "../../layouts/Layout.astro";
|
||||||
import { STATIC_PATHS, i18n } from "@i18n/utils";
|
import { STATIC_PATHS, i18n } from "@i18n/utils";
|
||||||
import Link from "@components/UI/Link.astro";
|
import Link from "@components/UI/Link.astro";
|
||||||
import ProxyRegistrar from "@components/ProxyRegistrar.astro";
|
import ProxyRegistrar from "@components/ProxyRegistrar.astro";
|
||||||
|
import Input from "@components/UI/Input.astro";
|
||||||
const t = i18n.inferLangUseTranslations(Astro.url);
|
const t = i18n.inferLangUseTranslations(Astro.url);
|
||||||
|
|
||||||
export function getStaticPaths() {
|
export function getStaticPaths() {
|
||||||
|
|
@ -16,12 +17,12 @@ export function getStaticPaths() {
|
||||||
<h1 class="title-text">{t("menu.welcome")}</h1>
|
<h1 class="title-text">{t("menu.welcome")}</h1>
|
||||||
<div class="form-wrapper">
|
<div class="form-wrapper">
|
||||||
<form class="url-input-form" id="url-input-form">
|
<form class="url-input-form" id="url-input-form">
|
||||||
<input
|
<Input
|
||||||
class="url-input"
|
className="url-input"
|
||||||
id="url-input"
|
inputName="url-input"
|
||||||
type="text"
|
height="50px"
|
||||||
placeholder={t("menu.search")}
|
placeholder={t("menu.search")}
|
||||||
autocomplete="off"
|
defaultStyles={false}
|
||||||
/>
|
/>
|
||||||
<div id="search-suggestions"></div>
|
<div id="search-suggestions"></div>
|
||||||
<div id="loading-content">Loading...</div>
|
<div id="loading-content">Loading...</div>
|
||||||
|
|
@ -145,7 +146,7 @@ export function getStaticPaths() {
|
||||||
addEventListeners();
|
addEventListeners();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style is:global>
|
||||||
.main-content {
|
.main-content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 50px;
|
margin-top: 50px;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue