diff --git a/public/index.html b/public/index.html index f24ff41a..204de9f2 100644 --- a/public/index.html +++ b/public/index.html @@ -37,6 +37,40 @@

Ethical Ad

CustomScript

Content of the section

+

Flyout

+ +

+ Lorem ipsum odor amet, consectetuer adipiscing elit. Ultricies massa + molestie per iaculis id cras fermentum mi fames. Feugiat per cubilia + volutpat; dictumst cras libero fringilla. +

+ +
+ +
+ +

+ Placerat conubia vivamus finibus + vulputate, sit ipsum. Senectus netus aptent laoreet per venenatis maximus. + Praesent mi tellus congue orci mus in etiam suspendisse. Inceptos senectus + nam accumsan, praesent felis consequat feugiat maximus. Dolor cras + faucibus sociosqu feugiat urna orci integer hendrerit. +

+ + +
+ +
+ + + + +

+ Felis mus quis urna consequat arcu blandit finibus dui. Rutrum fames + aliquet nunc vitae aenean class mattis elit. Quis pretium himenaeos + facilisis sodales molestie fringilla ac interdum. +

+

Hit / to trigger the search modal, or click on the input from the flyout.

diff --git a/src/flyout.css b/src/flyout.css index df23523a..ee0d86f9 100644 --- a/src/flyout.css +++ b/src/flyout.css @@ -13,33 +13,59 @@ .container { position: fixed; max-width: var(--readthedocs-flyout-max-width, 25em); - width: auto; height: auto; + width: auto; max-height: calc(100% - 100px); overflow-y: auto; line-height: var(--addons-flyout-line-height); } -.container.bottom-right { +.container.closed { + height: 2.5rem; +} + +.container.bottom-right:not(.inline) { right: 20px; bottom: 50px; } -.container.bottom-left { +.container.bottom-left:not(.inline) { left: 20px; bottom: 50px; } -.container.top-left { +.container.top-left:not(.inline) { left: 20px; top: 50px; } -.container.top-right { +.container.top-right:not(.inline) { right: 20px; top: 50px; } +.container.inline { + width: 100%; + max-width: 100%; + height: 100%; + max-height: 100%; + padding: 0 10px; + margin: 0; + position: relative; + display: inline-block; + overflow: visible; +} + +.container.up.inline main { + top: unset; + bottom: 2.5rem; +} + +.container.down.inline main { + top: 2.5rem; + bottom: unset; +} + :host > div { font-family: var( --readthedocs-flyout-font-family, @@ -116,7 +142,22 @@ main { margin-top: 5px; } -main.closed { +.container.inline main { + padding: 1em; + background-color: var(--readthedocs-flyout-background-color, rgb(39, 39, 37)); + + /* Remove the padding-left added in `.container.inline` */ + margin-left: -10px; + + /* Use full width minus 1em padding added on left and right in `.container.inline main` */ + width: calc(100% - 2em); + + position: absolute; + margin-top: 0; +} + +main.closed, +.container.inline main.closed { display: none; } diff --git a/src/flyout.js b/src/flyout.js index 45c13ec2..b782acc4 100644 --- a/src/flyout.js +++ b/src/flyout.js @@ -26,7 +26,6 @@ export class FlyoutElement extends LitElement { static properties = { config: { state: true }, opened: { type: Boolean }, - floating: { type: Boolean }, position: { type: String }, }; @@ -37,7 +36,6 @@ export class FlyoutElement extends LitElement { this.config = null; this.opened = false; - this.floating = true; this.position = "bottom-right"; this.readthedocsLogo = READTHEDOCS_LOGO; } @@ -327,7 +325,7 @@ export class FlyoutElement extends LitElement { } updateCSSClasses() { - this.classes = { floating: this.floating, container: true }; + this.classes = { container: true }; this.classes[this.position] = true; } diff --git a/tests/__snapshots__/flyout.test.snap.js b/tests/__snapshots__/flyout.test.snap.js index 8fae30c0..460bc054 100644 --- a/tests/__snapshots__/flyout.test.snap.js +++ b/tests/__snapshots__/flyout.test.snap.js @@ -2,7 +2,7 @@ export const snapshots = {}; snapshots["Flyout addon snapshot flyout completely"] = -`
+`
Read the Docs +`