-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
14 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import './style.scss' | ||
import React from "react"; | ||
import React, {useEffect, useRef} from "react"; | ||
import {useStateIfMounted} from "use-state-if-mounted"; | ||
|
||
interface Props {} | ||
function Helper(props: Props) { | ||
const [flag, setFlag] = useStateIfMounted(false); | ||
const [iconFlag, setIconFlag] = useStateIfMounted(false); | ||
const [menuFlag, setMenuFlag] = useStateIfMounted(false); | ||
|
||
return(<section className={'helper'} > | ||
{flag && <div className={'helper-menu border'}> | ||
return(<section className={'helper'} tabIndex={-1}> | ||
{(iconFlag || menuFlag) && <div className={'helper-menu border'} | ||
onMouseEnter={e => setMenuFlag(true)} onMouseLeave={e => setMenuFlag(false)}> | ||
<div tabIndex={-1} onClick={e => alert('ok1')} className={'helper-item'}>Test 1</div> | ||
<div tabIndex={-1} onClick={e => alert('ok2')} className={'helper-item'}>Test 2</div> | ||
<hr /> | ||
<div tabIndex={-1} onClick={e => setFlag(false)} className={'text-danger helper-item'}>Close</div> | ||
<div tabIndex={-1} onClick={e => console.log('ok2')} className={'helper-item'}>Test 2</div> | ||
</div>} | ||
<div tabIndex={-1} onClick={e => setFlag(!flag)} | ||
className={'helper-icon bg-dark circle border d-flex justify-content-center align-items-center'}> | ||
<div tabIndex={-1} onClick={e => setIconFlag(!iconFlag)} onBlur={e => setIconFlag(false)} | ||
className={'bg-dark helper-icon circle border d-flex justify-content-center align-items-center'}> | ||
<label style={{cursor: 'pointer'}} className={'text-white'}>?</label> | ||
</div> | ||
</section>) | ||
</section>); | ||
} | ||
|
||
export default Helper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,4 @@ | |
position: absolute; | ||
bottom: 0; right: 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters