Skip to content

Usenet streaming with a WebDAV server and a SABnzbd-compatible API

C#
829 B
Raw Blame
import type { ReactNode } from "react"
import { memo, useId } from "react"
import styles from "./thin-viewport.module.css"

export type ThinViewportProps = {
    width: string,
    children: ReactNode,
}

export const ThinViewport = memo(({ width, children }: ThinViewportProps) => {
    const id = useId();
    const uniqueId = `thin-viewport-${id.replace(/:/g, '-')}`;

    return (
        <>
            <style dangerouslySetInnerHTML={{
                __html: `
                    @media (min-width: ${width}) {
                        .${uniqueId} {
                            display: none !important;
                        }
                    }
                `
            }} />
            <div className={`${styles.container} ${uniqueId}`}>
                {children}
            </div>
        </>
    );
});