Files
supabase/apps/www/components/CodeWindow.tsx
Francesco Sansalvadore 3b11b9e1d7 update functions page (#22111)
* add products pag subnav

* functions page first sections

* new functions page sections

* functions dx section images

* functions hero layout setup

* functions page hero animation

* final cta

* revisit functions page structure

* functions realtime logs animation

* functions query logs animation

* function metrics chart

* finish edge functions hero animation

* finish edge functions metrics graph

* update products cta section

* edge functions page code cleanup

* restore Panel

* restore code block bg

* pause timed sections when not in view to optimize perf

* create new code window component and add functions code snippets

* finish edge functions

* update functions page

* improve animation timing in functions page

* fix type error

* clean up functions page code

* update swiper and fix hydration errors

* fix swiper module import

* fix swiper css import

* image bg

* edge functions page details fix

* fix scroll bug

* edge functions page

* finalize edge functions page

* add anchors and improve semantics

* remove double prop

* add links to docs

* add link to edge runtime

* fix timed panel progress bar retrigger

* fix timed accordion progress bar retrigger
2024-04-10 11:51:26 +02:00

38 lines
1.0 KiB
TypeScript

import React from 'react'
import { cn } from 'ui'
import CodeBlock from './CodeBlock/CodeBlock'
import type { LANG } from './CodeBlock/CodeBlock'
interface Props {
code: any
lang?: LANG
className?: string
style?: React.CSSProperties
showLineNumbers?: boolean
}
const CodeWindow = ({ code, lang, style, className, showLineNumbers }: Props) => {
return (
<div
className={cn(
'relative rounded-2xl shadow-lg p-2 pt-0 w-full h-full bg-alternative-200 border flex flex-col',
className
)}
style={style}
>
<div className="w-full px-2 py-3 relative flex items-center gap-1.5 lg:gap-2">
<div className="w-2 h-2 bg-border rounded-full" />
<div className="w-2 h-2 bg-border rounded-full" />
<div className="w-2 h-2 bg-border rounded-full" />
</div>
<div className="h-full w-full rounded-lg">
<CodeBlock lang={lang ?? 'js'} size="small" showLineNumbers={showLineNumbers}>
{code}
</CodeBlock>
</div>
</div>
)
}
export default CodeWindow