File size: 2,743 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import { globalStyle, style } from '@vanilla-extract/css'
import { vars } from '../../styles/theme-contract.css'
import { recipe } from '@vanilla-extract/recipes'
import { BREAKPOINTS } from '../../styles/breakpoints.css'
import { darkThemeClass } from '../../styles/dark-theme.css'

export const tableCell = style({
  fontFamily: vars.fonts.mono,
  fontSize: vars.fontSizes.XS,
  lineHeight: vars.lineHeights.XS,
  padding: `${vars.space['15']} 0`,
  paddingRight: vars.space['10'],
})

export const tableCellIsPropName = style({})

globalStyle(`${tableCell} code`, {
  borderRadius: vars.radii.r4,
  padding: '2px 5px',
  backgroundColor: vars.colors.steel20,
  color: vars.colors.steel80,

  [`${darkThemeClass} &`]: {
    color: vars.colors.steel40,
  },
})

globalStyle(`${tableCellIsPropName} > code`, {
  backgroundColor: '#ff6d6d33',
  color: vars.colors.red100,
})

export const tableCellIsThirdItem = style({
  display: 'none',

  [`screen and ${BREAKPOINTS.tabletUp}`]: {
    display: 'table-cell',
  },
})

export const popoverTrigger = style({
  background: 'transparent',
  border: 'none',
  padding: 0,
  margin: 0,
  marginLeft: vars.space['5'],
  cursor: 'pointer',
  width: 24,
  height: 24,
  borderRadius: vars.radii.r4,
  display: 'inline-flex',
  alignItems: 'center',
  justifyContent: 'center',
  position: 'relative',
  top: 3,

  '@media': {
    '(hover: hover)': {
      ':hover': {
        background: '#ff6d6d66',
      },
    },
  },
})

export const popoverArrow = style({
  fill: vars.colors.codeBackground,
})

export const popoverBaseContent = style({})

export const popoverContent = recipe({
  base: {
    fontFamily: vars.fonts['sans-var'],
    fontSize: vars.fontSizes.XXS,
    lineHeight: vars.lineHeights.XXS,
    padding: `${vars.space['10']} ${vars.space['15']}`,
    background: vars.colors.codeBackground,
    borderRadius: vars.radii.r8,

    scrollbarWidth: 'none',
    '::-webkit-scrollbar': {
      display: 'none',
    },
  },

  variants: {
    isProp: {
      true: {
        maxWidth: 265,
      },
      false: {
        maxWidth: 400,
        overflow: 'scroll',
      },
    },
  },
})

globalStyle(`${popoverBaseContent} code`, {
  borderRadius: vars.radii.r4,
  padding: '0.2rem 0.5rem',
  whiteSpace: 'nowrap',
})

globalStyle(`${popoverBaseContent} a`, {
  position: 'relative',
  textDecoration: 'none',
})

globalStyle(`${popoverBaseContent} a::after`, {
  position: 'absolute',
  bottom: -1,
  left: 0,
  content: '',
  width: '100%',
  height: 2,
  backgroundColor: vars.colors.red100,

  '@media': {
    '(prefers-reduced-motion: no-preference)': {
      transition: 'width 200ms ease-out',
    },
  },
})

globalStyle(`${popoverBaseContent} a:hover::after`, {
  width: '0%',
})