TheShiveshNetwork / readmekraft

Craft Perfect GitHub Markdown Files with AI
https://readmekraft.vercel.app
GNU General Public License v2.0
21 stars 5 forks source link

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

Open priyank-mishra-1 opened 4 weeks ago

priyank-mishra-1 commented 4 weeks ago

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

vercel[bot] commented 4 weeks ago

@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 commented 4 weeks ago

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.

vercel[bot] commented 3 weeks ago

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 commented 3 weeks ago

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.