1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-10-29 02:55:48 -04:00

CSS modules ➡️ Stitches 🧵 (#799)

This commit is contained in:
2022-03-03 09:18:26 -05:00
committed by GitHub
parent ac7ac71c10
commit c2dde042b7
93 changed files with 2392 additions and 3000 deletions

View File

@@ -1,7 +0,0 @@
.frame {
width: 100%;
display: block;
margin: 1em auto;
border: 2px solid var(--kinda-light);
border-radius: var(--rounded-edge-radius);
}

View File

@@ -1,8 +1,15 @@
import classNames from "classnames";
import { styled } from "../../lib/styles/stitches.config";
import type { ComponentProps } from "react";
import styles from "./IFrame.module.css";
const RoundedIFrame = styled("iframe", {
width: "100%",
display: "block",
margin: "1em auto",
border: "2px solid $kindaLight",
borderRadius: "$rounded",
});
export type IFrameProps = JSX.IntrinsicElements["iframe"] & {
export type IFrameProps = ComponentProps<typeof RoundedIFrame> & {
src: string;
height: number;
width?: number; // defaults to 100%
@@ -10,17 +17,16 @@ export type IFrameProps = JSX.IntrinsicElements["iframe"] & {
noScroll?: boolean;
};
const IFrame = ({ src, title, height, width, allowScripts, noScroll, className, ...rest }: IFrameProps) => (
<iframe
className={classNames(styles.frame, className)}
const IFrame = ({ src, title, height, width, allowScripts, noScroll, ...rest }: IFrameProps) => (
<RoundedIFrame
src={src}
title={title}
sandbox={allowScripts ? "allow-same-origin allow-scripts allow-popups" : undefined}
scrolling={noScroll ? "no" : undefined}
loading="lazy"
style={{
css={{
height: `${height}px`,
maxWidth: width ? `${width}px` : undefined,
maxWidth: width ? `${width}px` : null,
}}
{...rest}
/>