The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: add optional toolbar to codeblock. adjust colors
Jonathan Summers-Muirf9f7aaa50102
diff --git a/www/components/CodeBlock/CodeBlock.module.css b/www/components/CodeBlock/CodeBlock.module.cssindex a1b9c207914..327ea37ffa7 100644--- a/www/components/CodeBlock/CodeBlock.module.css+++ b/www/components/CodeBlock/CodeBlock.module.css@@ -1,6 +1,10 @@.code-block {@apply overflow-hidden rounded-lg;- @apply border border-scale-500;+ @apply border;+}++.code-block--show-toolbar {+ @apply rounded-t-none !important;}.code-line {diff --git a/www/components/CodeBlock/CodeBlock.tsx b/www/components/CodeBlock/CodeBlock.tsxindex e47cc81751b..e4546166ba1 100644--- a/www/components/CodeBlock/CodeBlock.tsx+++ b/www/components/CodeBlock/CodeBlock.tsx@@ -28,6 +28,10 @@ interface Props {* 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}function CodeBlock(props: Props) {@@ -67,16 +71,28 @@ function CodeBlock(props: Props) {return (<div className="relative">+ {props.showToolbar && (+ <div className="bg-scale-200 border 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-400 rounded-full"></div>+ <div className="w-2.5 h-2.5 bg-scale-400 rounded-full"></div>+ <div className="w-2.5 h-2.5 bg-scale-400 rounded-full"></div>+ </div>+ {/* <span className="text-scale-900 font-mono text-xs">hello.tsx</span> */}+ </div>+ )}<SyntaxHighlighterlanguage={lang}style={monokaiCustomTheme}- className={CodeBlockStyles['code-block']}+ className={[+ CodeBlockStyles['code-block'],+ props.showToolbar ? CodeBlockStyles['code-block--show-toolbar'] : '',+ ].join(' ')}customStyle={{padding: 0,fontSize: large ? 18 : 12,lineHeight: large ? 1.2 : 1.2,- borderTop: '1px solid #393939',- background: '#181818',+ background: 'var(--colors-gray1)',...props.style,}}showLineNumbers={lang === 'cli' ? false : true}@@ -87,10 +103,10 @@ function CodeBlock(props: Props) {display: 'inline-flex',justifyContent: 'flex-end',minWidth: '48px',- background: '#1e1e1e',+ background: 'var(--colors-scale1)',paddingLeft: '21px',marginRight: '12px',- color: '#828282',+ color: 'var(--colors-scale8)',fontSize: large ? 14 : 12,paddingTop: '4px',paddingBottom: '4px',@@ -100,6 +116,7 @@ function CodeBlock(props: Props) {>{props.children}</SyntaxHighlighter>+{!props.hideCopy && props.children ? (<div className="absolute right-2 top-2 dark"><CopyToClipboard text={props.children}>diff --git a/www/pages/edge-functions/edge-functions.tsx b/www/pages/edge-functions/edge-functions.tsxindex d1595962c62..f2f5eee7189 100644--- a/www/pages/edge-functions/edge-functions.tsx+++ b/www/pages/edge-functions/edge-functions.tsx@@ -165,6 +165,8 @@ function Database() {</div><div className="col-span-7 overflow-hidden"><CodeBlock+ showToolbar+ hideCopystyle={{ maxHeight: '520px' }}className=" translate-y-14">{`import Container from 'components/Container'