refactor: summarized components in FormElements
This commit is contained in:
1 parent
b97e5ea7bb
commit
9aa5443229
3 files changed
+20
-10
No files matched your search
+5
-5
@@ -4,7 +4,7 @@ import { uploadCSVAction } from "./actions";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import Card from "@/components/Card"
|
||||
import Textfield from "@/components/Textfield";
|
||||
import { Input } from "@/components/FormElements";
|
||||
|
||||
interface Songbook {
|
||||
id: number;
|
||||
@@ -122,7 +122,7 @@ export default function AdminPage() {
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-neutral-400 uppercase tracking-wider mb-1.5">Name des Buchs</label>
|
||||
<Textfield
|
||||
<Input.Text
|
||||
type="text"
|
||||
placeholder="z.B. Gesangbuch"
|
||||
value={newBookName}
|
||||
@@ -131,7 +131,7 @@ export default function AdminPage() {
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-neutral-400 uppercase tracking-wider mb-1.5">Sprache (Optional)</label>
|
||||
<Textfield
|
||||
<Input.Text
|
||||
type="text"
|
||||
placeholder="z.B. Deutsch"
|
||||
value={newBookLanguage}
|
||||
@@ -167,7 +167,7 @@ export default function AdminPage() {
|
||||
<div className="grid grid-cols-3 gap-2">
|
||||
<div className="col-span-1">
|
||||
<label className="block text-xs font-semibold text-neutral-400 uppercase tracking-wider mb-1.5">Nummer</label>
|
||||
<Textfield
|
||||
<Input.Text
|
||||
type="text"
|
||||
placeholder="12a"
|
||||
value={number}
|
||||
@@ -176,7 +176,7 @@ export default function AdminPage() {
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<label className="block text-xs font-semibold text-neutral-400 uppercase tracking-wider mb-1.5">Liedtitel</label>
|
||||
<Textfield
|
||||
<Input.Text
|
||||
type="text"
|
||||
placeholder="Großer Gott, wir..."
|
||||
value={title}
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
import Textfield from "@/components/Textfield";
|
||||
import { Input } from "@/components/FormElements";
|
||||
|
||||
interface Songbook {
|
||||
id: number;
|
||||
@@ -96,7 +96,7 @@ export default function SenderPage() {
|
||||
</h2>
|
||||
|
||||
<div className="mb-4">
|
||||
<Textfield
|
||||
<Input.Text
|
||||
type="text"
|
||||
placeholder="Nach Songtitel oder Nummer suchen..."
|
||||
value={song_search_name}
|
||||
|
||||
@@ -3,14 +3,24 @@ import { ComponentPropsWithoutRef } from "react";
|
||||
|
||||
interface TextfieldProps extends ComponentPropsWithoutRef<"input"> {}
|
||||
|
||||
export default function Textfield({value, onChange, placeholder}: TextfieldProps) {
|
||||
function Textfield({value, onChange, placeholder}: TextfieldProps) {
|
||||
return (
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Nach Songtitel oder Nummer suchen..."
|
||||
className="w-full border border-neutral-700 rounded-lg px-4 py-2.5 placeholder-neutral-500 focus:outline-none focus:border-blue-400 text-sm"
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
placeholder={placeholder}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function Dropdown() {
|
||||
return (
|
||||
<p></p>
|
||||
)
|
||||
}
|
||||
|
||||
export const Input = {
|
||||
Text: Textfield,
|
||||
Select: Dropdown,
|
||||
};
|
||||
Reference in new issue
Block a user