The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: move window frame to scrollable code block
Alaister Youngb34fe2f168c7
diff --git a/www/components/CodeBlock/CodeBlock.module.css b/www/components/CodeBlock/CodeBlock.module.cssindex 6b6479d6d96..dd03e06097d 100644--- a/www/components/CodeBlock/CodeBlock.module.css+++ b/www/components/CodeBlock/CodeBlock.module.css@@ -1,13 +1,10 @@.code-block {- @apply overflow-hidden rounded-lg;-}--.code-block--show-toolbar {- @apply rounded-t-none !important;+ @apply overflow-hidden;}.code-line {transition: filter 500ms ease, opacity 500ms ease;+ transition-delay: 200ms;}.code-block .code-line:first-of-type {diff --git a/www/components/CodeBlock/CodeBlock.tsx b/www/components/CodeBlock/CodeBlock.tsxindex 4bfa5ab8821..bd6e7e723c9 100644--- a/www/components/CodeBlock/CodeBlock.tsx+++ b/www/components/CodeBlock/CodeBlock.tsx@@ -28,10 +28,7 @@ export interface CodeBlockProps {* Supports individual lines: '14', multiple lines: '14,15', or a range of lines '14..19'*/highlightLines?: string- /**- * Shows an application toolbar at the top- */- showToolbar?: boolean+ hideBorder?: boolean}function CodeBlock(props: CodeBlockProps) {@@ -71,23 +68,13 @@ function CodeBlock(props: CodeBlockProps) {return (<div className="relative">- {props.showToolbar && (- <div className="bg-scale-1200 dark:bg-scale-200 border border-scale-1200 dark:border-scale-400 border-b-0 h-7 w-full rounded-t-lg flex gap-1.5 items-center px-4">- <div className="flex items-center gap-1.5">- <div className="w-2.5 h-2.5 bg-scale-1100 dark:bg-scale-400 rounded-full"></div>- <div className="w-2.5 h-2.5 bg-scale-1100 dark:bg-scale-400 rounded-full"></div>- <div className="w-2.5 h-2.5 bg-scale-1100 dark:bg-scale-400 rounded-full"></div>- </div>- </div>- )}<SyntaxHighlighterlanguage={lang}style={monokaiCustomTheme}className={[CodeBlockStyles['code-block'],- props.showToolbar ? CodeBlockStyles['code-block--show-toolbar'] : '','!bg-scale-1200 dark:!bg-scale-100',- 'border border-scale-1100 dark:border-scale-400',+ props.hideBorder ? '' : 'rounded-lg border border-scale-1100 dark:border-scale-400',].join(' ')}customStyle={{padding: 0,diff --git a/www/components/ScrollableCodeBlock.tsx b/www/components/ScrollableCodeBlock.tsxindex 400d9931e61..3b0a41dd4dd 100644--- a/www/components/ScrollableCodeBlock.tsx+++ b/www/components/ScrollableCodeBlock.tsx@@ -5,15 +5,20 @@ import CodeBlock, { CodeBlockProps } from './CodeBlock/CodeBlock'interface ScrollableCodeBlockProps extends CodeBlockProps {highlightLines: stringchildren: string+ /**+ * Shows an application toolbar at the top+ */+ showToolbar?: boolean}const MAX_HEIGHT = 520const CODE_LINE_HEIGHT = 22-const TOP_OFFSET = 30+const TOP_OFFSET = 4const ScrollableCodeBlock = ({highlightLines: highlightLinesRange,children,+ showToolbar,...props}: ScrollableCodeBlockProps) => {const highlightLines = useMemo(@@ -30,14 +35,29 @@ const ScrollableCodeBlock = ({const position = Math.max(middlePosition - MAX_HEIGHT / 2 + TOP_OFFSET, 0)return (- <div className="overflow-hidden" style={{ maxHeight: MAX_HEIGHT }}>+ <div>+ {showToolbar && (+ <div className="bg-scale-1200 dark:bg-scale-200 border border-scale-1200 dark:border-scale-400 border-b-0 h-7 w-full rounded-t-lg flex gap-1.5 items-center px-4">+ <div className="flex items-center gap-1.5">+ <div className="w-2.5 h-2.5 bg-scale-1100 dark:bg-scale-400 rounded-full"></div>+ <div className="w-2.5 h-2.5 bg-scale-1100 dark:bg-scale-400 rounded-full"></div>+ <div className="w-2.5 h-2.5 bg-scale-1100 dark:bg-scale-400 rounded-full"></div>+ </div>+ </div>+ )}+<div- className="transition-transform duration-500"- style={{ transform: `translate3d(0, -${position}px, 0)` }}+ className="overflow-hidden border rounded-b-lg border-scale-1100 dark:border-scale-400"+ style={{ maxHeight: MAX_HEIGHT, transform: 'translateZ(0)' }}>- <CodeBlock highlightLines={highlightLinesRange} {...props}>- {children + '\n'.repeat(100)}- </CodeBlock>+ <div+ className="transition-transform duration-500"+ style={{ transform: `translate3d(0, -${position}px, 0)` }}+ >+ <CodeBlock highlightLines={highlightLinesRange} hideBorder={true} {...props}>+ {children + '\n'.repeat(100)}+ </CodeBlock>+ </div></div></div>)diff --git a/www/pages/edge-functions/edge-functions.tsx b/www/pages/edge-functions/edge-functions.tsxindex 8fb6637e3f8..6822e1457a4 100644--- a/www/pages/edge-functions/edge-functions.tsx+++ b/www/pages/edge-functions/edge-functions.tsx@@ -85,7 +85,7 @@ function Database() {const meta_title = `${title}`const meta_description = subtitle- const highlightLines = ['1..8', '11..23', '28', '31']+ const highlightLines = ['1..8', '11..21', '28', '31']const [currentSelection, setCurrentSelection] = useState(highlightLines[0])