From 6cd3960d3e56370b86070efcd93dad197672b2c3 Mon Sep 17 00:00:00 2001 From: Marie Lucca <40550942+francinelucca@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:02:22 -0400 Subject: [PATCH] fix(AnchoredOverlay): replace broken stories (#5056) * fix(AnchoredOverlay): replace broken stories * fix: storybook build failure * Docs(AnchoredOverlay): rewrite hovercard using stack * Docs(AnchoredOverlay): remove unused variable * Docs(AnchoredOverlay): use text size prop in stories instead of fontSize * Update packages/react/src/AnchoredOverlay/AnchoredOverlay.features.stories.tsx Co-authored-by: Mike Perrotti * Docs(AnchoredOverlay): use sx prop for styling instead of styled-system props --------- Co-authored-by: Mike Perrotti --- .../AnchoredOverlay.features.stories.tsx | 66 ++++++++++++------- .../AnchoredOverlay.stories.tsx | 43 +++++++++--- 2 files changed, 76 insertions(+), 33 deletions(-) diff --git a/packages/react/src/AnchoredOverlay/AnchoredOverlay.features.stories.tsx b/packages/react/src/AnchoredOverlay/AnchoredOverlay.features.stories.tsx index 78ff50b16c8..db336516af6 100644 --- a/packages/react/src/AnchoredOverlay/AnchoredOverlay.features.stories.tsx +++ b/packages/react/src/AnchoredOverlay/AnchoredOverlay.features.stories.tsx @@ -2,17 +2,49 @@ import React, {useEffect, useRef, useState} from 'react' import type {Args, Meta} from '@storybook/react' import {FocusKeys} from '@primer/behaviors' -import {Box, Button} from '..' +import {Avatar, Box, Text} from '..' import {AnchoredOverlay} from '../AnchoredOverlay' import Heading from '../Heading' +import Octicon from '../Octicon' +import {Button} from '../Button' import {registerPortalRoot} from '../Portal' import {Playground} from './AnchoredOverlay.stories' +import {LocationIcon, RepoIcon} from '@primer/octicons-react' +import {Stack} from '../Stack/Stack' export default { title: 'Components/AnchoredOverlay/Features', component: AnchoredOverlay, } as Meta +const hoverCard = ( + + + + + + + monalisa + + Monalisa Octocat + + + Former beach cat and champion swimmer. Now your friendly octapus with a normal face. + + + + Interwebs + + + + + + Owns this repository + + + +) + const HeaderAndLayout = ({children}: {children: JSX.Element}) => { const scrollingElementRef = useRef(null) useEffect(() => { @@ -70,9 +102,7 @@ export const CustomAnchorId = () => { renderAnchor={props => } anchorId="my-custom-anchor-id" > - - kitten - + {hoverCard} ) } @@ -88,9 +118,7 @@ export const Height = () => { renderAnchor={props => } height="large" > - - kitten - + {hoverCard} ) } @@ -106,9 +134,7 @@ export const Width = () => { renderAnchor={props => } width="large" > - - kitten - + {hoverCard} ) } @@ -128,9 +154,7 @@ export const AnchorAlignment = () => { )} align="center" > - - kitten - + {hoverCard} ) } @@ -146,9 +170,7 @@ export const AnchorSide = () => { renderAnchor={props => } side="outside-right" > - - kitten - + {hoverCard} ) } @@ -164,9 +186,7 @@ export const OffsetPositionFromAnchor = () => { renderAnchor={props => } anchorOffset={100} > - - kitten - + {hoverCard} ) } @@ -182,9 +202,7 @@ export const OffsetAlignmentFromAnchor = () => { renderAnchor={props => } alignmentOffset={100} > - - kitten - + {hoverCard} ) } @@ -247,9 +265,7 @@ export const OverlayPropsOverrides = () => {
  • overflow: `auto`
  • maxHeight: `xsmall`
  • - - kitten - + {hoverCard} ) } diff --git a/packages/react/src/AnchoredOverlay/AnchoredOverlay.stories.tsx b/packages/react/src/AnchoredOverlay/AnchoredOverlay.stories.tsx index deba2266964..5a7dcbf50da 100644 --- a/packages/react/src/AnchoredOverlay/AnchoredOverlay.stories.tsx +++ b/packages/react/src/AnchoredOverlay/AnchoredOverlay.stories.tsx @@ -1,16 +1,47 @@ import React, {useState} from 'react' import type {Args, Meta} from '@storybook/react' +import {LocationIcon, RepoIcon} from '@primer/octicons-react' -import {Box} from '..' +import {Avatar, Text} from '..' import {AnchoredOverlay} from '../AnchoredOverlay' import {Button} from '../Button' +import Octicon from '../Octicon' import {action} from '@storybook/addon-actions' +import {Stack} from '../Stack/Stack' export default { title: 'Components/AnchoredOverlay', component: AnchoredOverlay, } as Meta +const hoverCard = ( + + + + + + + monalisa + + Monalisa Octocat + + + Former beach cat and champion swimmer. Now your friendly octapus with a normal face. + + + + Interwebs + + + + + + Owns this repository + + + +) + export const Default = () => { const [open, setOpen] = useState(false) @@ -21,9 +52,7 @@ export const Default = () => { onClose={() => setOpen(false)} renderAnchor={props => } > - - kitten - + {hoverCard} ) } @@ -48,14 +77,12 @@ export const Playground = (args: Args) => { overlayProps={args.portalContainerName} side={args.side} > - - kitten - + {hoverCard} ) } Playground.args = { - width: 'small', + width: 'auto', height: 'auto', portalContainerName: 'Portal name', side: 'outside-bottom',