fix(style): youtube iframe width on mobile

pull/1012/head
Tienson Qin 2020-12-28 20:12:01 +08:00
parent bd5f497aca
commit 1b304b15ac
1 changed files with 11 additions and 8 deletions

View File

@ -666,14 +666,17 @@
:else
nil)]
(when-not (string/blank? youtube-id)
[:iframe
{:allow-full-screen "allowfullscreen"
:allow
"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
:frame-border "0"
:src (str "https://www.youtube.com/embed/" youtube-id)
:height "315"
:width "560"}])))
(let [width (min (- (util/get-width) 96)
560)
height (int (* width (/ 315 560)))]
[:iframe
{:allow-full-screen "allowfullscreen"
:allow
"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
:frame-border "0"
:src (str "https://www.youtube.com/embed/" youtube-id)
:height height
:width width}]))))
(= name "embed")
(let [a (first arguments)]