-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into hussam-i-am/css-modules-page-header
- Loading branch information
Showing
111 changed files
with
814 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/react": minor | ||
--- | ||
|
||
Update `Timeline` component to use CSS modules behind the feature flag primer_react_css_modules_team |
Binary file added
BIN
+8.91 KB
.../components/Overlay.test.ts-snapshots/Overlay-Default-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.11 KB
...hots/components/Overlay.test.ts-snapshots/Overlay-Default-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.77 KB
...mponents/Overlay.test.ts-snapshots/Overlay-Default-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.91 KB
...t/snapshots/components/Overlay.test.ts-snapshots/Overlay-Default-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.91 KB
.../components/Overlay.test.ts-snapshots/Overlay-Default-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.92 KB
...components/Overlay.test.ts-snapshots/Overlay-Default-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.01 KB
...ponents/Overlay.test.ts-snapshots/Overlay-Default-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.92 KB
.../snapshots/components/Overlay.test.ts-snapshots/Overlay-Default-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.92 KB
...components/Overlay.test.ts-snapshots/Overlay-Default-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.3 KB
...ents/Overlay.test.ts-snapshots/Overlay-Dialog-Overlay-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.9 KB
...mponents/Overlay.test.ts-snapshots/Overlay-Dialog-Overlay-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.1 KB
...s/Overlay.test.ts-snapshots/Overlay-Dialog-Overlay-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.3 KB
...hots/components/Overlay.test.ts-snapshots/Overlay-Dialog-Overlay-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.3 KB
...ents/Overlay.test.ts-snapshots/Overlay-Dialog-Overlay-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.6 KB
...nts/Overlay.test.ts-snapshots/Overlay-Dialog-Overlay-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.9 KB
.../Overlay.test.ts-snapshots/Overlay-Dialog-Overlay-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.6 KB
...ots/components/Overlay.test.ts-snapshots/Overlay-Dialog-Overlay-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.6 KB
...nts/Overlay.test.ts-snapshots/Overlay-Dialog-Overlay-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.4 KB
...ts/Overlay.test.ts-snapshots/Overlay-Dropdown-Overlay-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.1 KB
...onents/Overlay.test.ts-snapshots/Overlay-Dropdown-Overlay-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12 KB
...Overlay.test.ts-snapshots/Overlay-Dropdown-Overlay-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.4 KB
...ts/components/Overlay.test.ts-snapshots/Overlay-Dropdown-Overlay-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.4 KB
...ts/Overlay.test.ts-snapshots/Overlay-Dropdown-Overlay-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.7 KB
...s/Overlay.test.ts-snapshots/Overlay-Dropdown-Overlay-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.7 KB
...verlay.test.ts-snapshots/Overlay-Dropdown-Overlay-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.6 KB
...s/components/Overlay.test.ts-snapshots/Overlay-Dropdown-Overlay-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+12.6 KB
...s/Overlay.test.ts-snapshots/Overlay-Dropdown-Overlay-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+18.3 KB
...Overlay.test.ts-snapshots/Overlay-Memex-Issue-Overlay-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+18.3 KB
...nts/Overlay.test.ts-snapshots/Overlay-Memex-Issue-Overlay-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+18.1 KB
...rlay.test.ts-snapshots/Overlay-Memex-Issue-Overlay-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+18.3 KB
...components/Overlay.test.ts-snapshots/Overlay-Memex-Issue-Overlay-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+18.3 KB
...Overlay.test.ts-snapshots/Overlay-Memex-Issue-Overlay-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+18 KB
...verlay.test.ts-snapshots/Overlay-Memex-Issue-Overlay-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+18.1 KB
...lay.test.ts-snapshots/Overlay-Memex-Issue-Overlay-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+18 KB
...omponents/Overlay.test.ts-snapshots/Overlay-Memex-Issue-Overlay-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+18.1 KB
...verlay.test.ts-snapshots/Overlay-Memex-Issue-Overlay-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+15 KB
...erlay.test.ts-snapshots/Overlay-Memex-Nested-Overlays-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+15.6 KB
...s/Overlay.test.ts-snapshots/Overlay-Memex-Nested-Overlays-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+14.6 KB
...ay.test.ts-snapshots/Overlay-Memex-Nested-Overlays-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+14.9 KB
...mponents/Overlay.test.ts-snapshots/Overlay-Memex-Nested-Overlays-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+15 KB
...erlay.test.ts-snapshots/Overlay-Memex-Nested-Overlays-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+14.8 KB
...rlay.test.ts-snapshots/Overlay-Memex-Nested-Overlays-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+15.7 KB
...y.test.ts-snapshots/Overlay-Memex-Nested-Overlays-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+15.3 KB
...ponents/Overlay.test.ts-snapshots/Overlay-Memex-Nested-Overlays-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+15.3 KB
...rlay.test.ts-snapshots/Overlay-Memex-Nested-Overlays-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+25.5 KB
...nts/Overlay.test.ts-snapshots/Overlay-Nested-Overlays-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+26.1 KB
...ponents/Overlay.test.ts-snapshots/Overlay-Nested-Overlays-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+24.5 KB
.../Overlay.test.ts-snapshots/Overlay-Nested-Overlays-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+25.3 KB
...ots/components/Overlay.test.ts-snapshots/Overlay-Nested-Overlays-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+25.2 KB
...nts/Overlay.test.ts-snapshots/Overlay-Nested-Overlays-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+24.8 KB
...ts/Overlay.test.ts-snapshots/Overlay-Nested-Overlays-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+25 KB
...Overlay.test.ts-snapshots/Overlay-Nested-Overlays-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+24.8 KB
...ts/components/Overlay.test.ts-snapshots/Overlay-Nested-Overlays-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+24.9 KB
...ts/Overlay.test.ts-snapshots/Overlay-Nested-Overlays-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+9.74 KB
...y.test.ts-snapshots/Overlay-Overlay-On-Top-Of-Overlay-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+10.1 KB
...erlay.test.ts-snapshots/Overlay-Overlay-On-Top-Of-Overlay-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+9.71 KB
...est.ts-snapshots/Overlay-Overlay-On-Top-Of-Overlay-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+9.73 KB
...ents/Overlay.test.ts-snapshots/Overlay-Overlay-On-Top-Of-Overlay-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+9.73 KB
...y.test.ts-snapshots/Overlay-Overlay-On-Top-Of-Overlay-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+9.67 KB
....test.ts-snapshots/Overlay-Overlay-On-Top-Of-Overlay-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+9.86 KB
...st.ts-snapshots/Overlay-Overlay-On-Top-Of-Overlay-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+9.67 KB
...nts/Overlay.test.ts-snapshots/Overlay-Overlay-On-Top-Of-Overlay-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+10.3 KB
....test.ts-snapshots/Overlay-Overlay-On-Top-Of-Overlay-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+10.2 KB
...mponents/Overlay.test.ts-snapshots/Overlay-Playground-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+10.5 KB
...s/components/Overlay.test.ts-snapshots/Overlay-Playground-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+10.4 KB
...nents/Overlay.test.ts-snapshots/Overlay-Playground-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.93 KB
...napshots/components/Overlay.test.ts-snapshots/Overlay-Playground-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.93 KB
...mponents/Overlay.test.ts-snapshots/Overlay-Playground-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.91 KB
...ponents/Overlay.test.ts-snapshots/Overlay-Playground-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+9.03 KB
...ents/Overlay.test.ts-snapshots/Overlay-Playground-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.91 KB
...apshots/components/Overlay.test.ts-snapshots/Overlay-Playground-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+9.92 KB
...ponents/Overlay.test.ts-snapshots/Overlay-Playground-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.87 KB
...Overlay.test.ts-snapshots/Overlay-Positioned-Overlays-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+12.3 KB
...nts/Overlay.test.ts-snapshots/Overlay-Positioned-Overlays-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.72 KB
...rlay.test.ts-snapshots/Overlay-Positioned-Overlays-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.87 KB
...components/Overlay.test.ts-snapshots/Overlay-Positioned-Overlays-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.87 KB
...Overlay.test.ts-snapshots/Overlay-Positioned-Overlays-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.88 KB
...verlay.test.ts-snapshots/Overlay-Positioned-Overlays-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+9.02 KB
...lay.test.ts-snapshots/Overlay-Positioned-Overlays-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.88 KB
...omponents/Overlay.test.ts-snapshots/Overlay-Positioned-Overlays-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+8.88 KB
...verlay.test.ts-snapshots/Overlay-Positioned-Overlays-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.8 KB
...components/Overlay.test.ts-snapshots/Overlay-SX-Props-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.98 KB
...ots/components/Overlay.test.ts-snapshots/Overlay-SX-Props-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.84 KB
...ponents/Overlay.test.ts-snapshots/Overlay-SX-Props-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.83 KB
.../snapshots/components/Overlay.test.ts-snapshots/Overlay-SX-Props-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.83 KB
...components/Overlay.test.ts-snapshots/Overlay-SX-Props-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.79 KB
...omponents/Overlay.test.ts-snapshots/Overlay-SX-Props-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.83 KB
...onents/Overlay.test.ts-snapshots/Overlay-SX-Props-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.82 KB
...snapshots/components/Overlay.test.ts-snapshots/Overlay-SX-Props-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.82 KB
...omponents/Overlay.test.ts-snapshots/Overlay-SX-Props-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+11.3 KB
...mponents/Timeline.test.ts-snapshots/Timeline-SX-Props-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+11.4 KB
...s/components/Timeline.test.ts-snapshots/Timeline-SX-Props-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+11.2 KB
...nents/Timeline.test.ts-snapshots/Timeline-SX-Props-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+11.3 KB
...napshots/components/Timeline.test.ts-snapshots/Timeline-SX-Props-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+11.3 KB
...mponents/Timeline.test.ts-snapshots/Timeline-SX-Props-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+10.5 KB
...ponents/Timeline.test.ts-snapshots/Timeline-SX-Props-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+10.6 KB
...ents/Timeline.test.ts-snapshots/Timeline-SX-Props-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+10.5 KB
...apshots/components/Timeline.test.ts-snapshots/Timeline-SX-Props-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+10.5 KB
...ponents/Timeline.test.ts-snapshots/Timeline-SX-Props-light-tritanopia-linux.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import {test, expect} from '@playwright/test' | ||
import {visit} from '../test-helpers/storybook' | ||
import {themes} from '../test-helpers/themes' | ||
|
||
const stories = [ | ||
{ | ||
title: 'Default', | ||
id: 'private-components-overlay--default', | ||
}, | ||
{ | ||
title: 'Playground', | ||
id: 'private-components-overlay--playground', | ||
}, | ||
{ | ||
title: 'Dialog Overlay', | ||
id: 'private-components-overlay-features--dialog-overlay', | ||
}, | ||
{ | ||
title: 'Dropdown Overlay', | ||
id: 'private-components-overlay-features--dropdown-overlay', | ||
}, | ||
{ | ||
title: 'Memex Issue Overlay', | ||
id: 'private-components-overlay-features--memex-issue-overlay', | ||
}, | ||
{ | ||
title: 'Memex Nested Overlays', | ||
id: 'private-components-overlay-features--memex-nested-overlays', | ||
}, | ||
{ | ||
title: 'Nested Overlays', | ||
id: 'private-components-overlay-features--nested-overlays', | ||
}, | ||
{ | ||
title: 'Overlay On Top Of Overlay', | ||
id: 'private-components-overlay-features--overlay-on-top-of-overlay', | ||
}, | ||
{ | ||
title: 'Positioned Overlays', | ||
id: 'private-components-overlay-features--positioned-overlays', | ||
}, | ||
{ | ||
title: 'SX Props', | ||
id: 'private-components-overlay-dev--sx-props', | ||
}, | ||
] as const | ||
|
||
test.describe('Overlay ', () => { | ||
for (const story of stories) { | ||
test.describe(story.title, () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('@vrt', async ({page}) => { | ||
await visit(page, { | ||
id: story.id, | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
args: { | ||
open: true, | ||
}, | ||
}) | ||
|
||
await expect(page).toHaveScreenshot(`Overlay.${story.title}.${theme}.png`, {animations: 'disabled'}) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: story.id, | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
args: { | ||
open: true, | ||
}, | ||
}) | ||
|
||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
} | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import React, {useRef, useState} from 'react' | ||
import type {Args, Meta} from '@storybook/react' | ||
import Text from '../Text' | ||
import {Button, IconButton} from '../Button' | ||
import Overlay from './Overlay' | ||
import {useFocusTrap} from '../hooks/useFocusTrap' | ||
import Box from '../Box' | ||
import {XIcon} from '@primer/octicons-react' | ||
|
||
export default { | ||
title: 'Private/Components/Overlay/Dev', | ||
component: Overlay, | ||
args: { | ||
open: false, | ||
}, | ||
argTypes: { | ||
open: { | ||
control: false, | ||
visible: false, | ||
}, | ||
}, | ||
} as Meta<typeof Overlay> | ||
|
||
export const SxProps = (args: Args) => { | ||
const [isOpen, setIsOpen] = useState(false) | ||
const buttonRef = useRef<HTMLButtonElement>(null) | ||
const confirmButtonRef = useRef<HTMLButtonElement>(null) | ||
const anchorRef = useRef<HTMLDivElement>(null) | ||
const closeOverlay = () => setIsOpen(false) | ||
const containerRef = useRef<HTMLDivElement>(null) | ||
useFocusTrap({ | ||
containerRef, | ||
disabled: !isOpen, | ||
}) | ||
return ( | ||
<Box ref={anchorRef}> | ||
<Button | ||
ref={buttonRef} | ||
onClick={() => { | ||
setIsOpen(!isOpen) | ||
}} | ||
> | ||
Open overlay | ||
</Button> | ||
{isOpen || args.open ? ( | ||
<Overlay | ||
initialFocusRef={confirmButtonRef} | ||
returnFocusRef={buttonRef} | ||
ignoreClickRefs={[buttonRef]} | ||
onEscape={closeOverlay} | ||
onClickOutside={closeOverlay} | ||
width="large" | ||
anchorSide="inside-right" | ||
role="dialog" | ||
aria-modal="true" | ||
aria-label="Sample overlay" | ||
ref={containerRef} | ||
sx={{ | ||
left: '50%', | ||
mt: 2, | ||
color: 'var(--bgColor-danger-muted)', | ||
}} | ||
style={{padding: '16px'}} | ||
> | ||
<Box | ||
sx={{ | ||
height: '100vh', | ||
maxWidth: 'calc(-1rem + 100vw)', | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}} | ||
> | ||
<IconButton | ||
aria-label="Close" | ||
onClick={closeOverlay} | ||
icon={XIcon} | ||
variant="invisible" | ||
sx={{ | ||
position: 'absolute', | ||
left: '5px', | ||
top: '5px', | ||
}} | ||
/> | ||
<Text>Look! an overlay</Text> | ||
</Box> | ||
</Overlay> | ||
) : null} | ||
</Box> | ||
) | ||
} |
Oops, something went wrong.