@@ -2,17 +2,49 @@ import React, {useEffect, useRef, useState} from 'react'
2
2
import type { Args , Meta } from '@storybook/react'
3
3
import { FocusKeys } from '@primer/behaviors'
4
4
5
- import { Box , Button } from '..'
5
+ import { Avatar , Box , Text } from '..'
6
6
import { AnchoredOverlay } from '../AnchoredOverlay'
7
7
import Heading from '../Heading'
8
+ import Octicon from '../Octicon'
9
+ import { Button } from '../Button'
8
10
import { registerPortalRoot } from '../Portal'
9
11
import { Playground } from './AnchoredOverlay.stories'
12
+ import { LocationIcon , RepoIcon } from '@primer/octicons-react'
13
+ import { Stack } from '../Stack/Stack'
10
14
11
15
export default {
12
16
title : 'Components/AnchoredOverlay/Features' ,
13
17
component : AnchoredOverlay ,
14
18
} as Meta
15
19
20
+ const hoverCard = (
21
+ < Stack gap = "condensed" style = { { minWidth : '320px' , padding : '16px' } } >
22
+ < Stack direction = "horizontal" gap = "condensed" justify = "space-between" >
23
+ < Avatar src = "https://avatars.githubusercontent.com/u/92997159?v=4" size = { 48 } />
24
+ < Button size = "small" > Follow</ Button >
25
+ </ Stack >
26
+ < Stack direction = "horizontal" gap = "none" >
27
+ < Text weight = "medium" > monalisa</ Text >
28
+ < Text color = { 'var(--fgColor-muted)' } ml = { 1 } >
29
+ Monalisa Octocat
30
+ </ Text >
31
+ </ Stack >
32
+ < Text fontSize = { 14 } > Former beach cat and champion swimmer. Now your friendly octapus with a normal face.</ Text >
33
+ < Stack direction = "horizontal" gap = "none" >
34
+ < Octicon color = { 'var(--fgColor-muted)' } icon = { LocationIcon } />
35
+ < Text fontSize = { 12 } color = { 'var(--fgColor-muted)' } ml = { 1 } >
36
+ Interwebs
37
+ </ Text >
38
+ </ Stack >
39
+ < Stack direction = "horizontal" gap = "none" >
40
+ < Octicon color = { 'var(--fgColor-muted)' } icon = { RepoIcon } />
41
+ < Text fontSize = { 12 } color = { 'var(--fgColor-muted)' } ml = { 1 } >
42
+ Owns this repository
43
+ </ Text >
44
+ </ Stack >
45
+ </ Stack >
46
+ )
47
+
16
48
const HeaderAndLayout = ( { children} : { children : JSX . Element } ) => {
17
49
const scrollingElementRef = useRef < HTMLDivElement > ( null )
18
50
useEffect ( ( ) => {
@@ -70,8 +102,8 @@ export const CustomAnchorId = () => {
70
102
renderAnchor = { props => < Button { ...props } > Button</ Button > }
71
103
anchorId = "my-custom-anchor-id"
72
104
>
73
- < Box width = "100%" height = "100%" backgroundColor = "thistle" display = "flex" flexDirection = "column" >
74
- < img src = { `//placekitten.com/200/300` } alt = "kitten" />
105
+ < Box width = "100%" height = "100%" display = "flex" flexDirection = "column" >
106
+ { hoverCard }
75
107
</ Box >
76
108
</ AnchoredOverlay >
77
109
)
@@ -88,8 +120,8 @@ export const Height = () => {
88
120
renderAnchor = { props => < Button { ...props } > Button</ Button > }
89
121
height = "large"
90
122
>
91
- < Box width = "100%" height = "100%" backgroundColor = "thistle" display = "flex" flexDirection = "column" >
92
- < img src = { `//placekitten.com/200/300` } alt = "kitten" />
123
+ < Box width = "100%" height = "100%" display = "flex" flexDirection = "column" >
124
+ { hoverCard }
93
125
</ Box >
94
126
</ AnchoredOverlay >
95
127
)
@@ -106,8 +138,8 @@ export const Width = () => {
106
138
renderAnchor = { props => < Button { ...props } > Button</ Button > }
107
139
width = "large"
108
140
>
109
- < Box width = "100%" height = "100%" backgroundColor = "thistle" display = "flex" flexDirection = "column" >
110
- < img src = { `//placekitten.com/200/300` } alt = "kitten" />
141
+ < Box width = "100%" height = "100%" display = "flex" flexDirection = "column" >
142
+ { hoverCard }
111
143
</ Box >
112
144
</ AnchoredOverlay >
113
145
)
@@ -128,8 +160,8 @@ export const AnchorAlignment = () => {
128
160
) }
129
161
align = "center"
130
162
>
131
- < Box width = "100%" height = "100%" backgroundColor = "thistle" display = "flex" flexDirection = "column" >
132
- < img src = { `//placekitten.com/200/300` } alt = "kitten" />
163
+ < Box width = "100%" height = "100%" display = "flex" flexDirection = "column" >
164
+ { hoverCard }
133
165
</ Box >
134
166
</ AnchoredOverlay >
135
167
)
@@ -146,8 +178,8 @@ export const AnchorSide = () => {
146
178
renderAnchor = { props => < Button { ...props } > Button</ Button > }
147
179
side = "outside-right"
148
180
>
149
- < Box width = "100%" height = "100%" backgroundColor = "thistle" display = "flex" flexDirection = "column" >
150
- < img src = { `//placekitten.com/200/300` } alt = "kitten" />
181
+ < Box width = "100%" height = "100%" display = "flex" flexDirection = "column" >
182
+ { hoverCard }
151
183
</ Box >
152
184
</ AnchoredOverlay >
153
185
)
@@ -165,7 +197,7 @@ export const OffsetPositionFromAnchor = () => {
165
197
anchorOffset = { 100 }
166
198
>
167
199
< Box width = "100%" height = "100%" backgroundColor = "thistle" display = "flex" flexDirection = "column" >
168
- < img src = { `//placekitten.com/200/300` } alt = "kitten" />
200
+ { hoverCard }
169
201
</ Box >
170
202
</ AnchoredOverlay >
171
203
)
@@ -182,8 +214,8 @@ export const OffsetAlignmentFromAnchor = () => {
182
214
renderAnchor = { props => < Button { ...props } > Button</ Button > }
183
215
alignmentOffset = { 100 }
184
216
>
185
- < Box width = "100%" height = "100%" backgroundColor = "thistle" display = "flex" flexDirection = "column" >
186
- < img src = { `//placekitten.com/200/300` } alt = "kitten" />
217
+ < Box width = "100%" height = "100%" display = "flex" flexDirection = "column" >
218
+ { hoverCard }
187
219
</ Box >
188
220
</ AnchoredOverlay >
189
221
)
@@ -247,8 +279,8 @@ export const OverlayPropsOverrides = () => {
247
279
< li > overflow: `auto`</ li >
248
280
< li > maxHeight: `xsmall`</ li >
249
281
</ pre >
250
- < Box width = "100%" height = "100%" backgroundColor = "thistle" display = "flex" flexDirection = "column" >
251
- < img src = { `//placekitten.com/200/300` } alt = "kitten" />
282
+ < Box width = "100%" height = "100%" display = "flex" flexDirection = "column" >
283
+ { hoverCard }
252
284
</ Box >
253
285
</ AnchoredOverlay >
254
286
)
0 commit comments