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

Recreating flyout as a webcomponent #86

Merged
merged 18 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 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.

17 changes: 15 additions & 2 deletions public/_/readthedocs-addons.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@
"inject_styles": true
},
"flyout": {
"translations": [],
"enabled": true,
"translations": [
{
"slug": "es",
"url": "/es/"
}
],
"versions": [
{
"slug": "stable",
Expand All @@ -102,9 +108,16 @@
"url": "/en/v2.0/"
}
],
"downloads": [],
"downloads": [
{
"name": "PDF",
"url": "/_/downloads/en/latest/"
}
],
"vcs": {
"url": "https://github.com",
"name": "GitHub",
"view_url": "https://github.com/readthedocs/readthedocs-client",
"username": "readthedocs",
"repository": "reathedocs-client",
"branch": "main",
Expand Down
19 changes: 19 additions & 0 deletions src/images/logo-wordmark-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { getReadTheDocsConfig } from "./readthedocs-config";
import * as notification from "./notification";
import * as analytics from "./analytics";
import * as search from "./search";
import * as newflyout from "./new-flyout";
import * as ethicalads from "./ethicalads";
import { domReady, isReadTheDocsEmbedPresent } from "./utils";

Expand All @@ -18,11 +19,17 @@ export function setup() {
})
.then((config) => {
let promises = [];
let addons = [analytics.AnalyticsAddon, notification.NotificationAddon];
let addons = [
analytics.AnalyticsAddon,
notification.NotificationAddon,
newflyout.FlyoutAddon,
];

if (!IS_PRODUCTION) {
addons.push(search.SearchAddon);
// Addons that are only available on development
addons.push(ethicalads.EthicalAdsAddon);
// NOTE: Disabling search for now because it's incompatible with Flyout
// addons.push(search.SearchAddon);
}

for (const addon of addons) {
Expand Down
122 changes: 122 additions & 0 deletions src/new-flyout.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/* New */

.container {
position: fixed;
max-width: 300px;
width: auto;
height: auto;
}

.container.bottom-right {
right: 20px;
bottom: 50px;
}

.container.bottom-left {
left: 20px;
bottom: 50px;
}

.container.top-left {
left: 20px;
top: 50px;
}

.container.top-right {
right: 20px;
top: 50px;
}

:host > div {
font-family: var(
--readthedocs-flyout-font-family,
"Lato",
"proxima-nova",
"Helvetica Neue",
"Arial",
"sans-serif"
);
font-size: var(--readthedocs-flyout-font-size, 0.8rem);
color: var(--readthedocs-flyout-color, rgb(128, 128, 128));
background-color: var(--readthedocs-flyout-background-color, rgb(39, 39, 37));
z-index: 3000;
padding: 10px;
overflow-y: auto;
}

header {
display: flex;
flex-flow: row wrap;
justify-content: space-between;
align-items: center;
cursor: pointer;
}

header > span {
color: var(--readthedocs-flyout-current-version-color, #27ae60);
font-size: var(--readthedocs-flyout-header-font-size, 0.9rem);
}

header > img.logo {
text-align: center;
width: 106px;
margin-right: 20px;
}

main {
padding: 5px;
margin-top: 5px;
}

main.closed {
display: none;
}

dl {
margin: 0;
padding: 0;
}

dl > dt {
font-size: var(--readthedocs-flyout-dt-font-size, 0.9rem);
color: var(--readthedocs-flyout-section-heading-color, rgb(128, 128, 128));
}

dl > dd {
display: inline-block;
margin: 0;
font-size: var(--readthedocs-flyout-dd-font-size, 0.9rem);
}

dd > a {
text-decoration: none;
color: var(--readthedocs-flyout-item-link-color, rgb(252, 252, 252));
padding: 6px;
display: inline-block;
}

dd form {
padding: 6px;
margin: 0;
}

dd input {
padding: 6px;
font-size: 80%;
}

hr {
display: block;
height: 1px;
border: 0;
margin: 20px 0;
padding: 0;
border-top-width: 1px;
border-top-style: solid;
border-top-color: var(--readthedocs-flyout-divider-color, #413d3d);
}

small a {
text-decoration: none;
color: var(--readthedocs-flyout-link-color, rgb(42, 128, 185));
}
Loading