diff --git a/src/App.tsx b/src/App.tsx
index 69002fa..5a59f53 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -10,7 +10,9 @@ import React from "react";
* @return {JSX.Element}
*/
function App() {
- return
Hello world!
;
+ return
+ Hello world!
+;
}
export default App;
diff --git a/src/assets/svg/background.svg b/src/assets/svg/background.svg
new file mode 100644
index 0000000..e15137a
--- /dev/null
+++ b/src/assets/svg/background.svg
@@ -0,0 +1,7 @@
+
diff --git a/src/assets/svg/selectIcon.svg b/src/assets/svg/selectIcon.svg
new file mode 100644
index 0000000..67a561d
--- /dev/null
+++ b/src/assets/svg/selectIcon.svg
@@ -0,0 +1,3 @@
+
diff --git a/src/components/MainSection.tsx b/src/components/MainSection.tsx
new file mode 100644
index 0000000..11e75f0
--- /dev/null
+++ b/src/components/MainSection.tsx
@@ -0,0 +1,111 @@
+import classNames from "classnames";
+import React from "react";
+import Inputgroup from "./Inputgroup";
+import Select from "./Select";
+import { useState } from "react";
+import { Button } from "./Button/Button";
+import { SVGSearch } from "../components/icons";
+import TextInputBox from "components/TextInputBox";
+
+type Props = {
+ className?: string;
+};
+
+const options = [
+ { name: "All" },
+ { name: "Wade Cooper" },
+ { name: "Arlene Mccoy" },
+ { name: "Devon Webb" },
+ { name: "Tom Cook" },
+ { name: "Tanya Fox" },
+ { name: "Hellen Schmidt" },
+];
+const Items = [
+ { name: "test" },
+ { name: "Wade Cooper" },
+ { name: "Arlene Mccoy" },
+ { name: "Devon Webb" },
+ { name: "Tom Cook" },
+ { name: "Tanya Fox" },
+ { name: "Hellen Schmidt" },
+];
+export default function MainSection({
+ className,
+ ...props
+}: Props): JSX.Element {
+ const [value, setValue] = useState(options[0]);
+ const [selectedPerson, setSelectedPerson] = useState(Items);
+ const [query, setQuery] = useState("");
+
+ let filteredItems =
+ query === ""
+ ? Items
+ : Items.filter((item) =>
+ item.name
+ .toLowerCase()
+ .replace(/\s+/g, "")
+ .includes(query.toLowerCase().replace(/\s+/g, ""))
+ );
+
+ const removeOption = (e: React.SyntheticEvent) => {
+ const newSelect = filteredItems.filter(
+ (element: any) => element.name !== e
+ );
+ setSelectedPerson(newSelect);
+ };
+ return (
+
+
+ Scientific Library with Free Access
+
+
+
Search
+
320 455
+
Items
+
+
+
+
+
+
+
+ value.name}
+ inGroup={true}
+ removeOption={removeOption}
+ />
+
+
+
+
+
+
+
+ Advanced Search
+
+
+
+ );
+}
diff --git a/src/components/TextInputBox.tsx b/src/components/TextInputBox.tsx
new file mode 100644
index 0000000..f54cc49
--- /dev/null
+++ b/src/components/TextInputBox.tsx
@@ -0,0 +1,155 @@
+import classNames from "classnames";
+import React from "react";
+import "../index.css";
+import { Combobox, Transition } from "@headlessui/react";
+import { Fragment } from "react";
+
+type Props = {
+ removeOption: Function;
+ inGroup?: boolean;
+ queryItems?: T[];
+ query: string;
+ setQuery: (element: any) => void;
+ disabled?: boolean;
+ className?: string;
+ value?: T;
+ displayValueResolver?: (element: T) => any;
+ onChange: (element: T) => void;
+} & Omit<
+ React.ComponentPropsWithRef<"select">,
+ "value" | "onChange" | "queryItems"
+>;
+
+const inputStyle = `
+ w-full
+ cursor-default
+ rounded
+ overflow-hidden
+ border
+ border-solid
+ shadow-none
+ border-gray-100
+ focus:outline-none
+ focus:border-gray-200
+ hover:border-gray-200
+ py-2 pl-3
+ text-sm
+ text-gray-900
+`;
+
+const inputList = `
+ absolute z-10 mt-1 w-full max-h-56
+ bg-white shadow-lg
+ rounded py-1
+ overflow-hidden
+ focus:outline-none
+ text-base
+ sm:text-sm`;
+
+const inputInGroup = [
+ `border-none
+ hover:none
+ active:none
+ focus:none
+ `,
+];
+
+function TextInputBox({
+ removeOption,
+ inGroup = false, // We should use this flag to choose how we will style our component
+ query,
+ setQuery,
+ className,
+ queryItems = [],
+ value,
+ onChange,
+ displayValueResolver,
+ disabled,
+ ...props
+}: Props): JSX.Element {
+ return (
+
+
+
+
+ setQuery(event.target.value)}
+ placeholder={"Search..."}
+ displayValue={(value: T) =>
+ displayValueResolver ? displayValueResolver(value) : value
+ }
+ />
+
+
+ {query.length > 0 && (
+
+
setQuery("")}
+ >
+
+ {queryItems.length === 0 && query !== "" ? (
+ Nothing found.
+ ) : null}
+ {query.length > 0 && (
+
+ query: "{query}"
+
+ )}
+ {queryItems.map((item: any, id: number) => (
+
+ classNames(
+ active
+ ? "text-gray-900 bg-blue-50"
+ : "font-normal ",
+ "cursor-default select-none relative py-2 pl-3 pr-9",
+ selected
+ ? "text-gray-900 bg-blue-100"
+ : "font-normal "
+ )
+ }
+ value={item}
+ >
+
+ {`${
+ displayValueResolver
+ ? displayValueResolver(item)
+ : item
+ }`}
+
+
+
+
+
+ ))}
+
+
+
+ )}
+
+
+
+
+ );
+}
+export default TextInputBox;