@@ -2,17 +2,49 @@ import React, {useEffect, useRef, useState} from 'react'
22import type { Args , Meta } from '@storybook/react'
33import { FocusKeys } from '@primer/behaviors'
44
5- import { Box , Button } from '..'
5+ import { Avatar , Box , Text } from '..'
66import { AnchoredOverlay } from '../AnchoredOverlay'
77import Heading from '../Heading'
8+ import Octicon from '../Octicon'
9+ import { Button } from '../Button'
810import { registerPortalRoot } from '../Portal'
911import { Playground } from './AnchoredOverlay.stories'
12+ import { LocationIcon , RepoIcon } from '@primer/octicons-react'
13+ import { Stack } from '../Stack/Stack'
1014
1115export default {
1216 title : 'Components/AnchoredOverlay/Features' ,
1317 component : AnchoredOverlay ,
1418} as Meta
1519
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+
1648const HeaderAndLayout = ( { children} : { children : JSX . Element } ) => {
1749 const scrollingElementRef = useRef < HTMLDivElement > ( null )
1850 useEffect ( ( ) => {
@@ -70,8 +102,8 @@ export const CustomAnchorId = () => {
70102 renderAnchor = { props => < Button { ...props } > Button</ Button > }
71103 anchorId = "my-custom-anchor-id"
72104 >
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 }
75107 </ Box >
76108 </ AnchoredOverlay >
77109 )
@@ -88,8 +120,8 @@ export const Height = () => {
88120 renderAnchor = { props => < Button { ...props } > Button</ Button > }
89121 height = "large"
90122 >
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 }
93125 </ Box >
94126 </ AnchoredOverlay >
95127 )
@@ -106,8 +138,8 @@ export const Width = () => {
106138 renderAnchor = { props => < Button { ...props } > Button</ Button > }
107139 width = "large"
108140 >
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 }
111143 </ Box >
112144 </ AnchoredOverlay >
113145 )
@@ -128,8 +160,8 @@ export const AnchorAlignment = () => {
128160 ) }
129161 align = "center"
130162 >
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 }
133165 </ Box >
134166 </ AnchoredOverlay >
135167 )
@@ -146,8 +178,8 @@ export const AnchorSide = () => {
146178 renderAnchor = { props => < Button { ...props } > Button</ Button > }
147179 side = "outside-right"
148180 >
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 }
151183 </ Box >
152184 </ AnchoredOverlay >
153185 )
@@ -165,7 +197,7 @@ export const OffsetPositionFromAnchor = () => {
165197 anchorOffset = { 100 }
166198 >
167199 < Box width = "100%" height = "100%" backgroundColor = "thistle" display = "flex" flexDirection = "column" >
168- < img src = { `//placekitten.com/200/300` } alt = "kitten" />
200+ { hoverCard }
169201 </ Box >
170202 </ AnchoredOverlay >
171203 )
@@ -182,8 +214,8 @@ export const OffsetAlignmentFromAnchor = () => {
182214 renderAnchor = { props => < Button { ...props } > Button</ Button > }
183215 alignmentOffset = { 100 }
184216 >
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 }
187219 </ Box >
188220 </ AnchoredOverlay >
189221 )
@@ -247,8 +279,8 @@ export const OverlayPropsOverrides = () => {
247279 < li > overflow: `auto`</ li >
248280 < li > maxHeight: `xsmall`</ li >
249281 </ 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 }
252284 </ Box >
253285 </ AnchoredOverlay >
254286 )
0 commit comments