The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: padding for first and last lines in code block
Alaister Youngaf3aa90de09d
diff --git a/www/components/CodeBlock/CodeBlock.module.css b/www/components/CodeBlock/CodeBlock.module.cssindex 91af93b19cc..a1b9c207914 100644--- a/www/components/CodeBlock/CodeBlock.module.css+++ b/www/components/CodeBlock/CodeBlock.module.css@@ -1,22 +1,34 @@.code-block {- @apply rounded-lg overflow-hidden;+ @apply overflow-hidden rounded-lg;@apply border border-scale-500;}-.code-block::before {- content: '';- background: #1e1e1e;- height: 10px;- width: 48px;- display: block;+.code-line {+ transition: filter 500ms ease, opacity 500ms ease;}-.code-block::after {- content: '';- background: #1e1e1e;- height: 12px;- width: 48px;- display: block;+.code-block .code-line:first-of-type {+ @apply flex items-end h-8;+}++.code-block .code-line:first-of-type :global(.linenumber) {+ @apply items-end self-stretch;+}++.code-block .code-line:first-of-type > :global(*:not(.linenumber)) {+ @apply pb-1;+}++.code-block .code-line:last-of-type {+ @apply flex items-start h-8;+}++.code-block .code-line:last-of-type :global(.linenumber) {+ @apply items-start self-stretch;+}++.code-block .code-line:last-of-type > :global(*:not(.linenumber)) {+ @apply pt-1;}.code-block code .linenumber {diff --git a/www/components/CodeBlock/CodeBlock.tsx b/www/components/CodeBlock/CodeBlock.tsxindex 909a931625a..57db4851c53 100644--- a/www/components/CodeBlock/CodeBlock.tsx+++ b/www/components/CodeBlock/CodeBlock.tsx@@ -51,15 +51,11 @@ function CodeBlock(props: Props) {const lineProps = useCallback((lineNumber: number) => {- const shouldHighlightLine = highlightLines.has(lineNumber)+ const shouldHighlightLine = !shouldHighlightLines || highlightLines.has(lineNumber)- const transition = `filter 500ms ease, opacity 500ms ease`+ const style = shouldHighlightLine ? {} : { filter: 'grayscale(75%)', opacity: 0.5 }- const style = shouldHighlightLine- ? { transition }- : { transition, filter: 'grayscale(75%)', opacity: 0.5 }-- return { style }+ return { class: CodeBlockStyles['code-line'], style }},[highlightLines])@@ -82,6 +78,8 @@ function CodeBlock(props: Props) {paddingTop: '128px',}}lineNumberStyle={{+ display: 'inline-flex',+ justifyContent: 'flex-end',minWidth: '48px',background: '#1e1e1e',paddingLeft: '21px',@@ -91,7 +89,7 @@ function CodeBlock(props: Props) {paddingTop: '4px',paddingBottom: '4px',}}- wrapLines={shouldHighlightLines}+ wrapLines={true}lineProps={lineProps}>{props.children}