Skip to content

Commit

Permalink
Trying to select another language in stoplight crashes the component (#…
Browse files Browse the repository at this point in the history
…109)

Signed-off-by: Nik Nasr <[email protected]>
  • Loading branch information
nikrooz authored Nov 15, 2024
1 parent 414f32d commit 059607d
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 22 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/coverage
/.nx/cache
/.nx/workspace-data
pnpm-lock.yaml
pnpm-lock.yaml
inter.css
6 changes: 1 addition & 5 deletions apps/web-ui/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,8 @@ import {
} from '@restate/features/overview-route';

export const links: LinksFunction = () => [
{
rel: 'preconnect',
href: 'https://rsms.me/',
},
{ rel: 'stylesheet', href: styles },
{ rel: 'stylesheet', href: 'https://rsms.me/inter/inter.css' },
{ rel: 'stylesheet', href: '/ui/inter.css' },
{
rel: 'apple-touch-icon',
href: '/ui/apple-touch-icon.png',
Expand Down
57 changes: 57 additions & 0 deletions apps/web-ui/public/inter.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* Variable fonts usage:
:root { font-family: "Inter", sans-serif; }
@supports (font-variation-settings: normal) {
:root { font-family: "InterVariable", sans-serif; font-optical-sizing: auto; }
} */
@font-face {
font-family: InterVariable;
font-style: normal;
font-weight: 100 900;
font-display: swap;
src: url("InterVariable.woff2") format("woff2");
}
@font-face {
font-family: InterVariable;
font-style: italic;
font-weight: 100 900;
font-display: swap;
src: url("InterVariable-Italic.woff2") format("woff2");
}

/* static fonts */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100; font-display: swap; src: url("Inter-Thin.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 100; font-display: swap; src: url("Inter-ThinItalic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 200; font-display: swap; src: url("Inter-ExtraLight.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 200; font-display: swap; src: url("Inter-ExtraLightItalic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 300; font-display: swap; src: url("Inter-Light.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 300; font-display: swap; src: url("Inter-LightItalic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("Inter-Regular.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 400; font-display: swap; src: url("Inter-Italic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("Inter-Medium.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 500; font-display: swap; src: url("Inter-MediumItalic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("Inter-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 600; font-display: swap; src: url("Inter-SemiBoldItalic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("Inter-Bold.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 700; font-display: swap; src: url("Inter-BoldItalic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 800; font-display: swap; src: url("Inter-ExtraBold.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 800; font-display: swap; src: url("Inter-ExtraBoldItalic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 900; font-display: swap; src: url("Inter-Black.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 900; font-display: swap; src: url("Inter-BlackItalic.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 100; font-display: swap; src: url("InterDisplay-Thin.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 100; font-display: swap; src: url("InterDisplay-ThinItalic.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 200; font-display: swap; src: url("InterDisplay-ExtraLight.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 200; font-display: swap; src: url("InterDisplay-ExtraLightItalic.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 300; font-display: swap; src: url("InterDisplay-Light.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 300; font-display: swap; src: url("InterDisplay-LightItalic.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 400; font-display: swap; src: url("InterDisplay-Regular.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 400; font-display: swap; src: url("InterDisplay-Italic.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 500; font-display: swap; src: url("InterDisplay-Medium.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 500; font-display: swap; src: url("InterDisplay-MediumItalic.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 600; font-display: swap; src: url("InterDisplay-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 600; font-display: swap; src: url("InterDisplay-SemiBoldItalic.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 700; font-display: swap; src: url("InterDisplay-Bold.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 700; font-display: swap; src: url("InterDisplay-BoldItalic.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 800; font-display: swap; src: url("InterDisplay-ExtraBold.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 800; font-display: swap; src: url("InterDisplay-ExtraBoldItalic.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 900; font-display: swap; src: url("InterDisplay-Black.woff2") format("woff2"); }
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 900; font-display: swap; src: url("InterDisplay-BlackItalic.woff2") format("woff2"); }
6 changes: 5 additions & 1 deletion libs/features/overview-route/src/lib/StopLight.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import 'prismjs';
import { Prism } from 'prism-react-renderer';
import { lazy } from 'react';

if (typeof window !== 'undefined') {
(window as any).Prism = Prism;
}

export const API = lazy(() =>
import('@stoplight/elements').then((module) => ({ default: module.API }))
);
Expand Down
9 changes: 9 additions & 0 deletions libs/ui/layout/src/lib/Complementary.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.overlay {
visibility: hidden;
}

@supports selector(:has(*)) {
.overlay:has(+ aside [data-complementary-content] > *) {
visibility: visible;
}
}
7 changes: 5 additions & 2 deletions libs/ui/layout/src/lib/ComplementaryOutlet.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { PropsWithChildren } from 'react';
import styles from './Complementary.module.css';

interface ComplementaryProps {
id?: string;
Expand All @@ -9,8 +10,10 @@ export function ComplementaryOutlet(
) {
return (
<>
<div className="sm:pointer-events-none [background-image:none] 3xl:[background-image:none] sm:bg-gradient-to-l from-zinc-800/20 to-transparent to-50% [&:not(:has(+aside_[data-complementary-content]>*))]:hidden fixed z-50 sm:z-30 inset-0 bg-gray-800 sm:bg-transparent bg-opacity-30 transition-opacity" />
<aside className="[&:has(>*>*)]:duration-250 [&:has(>*>*)]:animate-in [&:has(>*>*)]:slide-in-from-right [&:has(>*>*)]:fade-in [&:not(has(>*>*))]:duration-250 flex flex-col 3xl:sticky top-[50%] left-[50%] -translate-x-1/2 -translate-y-1/2 sm:translate-y-0 sm:translate-x-0 sm:top-24 3xl:top-[calc(0.75rem+3.5rem+2.5rem)] 3xl:px-0 3xl:pt-8 [&:not(:has([data-complementary-content]>*))]:hidden fixed z-50 lg:right-8 sm:right-6 right-auto sm:left-auto lg:bottom-6 sm:bottom-6 bottom-3 max-w-[100vw] 3xl:max-h-auto sm:max-h-none lg:max-h-none 3xl:max-h-none">
<div
className={`${styles.overlay} sm:pointer-events-none [background-image:none] 3xl:[background-image:none] sm:bg-gradient-to-l from-zinc-800/20 to-transparent to-50% fixed z-50 sm:z-30 inset-0 bg-gray-800 sm:bg-transparent bg-opacity-30 transition-opacity`}
/>
<aside className="[&:has(>*>*)]:duration-250 [&:has(>*>*)]:animate-in [&:has(>*>*)]:slide-in-from-right [&:has(>*>*)]:fade-in [&:not(has(>*>*))]:duration-250 flex flex-col 3xl:sticky top-[50%] left-[50%] -translate-x-1/2 -translate-y-1/2 sm:translate-y-0 sm:translate-x-0 sm:top-24 3xl:top-[calc(0.75rem+3.5rem+2.5rem)] 3xl:px-0 3xl:pt-8 [&:not(:has([data-complementary-content]>*))]:hidden fixed z-50 lg:right-8 sm:right-6 right-auto sm:left-auto lg:bottom-6 sm:bottom-6 max-h-[90vh] max-w-[100vw] 3xl:max-h-auto sm:max-h-none lg:max-h-none 3xl:max-h-none">
<div
{...props}
className="3xl:h-auto h-full flex-auto 3xl:flex-none p-1.5 border shadow-lg 3xl:shadow-sm shadow-zinc-800/5 bg-gray-50/80 backdrop-blur-xl backdrop-saturate-200 rounded-[1.125rem] max-h-[inherit] flex flex-col max-w-[90vw] w-[350px]"
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"ky": "1.5.0",
"lucide-react": "0.424.0",
"openapi-fetch": "0.12.0",
"prismjs": "1.29.0",
"prism-react-renderer": "1.3.5",
"react": "19.0.0-rc-83825814-20241015",
"react-aria": "3.35.1",
"react-aria-components": "1.4.1",
Expand Down Expand Up @@ -74,7 +74,6 @@
"@types/jest": "29.5.13",
"@types/koa": "2.13.12",
"@types/node": "18.16.9",
"@types/prismjs": "1.26.5",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"@types/react-responsive-masonry": "2.1.3",
Expand Down
14 changes: 3 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 059607d

Please sign in to comment.