fix: resize handle text selection + add homelab-frontend CI badge
Build & Push Portfolio Image / build-push (push) Successful in 3m24s
Build & Push Portfolio Image / build-push (push) Successful in 3m24s
This commit is contained in:
@@ -116,6 +116,7 @@ export function InteractiveTerminal() {
|
||||
useEffect(() => {
|
||||
const handleMouseMove = (e: MouseEvent) => {
|
||||
if (!isResizing) return
|
||||
e.preventDefault()
|
||||
const container = containerRef.current
|
||||
if (!container) return
|
||||
|
||||
@@ -129,10 +130,14 @@ export function InteractiveTerminal() {
|
||||
|
||||
const handleMouseUp = () => {
|
||||
setIsResizing(false)
|
||||
document.body.style.cursor = 'auto'
|
||||
document.body.style.userSelect = 'auto'
|
||||
}
|
||||
|
||||
if (isResizing) {
|
||||
document.addEventListener('mousemove', handleMouseMove)
|
||||
document.body.style.userSelect = 'none'
|
||||
document.body.style.cursor = 'nw-resize'
|
||||
document.addEventListener('mousemove', handleMouseMove, { passive: false })
|
||||
document.addEventListener('mouseup', handleMouseUp)
|
||||
return () => {
|
||||
document.removeEventListener('mousemove', handleMouseMove)
|
||||
@@ -255,11 +260,18 @@ export function InteractiveTerminal() {
|
||||
exit={{ opacity: 0, y: 20, scale: 0.95 }}
|
||||
transition={{ duration: 0.25, ease: 'easeInOut' }}
|
||||
style={{ width: `${width}px`, height: `${height}px` }}
|
||||
className={`rounded-lg shadow-2xl flex flex-col border relative ${
|
||||
className={`rounded-lg shadow-2xl flex flex-col border relative user-select-none ${
|
||||
isDark
|
||||
? 'bg-gray-950 border-gray-700'
|
||||
: 'bg-white border-gray-300'
|
||||
}`}
|
||||
tabIndex={-1}
|
||||
onMouseDown={(e) => {
|
||||
// Ensure terminal stays focused during interaction
|
||||
if (e.target === containerRef.current) {
|
||||
inputRef.current?.focus()
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className={`border-b px-4 py-3 flex justify-between items-center ${
|
||||
isDark
|
||||
@@ -346,16 +358,20 @@ export function InteractiveTerminal() {
|
||||
{/* Resize handle — top-left corner */}
|
||||
<div
|
||||
ref={resizeHandleRef}
|
||||
onMouseDown={() => setIsResizing(true)}
|
||||
onMouseDown={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
setIsResizing(true)
|
||||
}}
|
||||
className={`absolute top-0 left-0 w-4 h-4 cursor-nw-resize ${
|
||||
isDark ? 'hover:bg-gray-600' : 'hover:bg-gray-400'
|
||||
} transition-colors z-10`}
|
||||
} transition-colors z-10 select-none`}
|
||||
style={{
|
||||
borderTopLeftRadius: 'inherit',
|
||||
opacity: isResizing ? 1 : 0.5,
|
||||
}}
|
||||
>
|
||||
<svg width="10" height="10" viewBox="0 0 10 10" className="m-0.5 opacity-40">
|
||||
<svg width="10" height="10" viewBox="0 0 10 10" className="m-0.5 opacity-40 pointer-events-none">
|
||||
<line x1="0" y1="10" x2="10" y2="0" stroke="currentColor" strokeWidth="1.5" />
|
||||
<line x1="0" y1="6" x2="6" y2="0" stroke="currentColor" strokeWidth="1.5" />
|
||||
</svg>
|
||||
|
||||
Reference in New Issue
Block a user