-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add styles based on the documentation tool #473
base: main
Are you sure you want to change the base?
Changes from all commits
00f72e0
24d7869
f3477b7
053d931
8c337ea
9d08961
12057bf
28bb43c
434f187
718b52a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,13 @@ import { classMap } from "lit/directives/class-map.js"; | |
import { default as objectPath } from "object-path"; | ||
|
||
import styleSheet from "./flyout.css"; | ||
import { AddonBase, addUtmParameters, getLinkWithFilename } from "./utils"; | ||
import { | ||
AddonBase, | ||
addUtmParameters, | ||
getLinkWithFilename, | ||
docTool, | ||
} from "./utils"; | ||
import { SPHINX, MKDOCS_MATERIAL } from "./constants"; | ||
import { | ||
EVENT_READTHEDOCS_SEARCH_SHOW, | ||
EVENT_READTHEDOCS_FLYOUT_HIDE, | ||
|
@@ -31,9 +37,12 @@ export class FlyoutElement extends LitElement { | |
super(); | ||
|
||
this.config = null; | ||
this.classes = {}; | ||
this.opened = false; | ||
this.floating = true; | ||
this.position = "bottom-right"; | ||
this.classes = { floating: this.floating, container: true }; | ||
this.classes[this.position] = true; | ||
this.readthedocsLogo = READTHEDOCS_LOGO; | ||
} | ||
|
||
|
@@ -310,11 +319,12 @@ export class FlyoutElement extends LitElement { | |
return nothing; | ||
} | ||
|
||
const classes = { floating: this.floating, container: true }; | ||
classes[this.position] = true; | ||
|
||
return html` | ||
<div class=${classMap(classes)}> | ||
<div | ||
tool="${docTool.documentationTool}" | ||
tool-theme="${docTool.documentationTheme}" | ||
Comment on lines
+324
to
+325
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we not want to prefix these with something? I guess we're controlling it, but I imagine we also want the CSS selectors prefixed, unless it's OK because it's in the shadow DOM? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we work with our custom elements, no prefixing is required. When working with native elements, I don't think we should use div here, or apply the |
||
class=${classMap(this.classes)} | ||
> | ||
${this.renderHeader()} | ||
<main class=${classMap({ closed: !this.opened })}> | ||
${this.renderLanguages()} ${this.renderVersions()} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems we're setting this, and then overriding it on line 44?