@@ -4,8 +4,9 @@ import ReactMarkdown from "react-markdown"
44import FormattedLink from "../../../components/FormattedLink"
55import Main from "../../../components/Main"
66import { getGuides , urlify , yeetBrackets } from "../../../utils/data-cache"
7- import { Guide , GuidePage } from "../../../utils/types"
7+ import { Guide } from "../../../utils/types"
88import YouTube from "react-youtube"
9+ import styles from "../../style.module.css"
910
1011interface Props {
1112 guide : Guide
@@ -50,21 +51,38 @@ export default function GuideWebpage({ guide, pageNumber, location }: Props & {
5051 </ div >
5152 </ div >
5253
53- < ul >
54+ < div >
5455 < ReactMarkdown > { ( page . desc ?. replace ( / ? \$ \{ .* ?\} / g, "" ) ?? "" ) } </ ReactMarkdown >
5556 { page . img && < ExternalImg src = { page . img } /> }
5657 { page . url && page . url . startsWith ( "https://youtu.be/" ) && < div >
57- < h2 className = "text-xl font-semibold pt-1" > Video:</ h2 >
58- < YouTube videoId = { page . url . replace ( "https://youtu.be/" , "" ) } containerClassName = "w-xl" className = "w-xl" />
58+ < h2 className = "text-xl font-semibold py-1" > Video:</ h2 >
59+ < div style = { {
60+ position : "relative" ,
61+ paddingBottom : "56.25%" /* 16:9 */ ,
62+ paddingTop : 25 ,
63+ height : 0
64+ } } >
65+ < iframe
66+ style = { {
67+ position : "absolute" ,
68+ top : 0 ,
69+ left : 0 ,
70+ width : "100%" ,
71+ height : "100%"
72+ } }
73+ src = { `https://www.youtube.com/embed/${ page . url . replace ( "https://youtu.be/" , "" ) } ` }
74+ frameBorder = "0"
75+ />
76+ </ div >
5977 </ div >
6078 }
61- </ ul >
79+ </ div >
6280 </ Main >
6381 )
6482}
6583function ExternalImg ( { src } : { src : string } ) {
6684 // eslint-disable-next-line @next/next/no-img-element
67- return < FormattedLink href = { src } target = "_blank" > < img className = " p-1 relative max-w-4xl" style = { { maxHeight : "56rem" } } decoding = "async" alt = "Guide Image" src = { src } /> </ FormattedLink >
85+ return < FormattedLink href = { src } target = "_blank" > < img className = { ` p-1 relative ${ styles . autosize } ` } decoding = "async" alt = "Guide Image" src = { src } /> </ FormattedLink >
6886 // return <div className="p-1 relative max-w-2xl">
6987 // <Image alt="Guide Image" src={src} width={825} height={963}/>
7088 // </div>
@@ -87,7 +105,7 @@ export async function getStaticProps(context: GetStaticPropsContext): Promise<Ge
87105
88106 return {
89107 props : {
90- guide,
108+ guide, // TODO optimize
91109 pageNumber
92110 } ,
93111 revalidate : 60 * 60
0 commit comments