Skip to content
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

Added 'raw' markdown and 'preview' views #19

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

priyank-mishra-1
Copy link
Contributor

Solves #18

Description-
Created a toggle button for Raw markdown code view.
Changes made in Raw markdown editor are reflected in preview. Raw view and Preview are opened side by side with resizing panels.

Additional Details-
Added additional dependency for resizing panels -
npm i react-resizable-panels

Acceptance Criteria

  • Raw view is created
  • Changes in raw view are reflected in preview view
  • Does not break the existing code

Copy link

vercel bot commented Oct 31, 2024

@priyank-mishra-1 is attempting to deploy a commit to the theshiveshnetwork's projects Team on Vercel.

A member of the Team first needs to authorize it.

@priyank-mishra-1
Copy link
Contributor Author

Please review my PR. I have added an additional dependency for resizable panels. If you don't want additional dependencies then I can recreate it with vanilla js.

Copy link

vercel bot commented Nov 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
readmekraft ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 1, 2024 6:14pm

@TheShiveshNetwork
Copy link
Owner

I'm writing a sample code to explain factory pattern, refer this code:

function MobileComponent() {
    return (
         /* component to return modal for mobile screens */
    )
}
function DesktopComponent() {
    return (
         /* component to return for desktop screens */
        /* write all your resizable component code */
    )
}

export default function ResizableFactory({  }: Props) {
    const [isRawMode, setIsRawMode] = useState(false);
   /* handle all the logic here*/
    if (isMobile) return (
         <MobileComponent/>
    )
    return (
        <DesktopComponent/>
    )
}

Create this as a new component and all the logic related to resizable components and other things will go inside the factory component.
Import this factory component and use it in all the places, reducing the code.

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.

2 participants