Skip to content

Commit

Permalink
feat(runner): add runner codes
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamadreza1388 committed Jan 11, 2025
1 parent d38790e commit 7ca894f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/components/editor/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import "../../scripts/codemirror.js"
import EditorService from "../../services/EditorService.js";
import { Rnd } from "react-rnd";
import {useLocation} from "react-router-dom";
import Runner from "./Runner.jsx";

const salamAdd = () => {
const script = document.createElement('script');
Expand Down Expand Up @@ -45,6 +46,8 @@ const Editor = () => {
className={"editor-container w-[calc(100%-50px)] h-[calc(100vh-35px)] bg-[#FFF1E9] rounded-tr-[15px] rtl after:inline-block after:border-0 after:z-[-1] after:w-[30px] after:h-[30px] float-end after:bg-[#ffdecc] after:absolute relative after:top-0 after:right-0"}>
<div id="editor" className={"rounded-tr-[15px] overflow-auto h-[calc(100vh-35px)]"}></div>
</main>

<Runner />
{/*<Rnd*/}
{/* size={{ width: size.width, height: size.height }}*/}
{/* position={{ x: position.x, y: position.y }}*/}
Expand Down
20 changes: 20 additions & 0 deletions src/components/editor/Runner.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {useEffect, useState} from "react";

const Runner = () => {
const [hidden, setHidden] = useState(true);

useEffect(() => {
document.addEventListener("keydown", (e) => {
if (e.altKey && e.code === 'F2') {
e.preventDefault();
alert('شما ترکیب Alt + F2 را فشردید!');
}
})
}, [])

return(<>
<div className={(hidden && "hidden ") + " fixed top-[75px] left-[70px] z-[998] bg-white w-[100px] h-[35px] rounded-[10px] border"}></div>
</>)
}

export default Runner;
4 changes: 2 additions & 2 deletions src/components/shared/dropdown/Dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const Dropdown = ({ children, title }) => {
<div className={"relative"}>
<button onClick={() => {
setOpen(!open);
}} className={"cursor-pointer rounded-[8px] text-[15px] px-2 py-[2px] hover:bg-[#ffc2a8] transition duration-200"}>{ title }</button>
}} className={"cursor-pointer text-[16px] px-2 py-4 hover:bg-[#ffc2a8] transition duration-200"}>{ title }</button>

<div className={(!open && "hidden ") + " absolute bg-[#ffe9db]/50 backdrop-blur rounded-[15px] z-[1000] top-[26px] right-0 border border-orange-300 p-2"}>
<div className={(!open && "hidden ") + " absolute bg-[#ffe9db]/50 backdrop-blur rounded-[15px] z-[1000] top-[40px] right-0 border border-orange-300 p-2"}>
{ children }
</div>

Expand Down

0 comments on commit 7ca894f

Please sign in to comment.