Skip to content

Commit

Permalink
Docdiff: initial work to toggle enabled/disabled (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
humitos authored Aug 31, 2023
1 parent 3c17f4f commit 32a0449
Show file tree
Hide file tree
Showing 11 changed files with 356 additions and 24 deletions.
18 changes: 9 additions & 9 deletions dist/readthedocs-addons.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/readthedocs-addons.js.map

Large diffs are not rendered by default.

38 changes: 30 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"babel-jest": "^29.5.0",
"babel-loader": "^9.1.2",
"css-loader": "^6.7.3",
"doc-diff": "github:readthedocs/doc-diff#humitos/nodejs-version",
"ethical-ad-client": "github:readthedocs/ethical-ad-client#humitos/node-sass",
"express-interceptor": "^1.2.0",
"jest": "^29.5.0",
Expand All @@ -33,6 +32,8 @@
"prettier": "^2.8.4",
"semver": "^7.3.8",
"tippy.js": "^6.3.7",
"tslib": "^2.4.0",
"visual-dom-diff": "^0.7.2",
"webpack": "^5.76.1",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1"
Expand Down
17 changes: 17 additions & 0 deletions public/docdiff.changed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html>
<head>
<title>DocDiff Addons - Read the Docs</title>
</head>
<body>
<div id="main">
<h1>DocDiff Changed</h1>
<p>This is a great feature for external versions previews.</p>
<p>Paragraph deleted</p>
</div>

<readthedocs-docdiff
base-url="http://localhost:8000/docdiff.changed.html"
root-selector="#main"
></readthedocs-docdiff>
</body>
</html>
17 changes: 17 additions & 0 deletions public/docdiff.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html>
<head>
<title>DocDiff Addons - Read the Docs</title>
</head>
<body>
<div id="main">
<h1>DocDiff Addons</h1>
<p>This is a great feature for pull request previews.</p>
</div>

<readthedocs-docdiff
base-url="http://localhost:8000/docdiff.changed.html"
root-selector="#main"
inject-styles="true"
></readthedocs-docdiff>
</body>
</html>
4 changes: 4 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ <h1>Documentation Addons</h1>
<li><a href="/pelican">Pelican</a></li>
</ul>

<h2>DocDiff</h2>

<p>Visit <a href="docdiff.html">this page</a> to take a look at it.</p>

<h2>Search</h2>

<p>Nothing to see here, just a placeholder to put the <code>readthedocs-search</code> tag.</p>
Expand Down
65 changes: 65 additions & 0 deletions src/docdiff.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/* Example copied from */
/* https://www.w3schools.com/howto/howto_css_switch.asp */

/* The switch - the box around the slider */
:host .switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}

/* Hide default HTML checkbox */
:host .switch input {
opacity: 0;
width: 0;
height: 0;
}

/* The slider */
:host .slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: 0.4s;
transition: 0.4s;
}

:host .slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: 0.4s;
transition: 0.4s;
}

:host input:checked + .slider {
background-color: #2196f3;
}

:host input:focus + .slider {
box-shadow: 0 0 1px #2196f3;
}

:host input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}

/* Rounded sliders */
:host .slider.round {
border-radius: 34px;
}

:host .slider.round:before {
border-radius: 50%;
}
12 changes: 12 additions & 0 deletions src/docdiff.document.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.doc-diff-added {
background-color: rgb(171, 242, 188);
text-decoration: none;
}

.doc-diff-modified {
}

.doc-diff-removed {
background-color: rgba(255, 129, 130, 0.4);
text-decoration: none;
}
Loading

0 comments on commit 32a0449

Please sign in to comment.