Skip to content

Commit fe1d1a5

Browse files
committed
Fix TextInput props and search bar
1 parent 78f7330 commit fe1d1a5

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

src/components/TextInput.tsx

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
import React from "react";
2-
import { Input } from "@chakra-ui/react";
2+
import { Input, InputProps } from "@chakra-ui/react";
33

4-
export interface TextInputProps {
5-
placeholder?: string;
4+
export interface TextInputProps extends InputProps {
65
type?: string;
7-
name?: string;
86
}
97

10-
const TextInput = ({
11-
placeholder,
12-
type = "text",
13-
name,
14-
...props
15-
}: TextInputProps) => {
8+
const TextInput = ({ type = "text", ...props }: TextInputProps) => {
169
return (
1710
<Input
1811
{...props}
1912
variant="filled"
20-
_focus={{ borderColor: "violet.400" }}
13+
_focus={{ borderColor: "violet.400", backgroundColor: "white" }}
2114
_hover={{ borderColor: "violet.400" }}
2215
borderColor="violet.200"
2316
bg="white"

src/layout/Footer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Box } from "@chakra-ui/react";
44
const Footer = () => {
55
return (
66
<Box bgColor="#f5f5f5" border="1px" borderRadius="md" padding="10px" textAlign="center">
7-
Copyright © 2021-2023 Shibaac
7+
Copyright © 2021-2025 Shibaac
88
</Box>
99
);
1010
};

src/layout/NavBar.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,11 @@ const DesktopNavigation = ({ user }) => {
9494
<form
9595
onSubmit={(event) => {
9696
event.preventDefault();
97-
if (event.target.search.value) {
98-
router.push(`/character/${event.target.search.value}`);
99-
event.target.reset();
97+
const form = event.currentTarget;
98+
const searchValue = (form.elements.namedItem("search") as any)?.value;
99+
if (searchValue) {
100+
router.push(`/character/${searchValue}`);
101+
form.reset();
100102
}
101103
}}
102104
>

src/layout/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Box, Image, Flex } from "@chakra-ui/react";
88
const Layout = ({ children }) => {
99
return (
1010
<Box w={{ base: "95%", md: "70%" }} marginX={"auto"} marginY={{ base: "1em", md: 0 }}>
11-
<Head title="layout" />
11+
<Head />
1212
<Image width="15%" marginLeft="auto" marginRight="auto" marginBottom="15px" marginTop="15px" src="/images/header.png" alt="shibaac" />
1313
<NavBar />
1414
<Flex flexDirection={{ base: "column", md: "row" }}>

0 commit comments

Comments
 (0)