Skip to content

Commit

Permalink
Merge pull request #12 from shefing/designLineDefination
Browse files Browse the repository at this point in the history
Design line defination
  • Loading branch information
RachelBra authored Jan 22, 2024
2 parents e6a6188 + 4c7234f commit 9efc995
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/components/toolbar/LineDefinition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ import { useNumbersLineContext } from "../../context/numbersLineContext";
import openMenu from "../../assets/icons/menuButtonOpen.svg";
import closeMenu from "../../assets/icons/menuButtonClose.svg";


const LineDefinition = () => {
const [isMenuOpen, setIsMenuOpen] = useState(false);
const { setKind } = useNumbersLineContext();
const wrapperRef = useRef<HTMLButtonElement>(null);

useEffect(() => {
const handleOutsideClick = (event: any) => {
// Close the component if the click is outside the component
if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
setIsMenuOpen(false);
}
Expand All @@ -38,7 +36,7 @@ const LineDefinition = () => {
return (
<button
ref={wrapperRef}
className={`flex flex-col items-end right-0 absolute mt-[1.8%] mr-[1.8%] rounded-md ${isMenuOpen && "shadow-2xl bg-[#009FDE]"}`}
className={`flex flex-col items-end right-0 absolute mt-[1.5%] mr-[1.5%] rounded-md ${isMenuOpen && "shadow-2xl bg-[#009FDE]"}`}
>
<div className={`cursor-pointer flex w-259 text-xl font-bold rounded-md ${isMenuOpen && "bg-[#009FDE]"}`} onClick={handleButtonClick}>
<img className="flex-shrink-0 p-5 pr-5" src={isMenuOpen ? closeMenu : openMenu} />
Expand All @@ -47,24 +45,23 @@ const LineDefinition = () => {
isMenuOpen && " text-[#ffffff]"
}`}
>
{"הגדרת הישר"}
הגדרת הישר
</div>
</div>

{isMenuOpen && (

<div className="flex flex-col items-end pt-8 pb-2 rounded-tl-5 right-0 rounded-md opacity-100 bg-#009FDE">
<Button className={fontButtonClassName} onClick={() => handleMenuButtonClick(LineRange.ten)}>
{"10-0"}
10-0
</Button>
<Button className={fontButtonClassName} onClick={() => handleMenuButtonClick(LineRange.twenty)}>
{"20-0"}
20-0
</Button>
<Button className={fontButtonClassName} onClick={() => handleMenuButtonClick(LineRange.hundredCircular)}>
{"(קפיצות של 10) 100-0"}
(קפיצות של 10) 100-0
</Button>
<Button className={fontButtonClassName} onClick={() => handleMenuButtonClick(LineRange.hundred)}>
{"(קפיצות של 1) 100-0 "}
(קפיצות של 1) 100-0
</Button>
</div>
)}
Expand Down

0 comments on commit 9efc995

Please sign in to comment.