File size: 1,105 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"use client"

import { Center, CenterProps, chakra } from "@chakra-ui/react"

export const DemoFrame = chakra(
  "div",
  {
    base: {
      borderWidth: "0.5px",
      borderColor: { _light: "border", _dark: "#001B18" },
      width: "400px",
      flexShrink: "0",
      height: "100%",
      position: "relative",
      userSelect: "none",
      pb: "4",
      focusRing: "inside",
    },
  },
  {
    defaultProps: {
      tabIndex: 0,
      onFocusCapture(e: React.FocusEvent<HTMLDivElement>) {
        const activeEl = document.activeElement
        if (activeEl === e.currentTarget) {
          e.currentTarget?.scrollIntoView({
            inline: "nearest",
            block: "nearest",
          })
        }
      },
    },
  },
)

export const DemoFrameText = chakra("div", {
  base: {
    textStyle: "sm",
    color: "fg.muted",
    fontFamily: "mono",
    textAlign: "center",
  },
})

export const DemoFrameContent = (props: CenterProps) => {
  const { children, ...rest } = props
  return (
    <Center mx="auto" maxW="200px" minH="240px" {...rest}>
      {children}
    </Center>
  )
}