From dcf4abaf122f408c3dd71a480dad2e8c69343193 Mon Sep 17 00:00:00 2001 From: Demis Bellot Date: Sun, 24 Nov 2024 18:49:00 +0800 Subject: [PATCH] Add youtube video --- AiServer/wwwroot/css/app.css | 83 +++++++++++++- AiServer/wwwroot/css/lite-yt-embed.css | 93 +++++++++++++++ AiServer/wwwroot/index.html | 2 + AiServer/wwwroot/lib/js/lite-yt-embed.js | 125 +++++++++++++++++++++ AiServer/wwwroot/mjs/components/UiHome.mjs | 4 + 5 files changed, 303 insertions(+), 4 deletions(-) create mode 100644 AiServer/wwwroot/css/lite-yt-embed.css create mode 100644 AiServer/wwwroot/lib/js/lite-yt-embed.js diff --git a/AiServer/wwwroot/css/app.css b/AiServer/wwwroot/css/app.css index fb32da8..96de231 100644 --- a/AiServer/wwwroot/css/app.css +++ b/AiServer/wwwroot/css/app.css @@ -1317,6 +1317,10 @@ select{ margin-top: auto; } +.mt-24 { + margin-top: 6rem; +} + .block { display: block; } @@ -1361,6 +1365,10 @@ select{ display: none; } +.aspect-video { + aspect-ratio: 16 / 9; +} + .h-10 { height: 2.5rem; } @@ -1601,6 +1609,14 @@ select{ max-width: 20rem; } +.max-w-6xl { + max-width: 72rem; +} + +.max-w-5xl { + max-width: 64rem; +} + .flex-1 { flex: 1 1 0%; } @@ -2327,6 +2343,11 @@ select{ background-color: rgb(238 242 255 / var(--tw-bg-opacity, 1)); } +.bg-indigo-500 { + --tw-bg-opacity: 1; + background-color: rgb(99 102 241 / var(--tw-bg-opacity, 1)); +} + .bg-indigo-600 { --tw-bg-opacity: 1; background-color: rgb(79 70 229 / var(--tw-bg-opacity, 1)); @@ -2543,6 +2564,11 @@ select{ padding-right: 0.75rem; } +.px-3\.5 { + padding-left: 0.875rem; + padding-right: 0.875rem; +} + .px-4 { padding-left: 1rem; padding-right: 1rem; @@ -2634,6 +2660,10 @@ select{ padding-bottom: 2.5rem; } +.pb-16 { + padding-bottom: 4rem; +} + .pb-2 { padding-bottom: 0.5rem; } @@ -2742,6 +2772,10 @@ select{ padding-top: 0.375rem; } +.pt-16 { + padding-top: 4rem; +} + .pt-2 { padding-top: 0.5rem; } @@ -2766,10 +2800,6 @@ select{ padding-top: 1.5rem; } -.pt-12 { - padding-top: 3rem; -} - .text-left { text-align: left; } @@ -3607,6 +3637,11 @@ select{ background-color: rgb(199 210 254 / var(--tw-bg-opacity, 1)); } +.hover\:bg-indigo-400:hover { + --tw-bg-opacity: 1; + background-color: rgb(129 140 248 / var(--tw-bg-opacity, 1)); +} + .hover\:bg-indigo-500:hover { --tw-bg-opacity: 1; background-color: rgb(99 102 241 / var(--tw-bg-opacity, 1)); @@ -3913,6 +3948,10 @@ select{ outline-color: #000; } +.focus-visible\:outline-indigo-400:focus-visible { + outline-color: #818cf8; +} + .focus-visible\:outline-indigo-600:focus-visible { outline-color: #4f46e5; } @@ -4650,6 +4689,10 @@ select{ margin-top: 5rem; } + .sm\:mt-5 { + margin-top: 1.25rem; + } + .sm\:block { display: block; } @@ -4852,6 +4895,11 @@ select{ line-height: 1.25rem; } + .sm\:text-xl { + font-size: 1.25rem; + line-height: 1.75rem; + } + .sm\:duration-700 { transition-duration: 700ms; } @@ -5045,6 +5093,10 @@ select{ margin-top: 6rem; } + .lg\:mt-6 { + margin-top: 1.5rem; + } + .lg\:block { display: block; } @@ -5089,6 +5141,10 @@ select{ max-width: 768px; } + .lg\:max-w-xl { + max-width: 36rem; + } + .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } @@ -5148,9 +5204,18 @@ select{ padding-top: 1rem; } + .lg\:pt-8 { + padding-top: 2rem; + } + .lg\:text-center { text-align: center; } + + .lg\:text-lg { + font-size: 1.125rem; + line-height: 1.75rem; + } } @media (min-width: 1280px) { @@ -5192,6 +5257,16 @@ select{ padding-left: 1.25rem; padding-right: 1.25rem; } + + .xl\:text-6xl { + font-size: 3.75rem; + line-height: 1; + } + + .xl\:text-xl { + font-size: 1.25rem; + line-height: 1.75rem; + } } @media (min-width: 1536px) { diff --git a/AiServer/wwwroot/css/lite-yt-embed.css b/AiServer/wwwroot/css/lite-yt-embed.css new file mode 100644 index 0000000..50bc3d1 --- /dev/null +++ b/AiServer/wwwroot/css/lite-yt-embed.css @@ -0,0 +1,93 @@ +lite-youtube { + background-color: #000; + transition: all 0.2s cubic-bezier(0, 0, 0.2, 1); + position: relative; + display: block; + contain: content; + background-position: center center; + background-size: cover; + cursor: pointer; + max-width: 720px; +} + +lite-youtube:hover { + transition: all 0.2s cubic-bezier(0, 0, 0.2, 1); +} + +/* gradient */ +lite-youtube::before { + content: ''; + display: block; + position: absolute; + top: 0; + /*background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsBSA/bFjuF1EOL7VbrIrBuusmrt4ZZORfb6ehbWdnRHEIiITaEUKa5EJqUakRSaEYBJSCY2dEstQY7AuxahwXFrvZmWl2rh4JZ07z9dLtesfNj5q0FU3A5ObbwAAAABJRU5ErkJggg==);*/ + background-position: top; + background-repeat: repeat-x; + height: 60px; + padding-bottom: 50px; + width: 100%; + transition: all 0.2s cubic-bezier(0, 0, 0.2, 1); +} + +/* responsive iframe with a 16:9 aspect ratio + thanks https://css-tricks.com/responsive-iframes/ +*/ +lite-youtube::after { + content: ""; + display: block; + padding-bottom: calc(100% / (16 / 9)); +} +lite-youtube > iframe { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + border: 0; +} + +/* play button */ +lite-youtube > .lty-playbtn { + width: 60px; + height: 42px; + position: absolute; + cursor: pointer; + transform: translate3d(-50%, -50%, 0); + color: white; + top: 50%; + left: 50%; + z-index: 1; + opacity: 30%; + background: transparent url('data:image/svg+xml;utf8,') no-repeat; + filter: grayscale(100%); + border: none; +} + +lite-youtube:hover > .lty-playbtn, +lite-youtube .lty-playbtn:focus { + filter: grayscale(0); + transition: opacity 0.5s, filter .1s cubic-bezier(0, 0, 0.2, 1); + -webkit-transition: opacity 0.5s; + opacity: 100%; + outline: none; +} + +/* Post-click styles */ +lite-youtube.lyt-activated { + cursor: unset; +} +lite-youtube.lyt-activated::before, +lite-youtube.lyt-activated > .lty-playbtn { + opacity: 0; + pointer-events: none; +} + +.lyt-visually-hidden { + clip: rect(0 0 0 0); + clip-path: inset(50%); + height: 1px; + overflow: hidden; + position: absolute; + white-space: nowrap; + width: 1px; +} \ No newline at end of file diff --git a/AiServer/wwwroot/index.html b/AiServer/wwwroot/index.html index 7a03bd3..a406e8d 100644 --- a/AiServer/wwwroot/index.html +++ b/AiServer/wwwroot/index.html @@ -6,6 +6,7 @@ +