File tree Expand file tree Collapse file tree 2 files changed +41
-8
lines changed Expand file tree Collapse file tree 2 files changed +41
-8
lines changed Original file line number Diff line number Diff line change 1+ import { FC , ReactNode } from "react" ;
2+
3+ interface HoverTextProps {
4+ label : string ;
5+ children : ReactNode ;
6+ className ?: string ;
7+ }
8+
9+ const HoverText : FC < HoverTextProps > = ( props ) => {
10+ return (
11+ < div className = { `${ props . className } relative group` } >
12+ < div
13+ className = "absolute whitespace-nowrap left-1/2 -translate-x-1/2 -top-7
14+ text-[.8rem] bg-gh-bg-secondary border border-solid border-gh-border pointer-events-none
15+ px-2 py-1 leading-none rounded-md shadow-xl text-gh-text-secondary z-[5]
16+ before:content-[''] before:w-2 before:h-2 before:bg-gh-bg-secondary
17+ before:absolute before:top-full before:left-1/2 before:-translate-x-1/2
18+ before:rotate-45 before:-translate-y-1/2 before:border-solid before:border-gh-border
19+ before:border-b before:border-r scale-80 opacity-0 group-hover:scale-100
20+ group-hover:opacity-100 transition-all duration-200"
21+ >
22+ { props . label }
23+ </ div >
24+
25+ { props . children }
26+ </ div >
27+ ) ;
28+ } ;
29+
30+ export default HoverText ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { Badge, Line } from "../../types/line";
33import { AiOutlinePlus } from "react-icons/ai" ;
44import BlurOverlay from "../popups/BlurOverlay" ;
55import LinePopup from "../popups/LinePopup" ;
6+ import HoverText from "../hover/HoverText" ;
67
78interface InputProps {
89 line : string ;
@@ -47,14 +48,16 @@ const LineInput: FC<InputProps> = (props) => {
4748 >
4849 < span > Badges: { badges . length } </ span >
4950
50- < button
51- type = "button"
52- className = "cursor-pointer ml-auto text-gh-text-secondary
53- hover:text-gh-blue transition-all duration-150"
54- onClick = { ( ) => setIsPopupOpen ( true ) }
55- >
56- < AiOutlinePlus />
57- </ button >
51+ < HoverText label = "Add badge" className = "ml-auto" >
52+ < button
53+ type = "button"
54+ className = "cursor-pointer text-gh-text-secondary
55+ hover:text-gh-blue transition-all duration-150"
56+ onClick = { ( ) => setIsPopupOpen ( true ) }
57+ >
58+ < AiOutlinePlus />
59+ </ button >
60+ </ HoverText >
5861 </ div >
5962 </ div >
6063 ) ;
You can’t perform that action at this time.
0 commit comments