Skip to content

Commit

Permalink
fix: draggable panel dragging bg color
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Aug 31, 2024
1 parent 7469458 commit 8de7078
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
30 changes: 20 additions & 10 deletions src/renderer/src/components/ui/divider/PanelSpliter.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
import { cn } from "@renderer/lib/utils"
import * as React from "react"

export const PanelSplitter = (
props: React.DetailedHTMLProps<
React.HTMLAttributes<HTMLDivElement>,
HTMLDivElement
>,
) => (
<div className="relative h-full w-0 shrink-0">
<div
tabIndex={-1}
{...props}
className="absolute inset-0 z-[11] w-[2px] -translate-x-1/2 cursor-ew-resize bg-transparent hover:bg-gray-400 active:!bg-accent hover:dark:bg-neutral-500"
/>
</div>
)
> & {
isDragging?: boolean
},
) => {
const { isDragging, ...rest } = props

return (
<div className="relative h-full w-0 shrink-0">
<div
tabIndex={-1}
{...rest}
className={cn(
"absolute inset-0 z-[11] w-[2px] -translate-x-1/2 cursor-ew-resize bg-transparent hover:bg-gray-400 active:!bg-accent hover:dark:bg-neutral-500",
isDragging ? "bg-accent" : "",
)}
/>
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function Component() {
const entryColWidth = useMemo(() => getUISettings().entryColWidth, [])
const { feedId, view } = useRouteParms()
const inWideMode = view ? views[view].wideMode : false
const { position, separatorProps } = useResizable({
const { position, separatorProps, isDragging } = useResizable({
axis: "x",
// FIXME: Less than this width causes grid images to overflow on safari
min: isSafari() ? 356 : 300,
Expand All @@ -44,7 +44,7 @@ export function Component() {
>
<EntryColumn key={`${feedId}-${view}`} />
</div>
{!inWideMode && <PanelSplitter {...separatorProps} />}
{!inWideMode && <PanelSplitter {...separatorProps} isDragging={isDragging} />}
<Outlet />
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/pages/(main)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const FeedResponsiveResizerContainer = ({
}}
/>

{delayShowSplitter && <PanelSplitter {...separatorProps} />}
{delayShowSplitter && <PanelSplitter isDragging={isDragging} {...separatorProps} />}
</>
)
}

0 comments on commit 8de7078

Please sign in to comment.