🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

@git-diff-view/react

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@git-diff-view/react

@git-diff-view/react

Source
npmnpm
Version
0.0.9
Version published
Weekly downloads
98K
-4.93%
Maintainers
1
Weekly downloads
 
Created
Source

Usage

    <DiffViewReact<string>
      ref={ref}
      renderWidgetLine={({ onClose, side, lineNumber }) => (
        <div className="border flex flex-col w-full px-[4px] py-[8px]">
          <TextArea onChange={(v) => (valRef.current = v)} />
          <div className="m-[5px] mt-[0.8em] text-right">
            <div className="inline-flex gap-x-[12px] justify-end">
              <button
                className="border px-[12px] py-[6px] rounded-[4px]"
                onClick={() => {
                  onClose();
                  valRef.current = "";
                }}
              >
                cancel
              </button>
              <button
                className="border px-[12px] py-[6px] rounded-[4px]"
                onClick={() => {
                  onClose();
                  if (valRef.current) {
                    const sideKey = side === SplitSide.old ? "oldFile" : "newFile";
                    setExtend((prev) => {
                      const res = { ...prev };
                      res[sideKey] = { ...res[sideKey], [lineNumber]: { lineNumber, data: valRef.current } };
                      return res;
                    });
                    setTimeout(() => {
                      valRef.current = "";
                    });
                  }
                }}
              >
                submit
              </button>
            </div>
          </div>
        </div>
      )}
      // use data
      // data={data[v]}
      diffFile={diffFileInstance}
      extendData={extend}
      renderExtendLine={({ data }) => {
        return (
          <div className="border flex px-[10px] py-[8px] bg-slate-400">
            <h2 className="text-[20px]">
              {">> "}
              {data}
            </h2>
          </div>
        );
      }}
      diffViewFontSize={fontsize}
      diffViewHighlight={highlight}
      diffViewMode={mode}
      diffViewWrap={wrap}
      diffViewAddWidget
    />

example repo

react-example

Keywords

diff component

FAQs

Package last updated on 22 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts