Skip to content

Commit

Permalink
fixed sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
se7en-illa committed Oct 2, 2024
1 parent 2f43f03 commit 959ad29
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 100 deletions.
99 changes: 85 additions & 14 deletions docs/examples/avatarGroup/accessibility.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { useEffect, useRef, useState } from 'react';
import { AvatarGroup, Box, Flex, Layer, Popover, SearchField, Text } from 'gestalt';
import {
AvatarGroup,
Box,
Flex,
Layer,
Popover,
SearchField,
Text,
useDangerouslyInGestaltExperiment,
} from 'gestalt';

function SearchCollaboratorsField() {
const ref = useRef<null | HTMLInputElement>(null);
Expand All @@ -23,26 +32,88 @@ function SearchCollaboratorsField() {
export default function Example() {
const [open, setOpen] = useState(false);
const anchorRef = useRef<null | HTMLAnchorElement | HTMLDivElement>(null);
const isInVRExperiment = useDangerouslyInGestaltExperiment({
webExperimentName: 'web_gestalt_visualRefresh',
mwebExperimentName: 'web_gestalt_visualRefresh',
});

return (
const collaborators = [
{
name: 'Keerthi',
src: 'https://i.ibb.co/ZfCZrY8/keerthi.jpg',
},
{
name: 'Alberto',
src: 'https://i.ibb.co/NsK2w5y/Alberto.jpg',
},
...new Array(10),
];

const collaboratorsVR = [
{
name: 'Fatima',
src: 'https://i.pinimg.com/originals/bf/bc/27/bfbc27685d81eb9a8f65c201ea661f0e.jpg',
},
{
name: 'Ayesha',
src: 'https://i.pinimg.com/originals/c5/5c/ac/c55caca43a7c16766215ec165b649c1c.jpg',
},
...new Array(10),
];

const names = isInVRExperiment ? 'Fatima, Ayesha,' : 'Keerthi, Alberto,';

return isInVRExperiment ? (
<Flex height="100%" width="100%">
<Box height="200" marginTop={6} padding={2}>
<AvatarGroup
ref={anchorRef}
accessibilityExpanded={open}
accessibilityLabel={`Collaborators: ${names} and 10 more. Add collaborators to this board.`}
addCollaborators
collaborators={collaboratorsVR}
onClick={() => setOpen((value) => !value)}
role="button"
size="md"
/>
</Box>
{open && (
<Layer>
<Popover
anchor={anchorRef.current}
idealDirection="down"
onDismiss={() => setOpen(false)}
positionRelativeToAnchor={false}
size={500}
>
<Box
flex="grow"
marginBottom={8}
marginEnd={4}
marginStart={4}
marginTop={6}
width={360}
>
<Flex direction="column" gap={{ column: 4, row: 0 }}>
<Text align="center" color="default" weight="bold">
Invite collaborators
</Text>
<SearchCollaboratorsField />
</Flex>
</Box>
</Popover>
</Layer>
)}
</Flex>
) : (
<Flex height="100%" width="100%">
<Box height="200" marginTop={6} padding={2}>
<AvatarGroup
ref={anchorRef}
accessibilityExpanded={open}
accessibilityLabel="Collaborators: Keerthi, Alberto, and 10 more. Add collaborators to this board."
accessibilityLabel={`Collaborators: ${names} and 10 more. Add collaborators to this board.`}
addCollaborators
collaborators={[
{
name: 'Keerthi',
src: 'https://i.ibb.co/ZfCZrY8/keerthi.jpg',
},
{
name: 'Alberto',
src: 'https://i.ibb.co/NsK2w5y/Alberto.jpg',
},
...new Array(10),
]}
collaborators={isInVRExperiment ? collaboratorsVR : collaborators}
onClick={() => setOpen((value) => !value)}
role="button"
size="md"
Expand Down
84 changes: 0 additions & 84 deletions docs/examples/avatarGroup/accessibilityVR.tsx

This file was deleted.

3 changes: 1 addition & 2 deletions docs/pages/web/avatargroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import PageHeader from '../../docs-components/PageHeader';
import QualityChecklist from '../../docs-components/QualityChecklist';
import SandpackExample from '../../docs-components/SandpackExample';
import accessibility from '../../examples/avatarGroup/accessibility';
import accessibilityVR from '../../examples/avatarGroup/accessibilityVR';
import ideas from '../../examples/avatarGroup/ideas';
import main from '../../examples/avatarGroup/main';
import noEmoji from '../../examples/avatarGroup/noEmoji';
Expand Down Expand Up @@ -461,7 +460,7 @@ If AvatarGroup is used as a control button to show/hide Popover-component, we re
<MainSection.Card
cardSize="lg"
sandpackExample={
<SandpackExample code={isInVRExperiment ? accessibilityVR : accessibility} name="ARIA" previewHeight={250} />
<SandpackExample code={accessibility} name="ARIA" previewHeight={250} />
}
/>
</MainSection.Subsection>
Expand Down

0 comments on commit 959ad29

Please sign in to comment.