@bitrise/bitkit 10.13.0 → 10.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Story, ComponentMeta } from '@storybook/react';
|
|
2
|
+
import { useDisclosure } from '@chakra-ui/react';
|
|
3
|
+
import Button from '../Button/Button';
|
|
4
|
+
import LightBox, { LightBoxProps } from './LightBox';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/LightBox',
|
|
8
|
+
component: LightBox,
|
|
9
|
+
} as ComponentMeta<typeof LightBox>;
|
|
10
|
+
|
|
11
|
+
export const WithProps: Story<LightBoxProps> = ({ ...props }: LightBoxProps) => {
|
|
12
|
+
const { isOpen, onClose, onOpen } = useDisclosure();
|
|
13
|
+
|
|
14
|
+
const getContent = () => {
|
|
15
|
+
return (
|
|
16
|
+
<iframe
|
|
17
|
+
id="ytplayer"
|
|
18
|
+
title="Intro to Bitrise"
|
|
19
|
+
width="100%"
|
|
20
|
+
height="500"
|
|
21
|
+
src="https://www.youtube.com/embed/JrCn9xWQ7IM"
|
|
22
|
+
frameBorder="0"
|
|
23
|
+
allowFullScreen
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
<Button onClick={onOpen}>Open LightBox</Button>
|
|
31
|
+
<LightBox padding="0" {...props} isOpen={isOpen} onClose={onClose}>
|
|
32
|
+
{getContent()}
|
|
33
|
+
</LightBox>
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Modal, ModalOverlay, ModalContent, usePrefersReducedMotion, HTMLChakraProps } from '@chakra-ui/react';
|
|
2
|
+
|
|
3
|
+
export interface LightBoxProps extends Omit<HTMLChakraProps<'section'>, 'scrollBehavior'> {
|
|
4
|
+
dataTestid?: string;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
onClose(): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const LightBox = ({ children, dataTestid, isOpen, onClose, ...rest }: LightBoxProps) => {
|
|
10
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Modal isOpen={isOpen} motionPreset={prefersReducedMotion ? 'none' : 'scale'} onClose={onClose}>
|
|
14
|
+
<ModalOverlay />
|
|
15
|
+
<ModalContent borderRadius="0" data-testid={dataTestid} {...rest}>
|
|
16
|
+
{children}
|
|
17
|
+
</ModalContent>
|
|
18
|
+
</Modal>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default LightBox;
|
package/src/index.ts
CHANGED
|
@@ -159,3 +159,6 @@ export { default as Accordion } from './Components/Accordion/Accordion';
|
|
|
159
159
|
|
|
160
160
|
export type { AccordionItemProps } from './Components/Accordion/AccordionItem';
|
|
161
161
|
export { default as AccordionItem } from './Components/Accordion/AccordionItem';
|
|
162
|
+
|
|
163
|
+
export type { LightBoxProps } from './Components/LightBox/LightBox';
|
|
164
|
+
export { default as LightBox } from './Components/LightBox/LightBox';
|