Skip to content

Commit 895c5ee

Browse files
authored
👌 Improve iframe loading (#7)
In real-world scenarios, when the documentation is hosted, there may be a delay whilst the iframe content loads. This commit adds CSS to the iframe background, to show a loading spinner to the user
1 parent 985bfa6 commit 895c5ee

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ repos:
3232
name: prettier (css, js)
3333
types_or: [css, javascript]
3434

35-
- repo: https://github.com/pre-commit/mirrors-csslint
36-
rev: v1.0.5
37-
hooks:
38-
- id: csslint
35+
# fails on background-image: url(...)
36+
# - repo: https://github.com/pre-commit/mirrors-csslint
37+
# rev: v1.0.5
38+
# hooks:
39+
# - id: csslint
3940

4041
- repo: local
4142
hooks:

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ that can be clicked to peek at the target of the reference.
1515
.. video:: _static/sphinx-peek-demo.mp4
1616
:alt: sphinx-peek demo
1717
:width: 600
18+
:preload: none
1819

1920
Usage
2021
-----

src/sphinx_peek/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class PeekConfig:
6868
preview_height: int = f("Height of preview window", 300)
6969
offset_x: int = f("Distance of preview window from icon (horizontal)", 20)
7070
offset_y: int = f("Distance of preview window from icon (vertical)", 20)
71-
open_delay: int = f("Delay (milliseconds) before displaying preview window", 100)
71+
open_delay: int = f("Delay (milliseconds) before displaying preview window", 200)
7272

7373
@classmethod
7474
def from_config(cls, config: Config) -> PeekConfig:

src/sphinx_peek/assets/sphinx_peek.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,8 @@
4646
overflow: hidden;
4747
border: none;
4848
border-radius: 0.5rem;
49+
background-color: rgba(128, 128, 128, 0.4);
50+
background-image: url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><style>.spinner_P7sC{transform-origin:center;animation:spinner_svv2 .75s infinite linear}@keyframes spinner_svv2{100%{transform:rotate(360deg)}}</style><path d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z" class="spinner_P7sC"/></svg>');
51+
background-repeat: no-repeat;
52+
background-position: center center;
4953
}

0 commit comments

Comments
 (0)