@bitrise/bitkit 10.16.1 → 10.16.2

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "10.16.1",
4
+ "version": "10.16.2",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -1,6 +1,7 @@
1
1
  import { Story, ComponentMeta } from '@storybook/react';
2
2
  import { useDisclosure } from '@chakra-ui/react';
3
3
  import Button from '../Button/Button';
4
+ import AspectRatio from '../AspectRatio/AspectRatio';
4
5
  import LightBox, { LightBoxProps } from './LightBox';
5
6
 
6
7
  export default {
@@ -13,15 +14,15 @@ export const WithProps: Story<LightBoxProps> = ({ ...props }: LightBoxProps) =>
13
14
 
14
15
  const getContent = () => {
15
16
  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
- />
17
+ <AspectRatio ratio={props.size === 'full' ? 1.33 : 1.77}>
18
+ <iframe
19
+ id="ytplayer"
20
+ title="Intro to Bitrise"
21
+ src="https://www.youtube.com/embed/JrCn9xWQ7IM"
22
+ frameBorder="0"
23
+ allowFullScreen
24
+ />
25
+ </AspectRatio>
25
26
  );
26
27
  };
27
28
 
@@ -34,3 +35,5 @@ export const WithProps: Story<LightBoxProps> = ({ ...props }: LightBoxProps) =>
34
35
  </>
35
36
  );
36
37
  };
38
+
39
+ WithProps.args = { ...LightBox.defaultProps };
@@ -1,16 +1,26 @@
1
- import { Modal, ModalOverlay, ModalContent, usePrefersReducedMotion, HTMLChakraProps } from '@chakra-ui/react';
1
+ import {
2
+ Modal,
3
+ ModalOverlay,
4
+ ModalContent,
5
+ useBreakpointValue,
6
+ usePrefersReducedMotion,
7
+ HTMLChakraProps,
8
+ } from '@chakra-ui/react';
9
+ import { BREAKPOINTS } from '../../Foundations/Breakpoints/Breakpoints';
2
10
 
3
11
  export interface LightBoxProps extends Omit<HTMLChakraProps<'section'>, 'scrollBehavior'> {
4
12
  dataTestid?: string;
13
+ size?: 'small' | 'medium' | 'large' | 'full';
5
14
  isOpen: boolean;
6
15
  onClose(): void;
7
16
  }
8
17
 
9
- const LightBox = ({ children, dataTestid, isOpen, onClose, ...rest }: LightBoxProps) => {
18
+ const LightBox = ({ children, dataTestid, size, isOpen, onClose, ...rest }: LightBoxProps) => {
10
19
  const prefersReducedMotion = usePrefersReducedMotion();
20
+ const dialogSize = useBreakpointValue({ [BREAKPOINTS.MOBILE]: 'mobile', [BREAKPOINTS.DESKTOP]: size });
11
21
 
12
22
  return (
13
- <Modal isOpen={isOpen} motionPreset={prefersReducedMotion ? 'none' : 'scale'} onClose={onClose}>
23
+ <Modal isOpen={isOpen} motionPreset={prefersReducedMotion ? 'none' : 'scale'} onClose={onClose} size={dialogSize}>
14
24
  <ModalOverlay />
15
25
  <ModalContent borderRadius="0" data-testid={dataTestid} {...rest}>
16
26
  {children}
@@ -19,4 +29,8 @@ const LightBox = ({ children, dataTestid, isOpen, onClose, ...rest }: LightBoxPr
19
29
  );
20
30
  };
21
31
 
32
+ LightBox.defaultProps = {
33
+ size: 'large',
34
+ } as LightBoxProps;
35
+
22
36
  export default LightBox;