Add Video component for Astro Starlight documentation#13902
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
docs/astro.config.mjs
Outdated
| { label: 'Custom Agents', link: '/reference/copilot-custom-agents/' }, | ||
| { label: 'GH-AW as MCP Server', link: '/setup/mcp-server/' }, | ||
| { label: 'MCP Gateway', link: '/reference/mcp-gateway/' }, | ||
| { label: 'Video Component', link: '/reference/video-component/' }, |
docs/public/videos/README.md
Outdated
| Place video files here and reference them in documentation using the Video component: | ||
|
|
||
| ```mdx | ||
| import Video from '../../../components/Video.astro'; |
docs/src/components/Video.astro
Outdated
| @@ -0,0 +1,160 @@ | |||
| --- | |||
…ate imports Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
This pull request adds a Video component to the Astro Starlight documentation for displaying video files hosted in the public folder. The implementation includes comprehensive TypeScript props, responsive styling, accessibility features, and documentation.
Changes:
- New Video.astro component with aspect ratio support, autoplay controls, and accessibility features
- Custom CSS styling in docs/src/styles/custom.css with theme support and responsive design
- Public videos directory with README documentation for usage guidelines
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| docs/src/components/Video.astro | New Astro component with TypeScript interface for displaying videos with configurable aspect ratios, controls, and captions |
| docs/src/styles/custom.css | Global CSS styles for Video component with light/dark theme support and responsive design |
| docs/public/videos/README.md | Documentation for using the Video component and managing video files |
Comments suppressed due to low confidence (1)
docs/public/videos/README.md:10
- The
@componentsimport alias used in the README examples doesn't exist in this codebase. The tsconfig.json and astro.config.mjs don't configure this alias.
Other components in the codebase (like FeatureCard at docs/src/content/docs/index.mdx:20) use relative paths like '../../components/Video.astro'. The README should follow the same pattern for consistency.
import Video from '@components/Video.astro';
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 2. Reference it in your MDX file: | ||
|
|
||
| ```mdx | ||
| import Video from '@components/Video.astro'; |
There was a problem hiding this comment.
The @components import alias used here doesn't exist in this codebase. Other components use relative paths like '../../components/Video.astro'. Update this example to use the correct relative import pattern based on where the MDX file will be located.
| muted={silenced} | ||
| poster={thumbnail} | ||
| preload="metadata" | ||
| aria-label={caption} |
There was a problem hiding this comment.
The aria-label attribute is set to the caption prop value, but when caption is undefined (which is common), this results in aria-label={undefined} which doesn't provide meaningful accessibility information. Consider providing a fallback or making the aria-label conditional. For example: aria-label={caption || 'Video content'}
| aria-label={caption} | |
| aria-label={caption || 'Video content'} |
| /* Video Component Styles */ | ||
| .gh-aw-video-wrapper { | ||
| margin: 2rem auto; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .gh-aw-video-container { | ||
| position: relative; | ||
| width: 100%; | ||
| background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%); | ||
| border-radius: 12px; | ||
| overflow: hidden; | ||
| box-shadow: | ||
| 0 8px 16px rgba(0, 0, 0, 0.4), | ||
| 0 0 0 1px rgba(255, 255, 255, 0.05); | ||
| transition: box-shadow 0.3s ease; | ||
| } | ||
|
|
||
| .gh-aw-video-container:hover { | ||
| box-shadow: | ||
| 0 12px 24px rgba(0, 0, 0, 0.5), | ||
| 0 0 0 1px rgba(139, 92, 246, 0.3); | ||
| } | ||
|
|
||
| .gh-aw-video-container.has-aspect-ratio { | ||
| height: 0; | ||
| padding-bottom: 56.25%; | ||
| } | ||
|
|
||
| .gh-aw-video-element { | ||
| width: 100%; | ||
| height: 100%; | ||
| display: block; | ||
| background-color: #000; | ||
| } | ||
|
|
||
| .has-aspect-ratio .gh-aw-video-element { | ||
| position: absolute; | ||
| top: 0; | ||
| left: 0; | ||
| width: 100%; | ||
| height: 100%; | ||
| object-fit: contain; | ||
| } | ||
|
|
||
| .gh-aw-video-caption { | ||
| margin-top: 0.75rem; | ||
| padding: 0.5rem 1rem; | ||
| font-size: 0.9rem; | ||
| color: var(--sl-color-gray-3); | ||
| text-align: center; | ||
| background: var(--sl-color-gray-6); | ||
| border-left: 3px solid var(--sl-color-purple); | ||
| border-radius: 0 6px 6px 0; | ||
| font-style: italic; | ||
| } | ||
|
|
||
| [data-theme='light'] .gh-aw-video-container { | ||
| background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%); | ||
| box-shadow: | ||
| 0 8px 16px rgba(0, 0, 0, 0.15), | ||
| 0 0 0 1px rgba(0, 0, 0, 0.08); | ||
| } | ||
|
|
||
| [data-theme='light'] .gh-aw-video-container:hover { | ||
| box-shadow: | ||
| 0 12px 24px rgba(0, 0, 0, 0.2), | ||
| 0 0 0 1px rgba(102, 57, 186, 0.3); | ||
| } | ||
|
|
||
| [data-theme='light'] .gh-aw-video-caption { | ||
| color: var(--sl-color-gray-2); | ||
| background: var(--sl-color-gray-7); | ||
| } | ||
|
|
||
| @media (max-width: 768px) { | ||
| .gh-aw-video-wrapper { | ||
| margin: 1.5rem auto; | ||
| } | ||
| } | ||
|
|
||
| @media (prefers-reduced-motion: reduce) { | ||
| .gh-aw-video-container { | ||
| transition: none; | ||
| } | ||
| } |
There was a problem hiding this comment.
The CSS class naming pattern gh-aw-video-* is unique to this component. Other components in the codebase (FeatureCard.astro, ResponsiveTable.astro) use inline <style> blocks with non-prefixed class names specific to their component. This creates an inconsistency where only the Video component styles are in the global CSS file. Consider either:
- Moving these styles to a
<style>block in Video.astro to match existing component patterns, or - Documenting why Video requires global styles (if there's a specific reason)
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.