File size: 1,460 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
54
55
56
57
import React from 'react';
import { createStyles } from 'antd-style';

const useStyle = createStyles(({ token, css }) => ({
  browserMockup: css`
    position: relative;
    border-top: 2em solid rgba(230, 230, 230, 0.7);
    border-radius: ${token.borderRadiusSM}px ${token.borderRadiusSM}px 0 0;
    box-shadow: 0 0.1em 0.5em 0 rgba(0, 0, 0, 0.28);
    &::before {
      position: absolute;
      top: -1.25em;
      inset-inline-start: 1em;
      display: block;
      width: 0.5em;
      height: 0.5em;
      background-color: #f44;
      border-radius: 50%;
      box-shadow:
        0 0 0 2px #f44,
        1.5em 0 0 2px #9b3,
        3em 0 0 2px #fb5;
      content: '';
    }
    &::after {
      content: '';
      display: block;
      position: absolute;
      top: -1.6em;
      inset-inline-start: 5.5em;
      width: calc(100% - 6em);
      height: 1.2em;
      background-color: #fff;
      border-radius: ${token.borderRadiusSM}px;
    }
    & > * {
      display: block;
    }
    [data-prefers-color='dark'] & {
      border-top: 2em solid rgba(80, 80, 80, 0.7);
      box-shadow: 0 0.1em 0.5em 0 rgba(0, 0, 0, 0.6);
      background-color: #000; /* 可选 */

      &::after {
        background-color: #333;
      }
    }
  `,
}));

const BrowserFrame: React.FC<React.PropsWithChildren> = ({ children }) => {
  const { styles } = useStyle();
  return <div className={styles.browserMockup}>{children}</div>;
};

export default BrowserFrame;