@integrigo/integrigo-ui 1.6.15-b → 1.6.16
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/index.d.ts +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/lib/src/components/organisms/Modal/Modal.d.ts +6 -0
- package/lib/src/components/organisms/Modal/Modal.stories.d.ts +5 -0
- package/lib/src/components/organisms/Modal/index.d.ts +1 -0
- package/lib/src/components/organisms/index.d.ts +1 -0
- package/lib/src/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/organisms/Modal/Modal.stories.tsx +26 -0
- package/src/components/organisms/Modal/Modal.tsx +84 -0
- package/src/components/organisms/Modal/index.ts +1 -0
- package/src/components/organisms/index.ts +2 -1
- package/src/index.ts +1 -1
- package/src/styles/global.ts +1 -0
@@ -0,0 +1,5 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
3
|
+
declare const _default: ComponentMeta<import("react").FCS<import("react").PropsWithChildren<import("./Modal").ModalProps>>>;
|
4
|
+
export default _default;
|
5
|
+
export declare const Basic: ComponentStory<import("react").FCS<import("react").PropsWithChildren<import("./Modal").ModalProps>>>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Modal } from './Modal';
|
package/lib/src/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
export { Alert, Avatar, Card, Divider, Icon, Nav, Pill, Typography, Spinner, Chip, Dot, Gradient, } from "./components/atoms";
|
2
2
|
export { InfoCard, Input, TextArea, Button, Checkbox, Dropdown, Profile, Radio, Tile, } from "./components/molecules";
|
3
|
-
export { Menu, Setting } from "./components/organisms";
|
3
|
+
export { Menu, Setting, Modal } from "./components/organisms";
|
4
4
|
export { GlobalStyles as IntegrigoUI, Color } from "./styles";
|
package/package.json
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
2
|
+
|
3
|
+
import { Modal } from "./Modal";
|
4
|
+
|
5
|
+
export default {
|
6
|
+
title: "Organisms/Modal",
|
7
|
+
component: Modal,
|
8
|
+
argTypes: {
|
9
|
+
show: {
|
10
|
+
control: "boolean",
|
11
|
+
defaultValue: true,
|
12
|
+
},
|
13
|
+
},
|
14
|
+
} as ComponentMeta<typeof Modal>;
|
15
|
+
|
16
|
+
const Template: ComponentStory<typeof Modal> = (args) => (
|
17
|
+
<>
|
18
|
+
Some other content
|
19
|
+
<Modal show={args.show} onClose={() => null}>
|
20
|
+
hey
|
21
|
+
</Modal>
|
22
|
+
</>
|
23
|
+
);
|
24
|
+
|
25
|
+
export const Basic = Template.bind({});
|
26
|
+
Basic.args = {};
|
@@ -0,0 +1,84 @@
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
2
|
+
import styled from "styled-components";
|
3
|
+
import { Card, Icon } from "../../atoms";
|
4
|
+
|
5
|
+
export interface ModalProps {
|
6
|
+
show: boolean;
|
7
|
+
onClose: () => void;
|
8
|
+
}
|
9
|
+
|
10
|
+
export const Modal: React.FCS<PropsWithChildren<ModalProps>> = ({
|
11
|
+
className,
|
12
|
+
children,
|
13
|
+
show,
|
14
|
+
onClose,
|
15
|
+
}) => {
|
16
|
+
if (!show) {
|
17
|
+
return null;
|
18
|
+
}
|
19
|
+
|
20
|
+
return (
|
21
|
+
<Root>
|
22
|
+
<ModalCard size="s" flat className={className}>
|
23
|
+
<CloseModal>
|
24
|
+
<CloseIcon onClick={onClose}>
|
25
|
+
<Icon type="close" />
|
26
|
+
</CloseIcon>
|
27
|
+
</CloseModal>
|
28
|
+
{children}
|
29
|
+
</ModalCard>
|
30
|
+
</Root>
|
31
|
+
);
|
32
|
+
};
|
33
|
+
|
34
|
+
const Root = styled.div`
|
35
|
+
position: fixed;
|
36
|
+
left: 0;
|
37
|
+
top: 0;
|
38
|
+
width: 100%;
|
39
|
+
height: 100%;
|
40
|
+
z-index: 100;
|
41
|
+
|
42
|
+
&::after {
|
43
|
+
content: "";
|
44
|
+
position: absolute;
|
45
|
+
left: 0;
|
46
|
+
top: 0;
|
47
|
+
height: 100%;
|
48
|
+
width: 100%;
|
49
|
+
backdrop-filter: blur(8px);
|
50
|
+
background-color: var(--color-shadow);
|
51
|
+
}
|
52
|
+
`;
|
53
|
+
|
54
|
+
const ModalCard = styled(Card)`
|
55
|
+
padding: var(--padding-s);
|
56
|
+
position: fixed;
|
57
|
+
left: 50%;
|
58
|
+
top: 50%;
|
59
|
+
max-width: 320px;
|
60
|
+
width: calc(100vw - 2 * var(--padding-m));
|
61
|
+
transform: translate(-50%, -50%);
|
62
|
+
z-index: 101;
|
63
|
+
`;
|
64
|
+
|
65
|
+
const CloseModal = styled.div`
|
66
|
+
display: flex;
|
67
|
+
justify-content: flex-end;
|
68
|
+
`;
|
69
|
+
|
70
|
+
const CloseIcon = styled.button`
|
71
|
+
border: none;
|
72
|
+
background: transparent;
|
73
|
+
padding: 0;
|
74
|
+
cursor: pointer;
|
75
|
+
|
76
|
+
& > svg {
|
77
|
+
fill: var(--shades-of-grey-60);
|
78
|
+
transition: fill var(--transition-speed);
|
79
|
+
|
80
|
+
&:hover {
|
81
|
+
fill: var(--shades-of-grey-100);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
`;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Modal } from './Modal'
|
package/src/index.ts
CHANGED
package/src/styles/global.ts
CHANGED
@@ -29,6 +29,7 @@ export const GlobalStyles = createGlobalStyle`
|
|
29
29
|
|
30
30
|
--color-orange-80: ${Color.Orange}80;
|
31
31
|
--color-orange-65: ${Color.Orange}65;
|
32
|
+
--color-shadow: ${Color.Grey100}10;
|
32
33
|
|
33
34
|
--gradient-natural-orange: linear-gradient(333.61deg, #E09A33 13.3%, #FFB241 90.98%);
|
34
35
|
--gradient-orange-red: radial-gradient(106.28% 106.28% at 76.05% 89.07%, #E09A33 0%, #CF544B 100%);
|