Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions src/components/Error/ErrorCard.jsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
import React, { useState } from "react";
import React, { useState, useEffect } from "react";
import { MdKeyboardArrowLeft, MdOutlineArrowRightAlt } from "react-icons/md";
import ErrorSolutions from "./ErrorSolutions";
import ErrorType from "./ErrorType";

function ErrorCard({ error }) {
const [showSolution, setShowSolution] = useState(false);
const [errorTypeColor, setErrorTypeColor] = useState(() => {
const [errorTypeColor, setErrorTypeColor] = useState('#7e1aa5');
useEffect(() => {
if (error.type == "add") {
return "#4024e0";
return setErrorTypeColor("#4024e0");
}
if (error.type == "commit" || error.type == "push") {
return "#1a5ba5";
if (error.type == "branch") {
return setErrorTypeColor("#40e4f0");
}
return "#7e1aa5";
});
if (error.type == "push") {
return setErrorTypeColor("#8d54e1");
}
if (error.type == "merge") {
return setErrorTypeColor("#118d7c");
}
if (error.type == "commit") {
return setErrorTypeColor("#1a5ba5");
}
return setErrorTypeColor("#7e1aa5");
}, [errorTypeColor])


return (
<div
className="py-4 mb-4 col-span-12 xl:col-span-6 px-6 border-l-4 rounded-lg rounded-tl-none rounded-bl-none items-start bg-dark-secondary flex flex-col"
className="py-4 mb-4 col-span-12 xl:col-span-6 px-6 border-l-4 rounded-lg items-start bg-dark-secondary flex flex-col"
style={{
borderColor: errorTypeColor,
}}
Expand Down
6 changes: 5 additions & 1 deletion src/components/Error/ErrorType.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ function ErrorType({ type }) {
? "before:bg-[#4024e0]"
: type === "commit"
? "before:bg-[#1a5ba5]"
: type === "merge"
? "before:bg-[#118d7c]"
: type === "push"
? "before:bg-[#1a5ba5]"
? "before:bg-[#8d54e1]"
: type === "branch"
? "before:bg-[#40E4F0]"
: "before:bg-[#7e1aa5]"
}`}
>
Expand Down
17 changes: 16 additions & 1 deletion src/components/Search/SearchInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,22 @@ function SearchInput({ search, setSearch, setType }) {
<ul className={`flex flex-col sm:flex-row mx-auto mt-2 items-start gap-4 py-3 px-6 rounded-lg bg-white w-full md:w-12/12 md:w-auto`}>
{
errorType.map((item, i) => (
<li key={i} className={`${item === "add" ? "bg-[#4024e0]" : item === "commit" ? "bg-[#1a5ba5]" : item === "push" ? "bg-[#1aa0a5]" : "bg-[#7e1aa5]"} w-full md:w-auto rounded-md text-white font-bold py-1 px-3 cursor-pointer`}
<li
key={i}
className={`${
item === "add"
? "bg-[#4024e0]"
: item === "commit"
? "bg-[#1a5ba5]"
: item === "merge"
? "bg-[#118d7c]"
: item === "push"
? "bg-[#8d54e1]"
: item === "branch"
? "bg-[#40E4F0]"
: "bg-[#7e1aa5]"
}
w-full md:w-auto rounded-md text-white font-bold py-1 px-3 cursor-pointer`}
onClick={() => setType(item)}
>{item}</li>
))
Expand Down