-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
1 parent
3d32819
commit ade3f70
Showing
7 changed files
with
131 additions
and
12 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
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
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,5 +1,13 @@ | ||
@tailwind utilities; | ||
|
||
.yoopta-link { | ||
@apply yoo-link-underline yoo-link-underline-offset-4 yoo-link-text-[#007AFF] hover:yoo-link-text-[#3b82f6] | ||
@apply yoo-link-underline yoo-link-cursor-pointer yoo-link-underline-offset-4 yoo-link-relative yoo-link-text-[#007AFF] hover:yoo-link-text-[#3b82f6] | ||
} | ||
|
||
.yoopta-link-preview { | ||
@apply yoo-link-bg-[#FFFFFF] yoo-link-flex yoo-link-items-center yoo-link-z-50 yoo-link-p-[5px] yoo-link-rounded-md yoo-link-shadow-md yoo-link-border-[1px] yoo-link-border-solid yoo-link-border-[#e3e3e3] | ||
} | ||
|
||
.yoopta-link-preview-text { | ||
@apply yoo-link-mx-[4px] yoo-link-text-sm | ||
} |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { UI, useYooptaTools } from '@yoopta/editor'; | ||
import { Copy, Globe } from 'lucide-react'; | ||
import { useState } from 'react'; | ||
|
||
const { Overlay, Portal } = UI; | ||
|
||
const LinkHoverPreview = ({ style, setFloating, element }) => { | ||
console.log('element', element); | ||
const tools = useYooptaTools(); | ||
const [isToolsOpen, setIsToolsOpen] = useState(false); | ||
|
||
const LinkTool = tools?.LinkTool; | ||
const hasLinkTool = !!LinkTool; | ||
|
||
return ( | ||
<Portal id="yoopta-link-preview"> | ||
<div className="yoopta-link-preview" style={style} ref={setFloating}> | ||
{isToolsOpen ? ( | ||
<LinkTool /> | ||
) : ( | ||
<> | ||
<Globe size={14} strokeWidth={1} /> | ||
<span className="yoopta-link-preview-text">{element.props.url}</span> | ||
<span onClick={() => setIsToolsOpen(true)}>Edit</span> | ||
</> | ||
)} | ||
</div> | ||
</Portal> | ||
); | ||
}; | ||
|
||
export { LinkHoverPreview }; |
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