Skip to content

Commit 9dd82f8

Browse files
authored
Merge pull request #69 from devvsakib/development
search type to text, clear button added issue #68
2 parents 09347ad + 487f54c commit 9dd82f8

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/components/Doc/DocItem.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import React from 'react';
44
const DocItem = ({ title, content }) => {
55
const changeColor = () => {
66
const colorArray = ["4024e0", "1a5ba5", "118d7c", "8d54e1", "40E4F0", "7e1aa5"]
7-
const code = [1, 0, 3, 2, 5, 7]
87
let element;
98

109
return element = colorArray[Math.floor(Math.random() * 6)];

src/components/Search/SearchInput.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState } from "react";
2-
import { MdSearch } from "react-icons/md";
2+
import { MdSearch, MdClear } from "react-icons/md";
33
import './css/style.css'
44
const errorType = ["push", "commit", "merge", "pull", "add", "branch"]
55
import useWindowsize from "../../hooks/useWindowsize";
@@ -16,13 +16,16 @@ function SearchInput({ search, setSearch, setType }) {
1616
>
1717
<MdSearch className="text-gray text-2xl" />
1818
<input
19-
type="search"
19+
type="text"
2020
id="searchbox"
2121
value={search}
2222
className="w-full text-sm md:text-base focus:outline-none placholder:font-semibold text-dark bg-transparent"
2323
placeholder="Search for errors"
2424
onChange={(e) => { setSearch(e.target.value); setType("") }}
2525
/>
26+
<button className={`focus:outline-none ${!search ? "hidden" : "block"}`} onClick={() => setSearch("")}>
27+
<MdClear className="text-gray text-xl" />
28+
</button>
2629
</form>
2730
<div className="types mt-4">
2831

@@ -33,7 +36,7 @@ function SearchInput({ search, setSearch, setType }) {
3336
errorType.map((item, i) => (
3437
<li
3538
key={i}
36-
className={`${item === "add"? "bg-[#4024e0]": item === "commit"? "bg-[#1a5ba5]": item === "merge"? "bg-[#118d7c]": item === "push"? "bg-[#8d54e1]": item === "branch"? "bg-[#40E4F0]": "bg-[#7e1aa5]"
39+
className={`${item === "add" ? "bg-[#4024e0]" : item === "commit" ? "bg-[#1a5ba5]" : item === "merge" ? "bg-[#118d7c]" : item === "push" ? "bg-[#8d54e1]" : item === "branch" ? "bg-[#40E4F0]" : "bg-[#7e1aa5]"
3740
}
3841
w-full md:w-auto rounded-md text-white font-bold py-1 px-3 cursor-pointer`}
3942
onClick={() => setType(item)}

0 commit comments

Comments
 (0)