Skip to content

[FEAT] : Added Adjustable Vertical Seperator between Editor and ContentViewer #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Yashwanth1906
Copy link

@Yashwanth1906 Yashwanth1906 commented Apr 24, 2025

What kind of change does this PR introduce?

  • Feature: Added a resizable vertical separator between content viewer and editor

Issue Number:

If relevant, did you update the documentation?

  • No documentation updates required as this is a UI enhancement

Summary
This PR introduces a resizable vertical separator between the content viewer and editor panels, improving the user experience by allowing users to adjust the width of each panel according to their preferences. The separator features:

  • A 4px wide draggable divider
  • Visual feedback on hover and active states using the primary theme color
  • Smooth transition animations
  • Minimum width constraints (300px) for both panels to ensure usability
  • Maximum width constraint (70%) for the left panel to maintain layout balance

The implementation uses CSS flexbox for layout management and includes proper cursor styling to indicate the resizable nature of the divider.

Does this PR introduce a breaking change?
No, this is a non-breaking change that enhances the existing UI without affecting any functionality or existing features.

Technical Details:

  • Added new CSS module styles in page.module.css
  • Implemented flexbox-based layout for the main area
  • Added hover and active states for the divider using the primary theme color
  • Set appropriate min/max width constraints for both panels

@Yashwanth1906
Copy link
Author

@JeelRajodiya Waiting for your feedbacks on this...🙂

@JeelRajodiya
Copy link
Member

@Yashwanth1906 I'm currently busy with my exams, I'll review it sometime after 3rd may

@Yashwanth1906
Copy link
Author

@JeelRajodiya Okay..

@JeelRajodiya JeelRajodiya requested a review from Copilot May 13, 2025 12:00
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a resizable vertical separator between the ContentViewer and Editor panels to improve the user experience. Key changes include:

  • Replacing the static dual-panel layout with a new ResizableContent component for dynamic resizing.
  • Updating CSS modules (page.module.css, EditorNOutput.module.css, and ContentViewer.module.css) to support flexible panel sizing and visual feedback.
  • Refactoring page.tsx to integrate the new ResizableContent component.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
app/content/[...markdownPath]/page.tsx Refactored to use ResizableContent for improved UI layout
app/content/[...markdownPath]/page.module.css Updated layout styles for full viewport height and responsive sizing
app/components/ResizableContent.tsx New component that implements resizable panels with stored width state
app/components/EditorNOutput/EditorNOutput.module.css Adjusted styling to work with full width layout
app/components/ContentViewer/ContentViewer.module.css Streamlined padding and ensured full width display
Comments suppressed due to low confidence (1)

app/components/ResizableContent.tsx:35

  • Consider attaching mousemove and mouseup event listeners to the document instead of the container element to ensure smoother behavior when the cursor leaves the container during dragging.
const handleMouseMove = (e: React.MouseEvent<HTMLDivElement, MouseEvent> | MouseEvent,) => {

Comment on lines +8 to +10
interface ResizableContentProps {
content: React.ReactNode;
codeFile: any;
Copy link
Preview

Copilot AI May 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'any' for the codeFile prop may reduce type safety; specifying a more concrete type could help catch potential issues earlier.

Suggested change
interface ResizableContentProps {
content: React.ReactNode;
codeFile: any;
interface CodeFile {
name: string;
content: string;
}
interface ResizableContentProps {
content: React.ReactNode;
codeFile: CodeFile;

Copilot uses AI. Check for mistakes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yashwanth1906 Please implement this

pathList.push({
markdownPath: [item.folderName, step.fileName],
markdownPath: pathSegments,
});
});
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these changes relevant to the issue? Please remove these changes,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, we are wrapping the EditorNOutput into this new component. however we are importing the styles from the different component file (i.e. page.module.css) .

move current file into a new folder of the same name, and add the css file in that folder to maintain consistent component declaration

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider moving these changes to the page.tsx file (in the /content/[...markdownPath] folder) if you prefer to not to create a new component

Copy link
Member

@JeelRajodiya JeelRajodiya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

  1. The divider and scroll bar have the same color and are difficult to differentiate. Moreover, when you click on the divider sometimes some text from the content is getting selected unintentionally. consider changing the styles of both dividers to make them differentiable (you can take reference from leetcode UI to implement into ours)

  2. The whole page does not have the height of 100% and there are some space left at the very bottom

@JeelRajodiya
Copy link
Member

@Yashwanth1906 The vertical Separator is working as expected. could you please address my comments?

@Yashwanth1906
Copy link
Author

@Yashwanth1906 The vertical Separator is working as expected. could you please address my comments?

I'll do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat : Add Vertical Adjustable Separator
2 participants