@devtron-labs/devtron-fe-common-lib 0.0.6-beta-8 → 0.0.6-beta-10
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/dist/Common/BreadCrumb/BreadCrumb.d.ts +33 -0
- package/dist/Common/BreadCrumb/BreadcrumbStore.d.ts +17 -0
- package/dist/Common/Drawer/Drawer.d.ts +16 -0
- package/dist/Common/EmptyState/EmptyState.d.ts +24 -0
- package/dist/Common/Error.d.ts +15 -0
- package/dist/Common/Helper.d.ts +9 -0
- package/dist/Common/Modals/Modal.d.ts +9 -0
- package/dist/Common/Modals/OpaqueModal.d.ts +12 -0
- package/dist/Common/Modals/VisibleModal.d.ts +15 -0
- package/dist/Common/Modals/VisibleModal2.d.ts +12 -0
- package/dist/Common/Progressing.d.ts +13 -0
- package/dist/Common/Reload.d.ts +5 -0
- package/dist/Common/ToastBody.d.ts +23 -0
- package/dist/Common/index.d.ts +13 -0
- package/dist/b5d52f036bdcd3ed.png +0 -0
- package/dist/index.js +1 -1
- package/package.json +46 -39
- package/rollup.config.js +16 -14
- package/src/Assets/Icon/ic-add.svg +3 -0
- package/src/Assets/Icon/ic-close.svg +9 -0
- package/src/Assets/Icon/ic-progressing.svg +6 -0
- package/src/Assets/Img/ic-loading-failure.png +0 -0
- package/src/Assets/Img/ic-not-authorized.svg +62 -0
- package/src/Common/BreadCrumb/BreadCrumb.tsx +115 -0
- package/src/Common/BreadCrumb/BreadcrumbStore.tsx +25 -0
- package/src/Common/Constants.ts +1 -1
- package/src/Common/Drawer/Drawer.scss +39 -0
- package/src/Common/Drawer/Drawer.tsx +49 -0
- package/src/Common/EmptyState/EmptyState.tsx +42 -0
- package/src/Common/EmptyState/emptyState.scss +83 -0
- package/src/Common/Error.tsx +55 -0
- package/src/Common/Helper.tsx +39 -0
- package/src/Common/Modals/Modal.tsx +53 -0
- package/src/Common/Modals/OpaqueModal.tsx +36 -0
- package/src/Common/Modals/VisibleModal.tsx +55 -0
- package/src/Common/Modals/VisibleModal2.tsx +35 -0
- package/src/Common/Progressing.tsx +60 -0
- package/src/Common/Reload.tsx +18 -0
- package/src/Common/ServerError.ts +19 -18
- package/src/Common/ToastBody.tsx +64 -0
- package/src/Common/Types.ts +8 -9
- package/src/Common/index.ts +14 -1
- package/src/custom.d.ts +13 -0
- package/tsconfig.json +2 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="250" height="200" viewBox="0 0 250 200">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="ho9etwod5c" x1="55.01%" x2="40.976%" y1="0%" y2="100%">
|
|
4
|
+
<stop offset="0%" stop-color="#2A318C"/>
|
|
5
|
+
<stop offset="100%" stop-color="#1D225F"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<linearGradient id="mdhg2gjypd" x1="50%" x2="50%" y1="0%" y2="100%">
|
|
8
|
+
<stop offset="0%" stop-color="#EEE"/>
|
|
9
|
+
<stop offset="100%" stop-color="#D6D7D8"/>
|
|
10
|
+
</linearGradient>
|
|
11
|
+
<linearGradient id="xe2mx0bk0e" x1="0%" x2="100%" y1="18%" y2="82%">
|
|
12
|
+
<stop offset="0%" stop-color="#E8B73F"/>
|
|
13
|
+
<stop offset="100%" stop-color="#CF9F36"/>
|
|
14
|
+
</linearGradient>
|
|
15
|
+
<path id="88gkjk6cca" d="M0 0H250V200H0z"/>
|
|
16
|
+
</defs>
|
|
17
|
+
<g fill="none" fill-rule="evenodd">
|
|
18
|
+
<g>
|
|
19
|
+
<g transform="translate(-590 -308) translate(590 308)">
|
|
20
|
+
<mask id="pitr2853ub" fill="#fff">
|
|
21
|
+
<use xlink:href="#88gkjk6cca"/>
|
|
22
|
+
</mask>
|
|
23
|
+
<g mask="url(#pitr2853ub)">
|
|
24
|
+
<g>
|
|
25
|
+
<path fill="#FFF" fill-rule="nonzero" d="M47.646 0c2.598 0 5.717 1.017 7.994 2.74 2.276 1.722 3.845 3.02 4.55 5.097.465 1.372.252 3.282-.641 5.728l.008-.072c-.013.145-.039.269-.071.387.574-1.048 1.638-1.624 2.576-1.283 1.07.39 1.5 1.803 1.013 3.14-.487 1.337-1.723 2.144-2.794 1.754-.536-.195-.91-.646-1.09-1.216.023.975.09 2.117.203 3.427l-2.317.161c-2.223 2.412-4.574 3.48-7.055 3.207-.6-.067-1.158-.18-1.675-.339-.588 1.007-1.177 2.688-1.766 5.043l-.064.031.005-.043c-.585 5.627-1.014 11.07-1.287 16.327l.001-.108c-.013.958-.003 1.853.028 2.684l.109-1.533c2.141 1.735 4.344 2.776 6.608 3.123 2.263.348 5.76-.128 10.49-1.426 2.808-.962 5.555-2.299 8.243-4.011H63.94l16.84-20.83h2.756c0-1.439 1.165-2.604 2.604-2.604 1.378 0 2.506 1.07 2.597 2.425l.006.178h1.736c0-1.438 1.166-2.603 2.604-2.603 1.378 0 2.506 1.07 2.598 2.425l.006.178h5.284L89.832 35.292c.097-.07.17-.106.212-.106.692 0 .692 5.306-.057 7.152-.289.865-4.73 5.71-9.864 10.844-2.78 2.78-6.605 6.366-11.477 10.759l2.511 11.858c-.568 1.157-2.01 1.928-4.324 2.314-5.208.579-10.415-1.736-16.78-1.736-1.852 0-3.142.343-4.269.744.841 8.545 2.264 16.398 4.269 23.558-1.157 1.157-1.946 1.682-2.808 2.052-1.015.394-2.305.789-3.009.86.776 2.429 1.318 4.584 1.627 6.464.38 2.322 2.518 22.156 6.411 59.5h-.044l2.037 1.697c2.308 1.962 12.796 7.547 14.132 8.307.891.506 2.067 1.794 3.526 3.864-16.575-.025-27.78-.05-33.613-.075l.053.075C12.788 183.385 0 183.346 0 183.308c0-.116 1.154-3.288 2.538-7.095l2.44-6.658H1.761c-.4-1.385-.792-3.254-1.175-5.606-.75-4.788-.18-7.96 3.05-14.536 3.23-6.518 4.866-10.072 4.866-13.764.058-5.768 1.222-11.316 4.28-17.315 2.364-4.73 3.495-5.086 3.725-7.97l.367-5.421c-2.382-.231-5.928-.988-8.045-1.693l-4.21-1.385-.116-4.326C4.214 85.6 5.08 76.89 7.79 65.757 11.482 50.47 22.096 34.84 34.959 25.668c3.055-2.203 4.272-3.049 5.093-2.807.79-.548 1.483-1.096 2.077-1.645-1.685-.52-3.275-1.222-4.77-2.105-2.311-1.366-4.444-3.194-6.398-5.483.397-.834.904-1.524 1.522-2.07.671-.592 1.935-1.108 3.169-1.822l-.065.021-1.204.401c-1.26.424-1.956.713-2.396 1.032-.829.601-1.259 1.275-1.312 2.032l-.005.191-.579.007c-.012-1.039.516-1.943 1.557-2.699.427-.31 1.013-.573 1.983-.916l1.755-.59.612-.213c.593-.213 1.063-.401 1.438-.584 1.296-1.399 2.17-3.971 4.089-5.678C43.642.855 45.048 0 47.646 0zM27.999 144.476l-.189.512c-2.603 7.055-5.679 15.219-9.228 24.493l2.126 1.771c2.307 1.962 12.795 7.547 14.132 8.307l.035.021c.364-1.006.782-2.154 1.223-3.367l2.44-6.658h-4.242c-1.444-2.617-2.166-4.456-2.166-5.517 0-1.59.913-3.77.913-6.068 0-1.393-1.68-5.89-5.044-13.494zM78.827 42.819l-1.242-.001c-2.375 2.17-3.972 3.706-4.791 4.61-.72.793-2.112 2.23-4.176 4.309 3.033-1.194 5.06-2.078 6.083-2.65 1.5-.865 2.077-1.673 3.807-5.307.082-.163.192-.506.319-.961zm7.313-22.857c-1.119 0-2.026.907-2.026 2.025h4.05c0-1.118-.906-2.025-2.024-2.025zm6.943 0c-1.119 0-2.025.907-2.025 2.025h4.05c0-1.118-.907-2.025-2.025-2.025zm-33.27-5.413c-.388 1.066-.065 2.132.666 2.398.73.266 1.664-.343 2.052-1.408.388-1.065.064-2.132-.667-2.398-.73-.266-1.664.343-2.052 1.408z" transform="translate(29 8)"/>
|
|
26
|
+
<path fill="#80AEF2" fill-rule="nonzero" d="M36.56 183.308c0-.116 1.153-3.288 2.538-7.095l2.538-6.922 6.46-.173 6.403-.173 2.768 2.307c2.308 1.962 12.796 7.547 14.132 8.307.891.506 2.067 1.794 3.526 3.864-25.577-.038-38.365-.077-38.365-.115z" transform="translate(29 8)"/>
|
|
27
|
+
<path fill="#94BBF8" fill-rule="nonzero" d="M3 183.308c0-.116 1.154-3.288 2.538-7.095l2.538-6.922 6.46-.173 6.403-.173 2.769 2.307c2.307 1.962 12.795 7.547 14.132 8.307.89.506 2.066 1.794 3.525 3.864C15.788 183.385 3 183.346 3 183.308z" transform="translate(29 8)"/>
|
|
28
|
+
<path fill="#1D225F" fill-rule="nonzero" d="M46.655 101.836c1.09 3.158 1.826 5.898 2.208 8.22.38 2.321 2.518 22.155 6.411 59.5H37.296c-1.444-2.618-2.166-4.457-2.166-5.518 0-1.59.913-3.77.913-6.068 0-1.532-2.034-6.823-6.104-15.871l3.931-39.349 12.785-.914z" transform="translate(29 8)"/>
|
|
29
|
+
<path fill="url(#ho9etwod5c)" d="M21.554 169.555H4.76c-.4-1.385-.792-3.254-1.175-5.606-.75-4.788-.18-7.96 3.05-14.536 3.23-6.518 4.866-10.072 4.866-13.764.058-5.768 1.222-11.316 4.28-17.315 2.364-4.73 3.495-5.086 3.725-7.97l.42-6.202h21.078c.512 1.433.696 4.075.55 7.925-.145 3.85-6.812 23.006-20.001 57.468z" transform="translate(29 8)"/>
|
|
30
|
+
<g fill-rule="nonzero">
|
|
31
|
+
<path fill="#98BDF9" d="M0 24.302L16.84 3.472 37.031 3.472 19.592 24.302z" transform="translate(29 8) translate(66.94 18.516)"/>
|
|
32
|
+
<path fill="#2174DB" d="M22.2.868c1.378 0 2.506 1.07 2.597 2.425l.006.179h-.578c0-1.119-.907-2.025-2.025-2.025-1.119 0-2.025.906-2.025 2.025 0 1.062.818 1.934 1.859 2.018l.166.007v.578c-1.438 0-2.604-1.165-2.604-2.603 0-1.438 1.166-2.604 2.604-2.604zM29.143.868c1.378 0 2.506 1.07 2.598 2.425l.006.179h-.579c0-1.119-.906-2.025-2.025-2.025-1.118 0-2.025.906-2.025 2.025 0 1.062.818 1.934 1.859 2.018l.166.007v.578c-1.438 0-2.604-1.165-2.604-2.603 0-1.438 1.166-2.604 2.604-2.604z" transform="translate(29 8) translate(66.94 18.516)"/>
|
|
33
|
+
</g>
|
|
34
|
+
<path fill="#F3A29D" fill-rule="nonzero" d="M65.472 46.829c2.807-.962 5.554-2.299 8.242-4.011h6.871c-2.375 2.17-3.972 3.706-4.791 4.61-.82.903-2.509 2.638-5.068 5.205-1.091 5.781-2.254 8.21-3.487 7.285-1.85-1.386-7.939-10.897-1.767-13.09z" transform="translate(29 8)"/>
|
|
35
|
+
<path fill="#FAB6AF" fill-rule="nonzero" d="M69.254 52.654c4.363-1.668 7.179-2.857 8.447-3.567 1.5-.865 2.077-1.673 3.807-5.307.23-.461.692-2.365 1.096-4.153.923-4.557 2.423-4.326 2.538.346.058 1.27.346 2.423.692 2.538.288.116 1.961-1.5 3.634-3.576 1.673-2.077 3.288-3.75 3.576-3.75.692 0 .692 5.307-.057 7.153-.289.865-4.73 5.71-9.864 10.844-3.422 3.423-8.431 8.068-15.026 13.937l1.157-14.465z" transform="translate(29 8)"/>
|
|
36
|
+
<path fill="#F3A29D" fill-rule="nonzero" d="M49.581 27.774c.772-3.086 1.543-5.015 2.315-5.787-1.157-1.157-2.315-2.314-4.63-3.471-.77 1.543-2.314 3.086-4.628 4.629 0 2.314.771 3.857 2.314 4.629 1.543.771 3.086.771 4.63 0z" transform="translate(29 8)"/>
|
|
37
|
+
<g>
|
|
38
|
+
<path fill="url(#mdhg2gjypd)" fill-rule="nonzero" d="M12.858 82.16c-2.365-.174-6.23-.981-8.48-1.731l-4.21-1.385-.115-4.326c-.289-11.94.577-20.65 3.288-31.782C7.032 27.65 17.646 12.019 30.509 2.847c4.96-3.576 5.076-3.576 6.518-1.153.634 1.153 1.96 2.307 2.884 2.653l2.161.594c-3.046 29.324-1.87 53.63 3.531 72.917-1.157 1.158-1.946 1.682-2.808 2.052-1.039.403-2.365.807-3.057.865-.693.058-3 .519-5.25 1.038-4.21.923-13.382 1.096-21.63.346z" transform="translate(29 8) translate(7.45 22.82)"/>
|
|
39
|
+
<path fill="#D6D7D8" d="M58.022 24.008l1.767 11.311-19.972 2.645 1.106-15.653c2.141 1.735 4.344 2.776 6.608 3.123 2.263.348 5.76-.128 10.49-1.426z" transform="translate(29 8) translate(7.45 22.82)"/>
|
|
40
|
+
<path fill="#E9E9E9" fill-rule="nonzero" d="M61.804 29.833l4.903 23.145c-.568 1.157-2.01 1.929-4.324 2.314-5.208.579-10.415-1.736-16.78-1.736-6.365 0-6.09 4.05-15.348.58-6.172-2.315-8.68-12.73-7.523-31.246l18.054-1.73c-.078 5.782.655 9.252 2.198 10.409 1.512 1.134 7.569.601 18.17-1.6l.65-.136z" transform="translate(29 8) translate(7.45 22.82)"/>
|
|
41
|
+
</g>
|
|
42
|
+
<g>
|
|
43
|
+
<path fill="#FAB6AF" fill-rule="nonzero" d="M29.082 7.444c1.07 1.52 1.488 3.536 1.253 6.049-.062.656-.376.883-.376 2.052 0 1.12.07 2.506.212 4.157l-2.317.161c-2.222 2.412-4.574 3.48-7.055 3.207-2.48-.275-4.251-1.343-5.31-3.207-2.18-4.023-1.621-7.444 1.675-10.262 3.296-2.818 7.269-3.537 11.918-2.157z" transform="translate(29 8) translate(32.223)"/>
|
|
44
|
+
<path fill="#E94A47" d="M18.423 0c2.598 0 5.717 1.017 7.994 2.74 2.277 1.722 3.845 3.02 4.55 5.097.47 1.384.248 3.314-.664 5.791.13-2.345-.048-3.647-.533-3.906-.67 1.653-1.595 1.987-2.703 2.787-.62.448-2.791.518-4.917.897-2.628 1.722-4.303 3.33-4.867 4.86-.448 1.218-.402 2.608.148 4.177l.126.339-.54.21c-.714-1.833-.81-3.478-.277-4.925.522-1.417 1.85-2.838 3.894-4.321-1.09.307-2.051.754-2.634 1.449-1.279 1.526-2.028 3.765-2.246 6.716-2.766-.5-5.305-1.433-7.617-2.8-2.312-1.366-4.445-3.194-6.398-5.483.396-.834.904-1.524 1.521-2.07.671-.592 1.935-1.108 3.169-1.822l-.065.021-1.204.401c-1.26.424-1.956.713-2.395 1.032-.83.601-1.26 1.275-1.313 2.032l-.005.191-.579.007c-.012-1.039.516-1.943 1.557-2.699.427-.31 1.013-.573 1.983-.916l1.756-.59.61-.213c.594-.213 1.064-.401 1.439-.584 1.296-1.399 2.17-3.971 4.09-5.678C14.418.855 15.825 0 18.422 0z" transform="translate(29 8) translate(32.223)"/>
|
|
45
|
+
<g fill="#222768" fill-rule="nonzero">
|
|
46
|
+
<path d="M1.025 3.16C1.622 1.52 3.194.563 4.56 1.06c1.061.386 1.653 1.524 1.586 2.781.36-.092.688-.137.988-.137l.208.008c.254.02.466.056.636.114.511-1.271 1.708-2.023 2.749-1.644 1.07.39 1.5 1.802 1.013 3.14-.487 1.337-1.723 2.143-2.794 1.754-.953-.347-1.397-1.504-1.14-2.697-.103-.038-.274-.072-.508-.09-.334-.025-.737.029-1.209.165l-.03.01c-.036.159-.083.318-.14.477-.597 1.64-2.17 2.597-3.536 2.1C1.017 6.543.428 4.8 1.025 3.16zm9.504-.434c-.73-.266-1.664.343-2.052 1.408-.388 1.065-.064 2.132.667 2.398.73.266 1.664-.343 2.052-1.408.387-1.066.064-2.132-.667-2.398zM4.362 1.604c-1.036-.378-2.297.39-2.793 1.754-.496 1.363-.024 2.762 1.012 3.14 1.036.376 2.298-.392 2.794-1.755s.023-2.762-1.013-3.14z" transform="translate(29 8) translate(32.223) translate(22.112 10.415)"/>
|
|
47
|
+
</g>
|
|
48
|
+
</g>
|
|
49
|
+
</g>
|
|
50
|
+
</g>
|
|
51
|
+
<g mask="url(#pitr2853ub)">
|
|
52
|
+
<g>
|
|
53
|
+
<path fill="#FFF" d="M30 0c12.15 0 22 9.85 22 22v11h8v48H0V33h8V22C8 9.973 17.654.198 29.637.004zm0 7.934c-7.755 0-14.067 6.309-14.067 14.067V33h28.133V22c0-7.652-6.14-13.896-13.752-14.063z" transform="translate(134 61)"/>
|
|
54
|
+
<path fill="#D6D7D8" d="M55 34.3V22C55 9.85 45.15 0 33 0S11 9.85 11 22v12.3m7.933 0V22c0-7.757 6.312-14.066 14.068-14.066 7.756 0 14.065 6.31 14.065 14.067v12.298" transform="translate(134 61)"/>
|
|
55
|
+
<path fill="url(#xe2mx0bk0e)" d="M3 33H63V81H3z" transform="translate(134 61)"/>
|
|
56
|
+
<path fill="#3E3D4C" fill-rule="nonzero" d="M39 56c0-3.314-2.686-6-6-6s-6 2.686-6 6c0 2.282 1.275 4.267 3.15 5.281l-.965 7.386h7.63l-.965-7.386C37.726 60.267 39 58.282 39 56z" transform="translate(134 61)"/>
|
|
57
|
+
</g>
|
|
58
|
+
</g>
|
|
59
|
+
</g>
|
|
60
|
+
</g>
|
|
61
|
+
</g>
|
|
62
|
+
</svg>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React, { useMemo, useEffect } from 'react'
|
|
2
|
+
import { useRouteMatch, useParams } from 'react-router'
|
|
3
|
+
import { Link } from 'react-router-dom';
|
|
4
|
+
import { useBreadcrumbContext } from './BreadcrumbStore'
|
|
5
|
+
import { ConditionalWrap } from '../Helper';
|
|
6
|
+
export const BreadcrumbContext = React.createContext(null)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
interface Breadcrumb {
|
|
10
|
+
to: string;
|
|
11
|
+
name: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface UseBreadcrumbState {
|
|
16
|
+
breadcrumbs: Breadcrumb[];
|
|
17
|
+
setCrumb: (props: { [key: string]: any; }) => void;
|
|
18
|
+
resetCrumb: (props: string[]) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface AdvancedAlias {
|
|
22
|
+
component: any;
|
|
23
|
+
linked: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface UseBreadcrumbProps {
|
|
27
|
+
sep?: string;
|
|
28
|
+
alias?: { [key: string]: AdvancedAlias | any; }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type UseBreadcrumbOptionalProps = UseBreadcrumbProps | null
|
|
32
|
+
|
|
33
|
+
export function useBreadcrumb(props?: UseBreadcrumbOptionalProps, deps?: any[]): UseBreadcrumbState {
|
|
34
|
+
let sep = props?.sep || "/"
|
|
35
|
+
deps = deps || []
|
|
36
|
+
const { url, path } = useRouteMatch()
|
|
37
|
+
const params = useParams()
|
|
38
|
+
const { state, setState } = useBreadcrumbContext()
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!props || !props.alias) return
|
|
42
|
+
setState(state => ({ ...state, alias: { ...state.alias, ...props.alias } }))
|
|
43
|
+
return () => resetCrumb(Object.keys(props.alias))
|
|
44
|
+
}, deps)
|
|
45
|
+
|
|
46
|
+
function setCrumb(props) {
|
|
47
|
+
setState(state => ({ ...state, alias: { ...state.alias, ...props } }))
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function resetCrumb(props: string[]) {
|
|
51
|
+
const tempAlias = props.reduce((agg, curr, idx) => {
|
|
52
|
+
delete agg[curr]
|
|
53
|
+
return agg
|
|
54
|
+
}, state.alias)
|
|
55
|
+
setState(state => ({ ...state, alias: tempAlias }))
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let levels: Breadcrumb[] = useMemo(() => {
|
|
59
|
+
const paths = path.split("/").filter(Boolean)
|
|
60
|
+
const urls = url.split("/").filter(Boolean)
|
|
61
|
+
return paths.map((path, idx) => {
|
|
62
|
+
const crumb: Breadcrumb = { to: urls[idx], name: path }
|
|
63
|
+
if (path.startsWith(":") && params[path.replace(":", "")]) {
|
|
64
|
+
crumb.className = "param"
|
|
65
|
+
}
|
|
66
|
+
return crumb
|
|
67
|
+
})
|
|
68
|
+
}, [path, url])
|
|
69
|
+
const { res: breadcrumbs } = useMemo(() => {
|
|
70
|
+
return levels.reduce((agg, curr, idx) => {
|
|
71
|
+
const { res, prefix } = agg
|
|
72
|
+
const { to, name } = curr
|
|
73
|
+
res.push({
|
|
74
|
+
to:
|
|
75
|
+
!state.alias[name]?.component || (state.alias[name]?.component && state.alias[name]?.linked)
|
|
76
|
+
? `${prefix}${to}`
|
|
77
|
+
: null,
|
|
78
|
+
name: typeof state.alias[name] === 'object'
|
|
79
|
+
? !!state.alias[name]?.component ? state.alias[name].component : null
|
|
80
|
+
: state.alias[name] || name,
|
|
81
|
+
className: curr.className || '',
|
|
82
|
+
});
|
|
83
|
+
return { res, prefix: `${prefix}${curr.to}${sep}` }
|
|
84
|
+
}, { res: [], prefix: "/" })
|
|
85
|
+
}, [levels, state])
|
|
86
|
+
|
|
87
|
+
return { breadcrumbs, setCrumb, resetCrumb }
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface Breadcrumbs {
|
|
91
|
+
breadcrumbs: Breadcrumb[]
|
|
92
|
+
sep?: string;
|
|
93
|
+
className?: string;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const BreadCrumb: React.FC<Breadcrumbs> = ({ breadcrumbs, sep = "/", className = "dc__devtron-breadcrumb__item" }) => {
|
|
97
|
+
const { url } = useRouteMatch()
|
|
98
|
+
const filteredCrumbs = breadcrumbs.filter(crumb => !!crumb.name)
|
|
99
|
+
return <React.Fragment>
|
|
100
|
+
{filteredCrumbs.map((breadcrumb, idx) =>
|
|
101
|
+
<React.Fragment key={idx}>
|
|
102
|
+
<ConditionalWrap
|
|
103
|
+
condition={!!breadcrumb.to}
|
|
104
|
+
wrap={children => <Link className={`${url === breadcrumb.to ? 'active' : ''} ${className} ${breadcrumb.className || ""}`} to={breadcrumb.to}>
|
|
105
|
+
{children}
|
|
106
|
+
</Link>}
|
|
107
|
+
>
|
|
108
|
+
{breadcrumb.name}
|
|
109
|
+
</ConditionalWrap>
|
|
110
|
+
|
|
111
|
+
{idx + 1 !== filteredCrumbs.length && breadcrumb.name && <span className={`${className}__separator cn-5`}>{sep}</span>}
|
|
112
|
+
</React.Fragment>
|
|
113
|
+
)}
|
|
114
|
+
</React.Fragment>
|
|
115
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { createContext, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
const initialState = {
|
|
4
|
+
alias: {},
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const Store = ({ children }) => {
|
|
8
|
+
const [state, setState] = useState(initialState)
|
|
9
|
+
return <BreadcrumbContext.Provider value={{ state, setState }}>{children}</BreadcrumbContext.Provider>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const BreadcrumbContext = createContext({
|
|
13
|
+
state: { alias: {} },
|
|
14
|
+
setState: null,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export function useBreadcrumbContext() {
|
|
18
|
+
const context = React.useContext(BreadcrumbContext)
|
|
19
|
+
if (!context) {
|
|
20
|
+
throw new Error(`breadcrumb components cannot be used outside Breadcrumb context`)
|
|
21
|
+
}
|
|
22
|
+
return context
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default Store
|
package/src/Common/Constants.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const RequestTimeout = 60000
|
|
2
|
-
export const Host = process.env.REACT_APP_ORCHESTRATOR_ROOT
|
|
2
|
+
export const Host = process.env.REACT_APP_ORCHESTRATOR_ROOT
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.drawer{
|
|
2
|
+
position: absolute;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
&.left, &.right{
|
|
5
|
+
top: 0;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
width: 0;
|
|
8
|
+
transition: width 200ms;
|
|
9
|
+
&.show{
|
|
10
|
+
min-width: var(--minWidth);
|
|
11
|
+
width: var(--width);
|
|
12
|
+
max-width: var(--maxWidth);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&.top, &.bottom{
|
|
17
|
+
left: 0;
|
|
18
|
+
right: 0;
|
|
19
|
+
height: 0;
|
|
20
|
+
transition: height 200ms;
|
|
21
|
+
&.show{
|
|
22
|
+
height: var(--height);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
&.right{
|
|
26
|
+
right: 0;
|
|
27
|
+
}
|
|
28
|
+
&.left{
|
|
29
|
+
left: 0;
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
&.top{
|
|
33
|
+
top: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.bottom{
|
|
37
|
+
bottom: 0;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react'
|
|
2
|
+
import { VisibleModal } from '../Modals/VisibleModal'
|
|
3
|
+
import './Drawer.scss'
|
|
4
|
+
|
|
5
|
+
interface drawerInterface {
|
|
6
|
+
position: 'left' | 'right' | 'bottom' | 'top'
|
|
7
|
+
children?: any
|
|
8
|
+
backdrop?: boolean
|
|
9
|
+
onClose?: (e: any) => void
|
|
10
|
+
width?: string
|
|
11
|
+
minWidth?: string
|
|
12
|
+
maxWidth?: string
|
|
13
|
+
height?: string
|
|
14
|
+
parentClassName?: string
|
|
15
|
+
onEscape?: (e?: any) => void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const Drawer = ({
|
|
19
|
+
children,
|
|
20
|
+
position,
|
|
21
|
+
height,
|
|
22
|
+
width,
|
|
23
|
+
minWidth,
|
|
24
|
+
maxWidth,
|
|
25
|
+
parentClassName,
|
|
26
|
+
onEscape,
|
|
27
|
+
}: drawerInterface) => {
|
|
28
|
+
const drawerRef = useRef(null)
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
setTimeout(() => drawerRef.current?.classList?.add('show'), 1)
|
|
31
|
+
return () => drawerRef.current?.classList?.remove('show')
|
|
32
|
+
}, [])
|
|
33
|
+
const style = {}
|
|
34
|
+
if (position === 'left' || position === 'right') {
|
|
35
|
+
style['--width'] = width
|
|
36
|
+
style['--minWidth'] = minWidth
|
|
37
|
+
style['--maxWidth'] = maxWidth
|
|
38
|
+
}
|
|
39
|
+
if (position === 'top' || position === 'bottom') {
|
|
40
|
+
style['--height'] = height
|
|
41
|
+
}
|
|
42
|
+
return (
|
|
43
|
+
<VisibleModal className="drawer--container" parentClassName={parentClassName || ''} onEscape={onEscape}>
|
|
44
|
+
<aside style={style} ref={drawerRef} className={`drawer ${position}`}>
|
|
45
|
+
{children}
|
|
46
|
+
</aside>
|
|
47
|
+
</VisibleModal>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './emptyState.scss';
|
|
3
|
+
import { ReactComponent as Progressing } from '../../Assets/Icon/ic-progressing.svg';
|
|
4
|
+
|
|
5
|
+
function EmptyState({ children }) {
|
|
6
|
+
return (
|
|
7
|
+
<div className="flex column empty-state" style={{ width: '100%', height: '100%' }}>
|
|
8
|
+
{children}
|
|
9
|
+
</div>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function Image({ children }) {
|
|
14
|
+
return children
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function Title({ children }) {
|
|
18
|
+
return children
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function Subtitle({ children, className }:{children: any, className?: string}) {
|
|
22
|
+
return <p className={`subtitle ${className}`}>{children}</p>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function Button({ children }) {
|
|
26
|
+
return children
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const Loading: React.FC<{ text: string }> = function (props) {
|
|
30
|
+
return <>
|
|
31
|
+
<Progressing className="dc__block empty-state__loader" />
|
|
32
|
+
<p className="empty-state__loading-text">{props.text}</p>
|
|
33
|
+
</>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
EmptyState.Image = Image
|
|
37
|
+
EmptyState.Title = Title
|
|
38
|
+
EmptyState.Subtitle = Subtitle
|
|
39
|
+
EmptyState.Button = Button
|
|
40
|
+
EmptyState.Loading = Loading
|
|
41
|
+
|
|
42
|
+
export default EmptyState
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
.empty-state {
|
|
2
|
+
height: 100%;
|
|
3
|
+
img {
|
|
4
|
+
height: 40%;
|
|
5
|
+
max-height: 200px;
|
|
6
|
+
width: auto;
|
|
7
|
+
max-width: 250px;
|
|
8
|
+
}
|
|
9
|
+
svg {
|
|
10
|
+
height: 40%;
|
|
11
|
+
max-height: 200px;
|
|
12
|
+
width: auto;
|
|
13
|
+
}
|
|
14
|
+
h1,
|
|
15
|
+
h2,
|
|
16
|
+
h3,
|
|
17
|
+
h4,
|
|
18
|
+
h5,
|
|
19
|
+
h6 {
|
|
20
|
+
color: var(--N900);
|
|
21
|
+
}
|
|
22
|
+
.title {
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
}
|
|
25
|
+
.subtitle {
|
|
26
|
+
font-size: 13px;
|
|
27
|
+
width: 250px;
|
|
28
|
+
font-weight: 400;
|
|
29
|
+
text-align: center;
|
|
30
|
+
line-height: 1.5;
|
|
31
|
+
margin-bottom: 20px;
|
|
32
|
+
}
|
|
33
|
+
.cta {
|
|
34
|
+
height: 36px;
|
|
35
|
+
}
|
|
36
|
+
p {
|
|
37
|
+
width: 250px;
|
|
38
|
+
text-align: center;
|
|
39
|
+
font-size: 13px;
|
|
40
|
+
color: var(--N700);
|
|
41
|
+
}
|
|
42
|
+
strong {
|
|
43
|
+
font-size: 16px;
|
|
44
|
+
margin-bottom: 4px;
|
|
45
|
+
color: var(--N900);
|
|
46
|
+
font-weight: normal;
|
|
47
|
+
}
|
|
48
|
+
.select-popup {
|
|
49
|
+
height: min-content;
|
|
50
|
+
max-height: 250px;
|
|
51
|
+
overflow: auto;
|
|
52
|
+
padding: 8px 0;
|
|
53
|
+
}
|
|
54
|
+
.empty-state__loader {
|
|
55
|
+
width: 34px;
|
|
56
|
+
height: 34px;
|
|
57
|
+
margin-bottom: 16px;
|
|
58
|
+
}
|
|
59
|
+
.empty-state__loading-text {
|
|
60
|
+
font-size: 12px;
|
|
61
|
+
width: 200px;
|
|
62
|
+
font-weight: normal;
|
|
63
|
+
font-stretch: normal;
|
|
64
|
+
font-style: normal;
|
|
65
|
+
line-height: 1.5;
|
|
66
|
+
letter-spacing: normal;
|
|
67
|
+
text-align: center;
|
|
68
|
+
color: var(--N900);
|
|
69
|
+
}
|
|
70
|
+
.button__icon {
|
|
71
|
+
width:16px;
|
|
72
|
+
height:16px;
|
|
73
|
+
margin-left: 8px;
|
|
74
|
+
}
|
|
75
|
+
//TODO: use name
|
|
76
|
+
// .subtitle a {
|
|
77
|
+
// color: inherit;
|
|
78
|
+
// }
|
|
79
|
+
// .subtitle a:focus,
|
|
80
|
+
// .subtitle a:hover {
|
|
81
|
+
// color: inherit;
|
|
82
|
+
// }
|
|
83
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { Component } from 'react'
|
|
2
|
+
import EmptyState from './EmptyState/EmptyState'
|
|
3
|
+
import notAuthorized from '../Assets/Img/ic-not-authorized.svg'
|
|
4
|
+
import Reload from './Reload'
|
|
5
|
+
|
|
6
|
+
export class ErrorScreenManager extends Component<{ code?: number; reload?: (...args) => any; subtitle?: string ;reloadClass?: string}> {
|
|
7
|
+
getMessage() {
|
|
8
|
+
switch (this.props.code) {
|
|
9
|
+
case 400:
|
|
10
|
+
return 'Bad Request'
|
|
11
|
+
case 401:
|
|
12
|
+
return 'Unauthorized'
|
|
13
|
+
case 403:
|
|
14
|
+
return <ErrorScreenNotAuthorized subtitle={this.props.subtitle} />
|
|
15
|
+
case 404:
|
|
16
|
+
return 'Not Found'
|
|
17
|
+
case 500:
|
|
18
|
+
return 'Internal Server Error'
|
|
19
|
+
case 502:
|
|
20
|
+
return 'Bad Gateway'
|
|
21
|
+
case 503:
|
|
22
|
+
return 'Service Temporarily Unavailable'
|
|
23
|
+
default:
|
|
24
|
+
return <Reload className={this.props.reloadClass} />
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
let msg = this.getMessage()
|
|
29
|
+
return (
|
|
30
|
+
<div>
|
|
31
|
+
<h1>{msg}</h1>
|
|
32
|
+
</div>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class ErrorScreenNotAuthorized extends Component<{ subtitle: string }> {
|
|
38
|
+
render() {
|
|
39
|
+
return (
|
|
40
|
+
<EmptyState>
|
|
41
|
+
<EmptyState.Image>
|
|
42
|
+
<img src={notAuthorized} alt="Not Authorized" />
|
|
43
|
+
</EmptyState.Image>
|
|
44
|
+
<EmptyState.Title>
|
|
45
|
+
<h3 className="title">Not authorized</h3>
|
|
46
|
+
</EmptyState.Title>
|
|
47
|
+
<EmptyState.Subtitle>
|
|
48
|
+
{this.props.subtitle
|
|
49
|
+
? this.props.subtitle
|
|
50
|
+
: "Looks like you don't have access to information on this page. Please contact your manager to request access."}
|
|
51
|
+
</EmptyState.Subtitle>
|
|
52
|
+
</EmptyState>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ServerErrors } from "./ServerError"
|
|
2
|
+
import { toast } from 'react-toastify'
|
|
3
|
+
import * as Sentry from '@sentry/browser'
|
|
4
|
+
import { toastAccessDenied } from "./ToastBody"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export function showError(serverError, showToastOnUnknownError = true, hideAccessError = false) {
|
|
8
|
+
if (serverError instanceof ServerErrors && Array.isArray(serverError.errors)) {
|
|
9
|
+
serverError.errors.map(({ userMessage, internalMessage }) => {
|
|
10
|
+
if (serverError.code === 403 && userMessage === 'unauthorized') {
|
|
11
|
+
if (!hideAccessError) {
|
|
12
|
+
toastAccessDenied()
|
|
13
|
+
}
|
|
14
|
+
} else {
|
|
15
|
+
toast.error(userMessage || internalMessage)
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
} else {
|
|
19
|
+
if (serverError.code !== 403 && serverError.code !== 408) {
|
|
20
|
+
Sentry.captureException(serverError)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (showToastOnUnknownError) {
|
|
24
|
+
if (serverError.message) {
|
|
25
|
+
toast.error(serverError.message)
|
|
26
|
+
} else {
|
|
27
|
+
toast.error('Some Error Occurred')
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface ConditionalWrapper<T> {
|
|
34
|
+
condition: boolean
|
|
35
|
+
wrap: (children: T) => T
|
|
36
|
+
children: T
|
|
37
|
+
}
|
|
38
|
+
export const ConditionalWrap: React.FC<ConditionalWrapper<any>> = ({ condition, wrap, children }) =>
|
|
39
|
+
condition ? wrap(children) : <>{children}</>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom'
|
|
3
|
+
export const Modal = ({ style = {}, children, modal = false, rootClassName = "", onClick = null, callbackRef = null }) => {
|
|
4
|
+
const innerRef = React.useRef(null)
|
|
5
|
+
function handleClick(e) {
|
|
6
|
+
if (typeof onClick !== 'function') return
|
|
7
|
+
if (innerRef && innerRef.current.contains(e.target)) {
|
|
8
|
+
onClick(e, 'in')
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
onClick(e, 'out')
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function disableWheel(e) {
|
|
16
|
+
if (innerRef && innerRef.current.contains(e.target)) {
|
|
17
|
+
if (innerRef.current.clientHeight === innerRef.current.scrollHeight) {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
document.addEventListener('click', handleClick)
|
|
27
|
+
let modal = document.getElementById("visible-modal");
|
|
28
|
+
if (modal) modal.classList.add("show")
|
|
29
|
+
document.body.addEventListener('wheel', disableWheel, { passive: false })
|
|
30
|
+
return () => {
|
|
31
|
+
document.body.removeEventListener('wheel', disableWheel)
|
|
32
|
+
document.removeEventListener('click', handleClick)
|
|
33
|
+
if (modal) modal.classList.remove("show")
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
}, []
|
|
37
|
+
)
|
|
38
|
+
return ReactDOM.createPortal(
|
|
39
|
+
<div tabIndex={0} onClick={onClick}
|
|
40
|
+
ref={
|
|
41
|
+
el => {
|
|
42
|
+
if (typeof callbackRef === 'function') {
|
|
43
|
+
callbackRef(el);
|
|
44
|
+
}
|
|
45
|
+
innerRef.current = el;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
id="popup"
|
|
49
|
+
className={`${rootClassName} popup ${modal ? 'modal' : ''}`}
|
|
50
|
+
style={{ ...style }}>
|
|
51
|
+
{children}
|
|
52
|
+
</div>, document.getElementById('visible-modal'));
|
|
53
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import closeIcon from '../../Assets/Icon/ic-close.svg'
|
|
4
|
+
|
|
5
|
+
export interface OpaqueModalProps {
|
|
6
|
+
className?: string;
|
|
7
|
+
onHide?: any;
|
|
8
|
+
noBackground?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class OpaqueModal extends React.Component<OpaqueModalProps> {
|
|
12
|
+
modalRef = document.getElementById('full-screen-modal');
|
|
13
|
+
|
|
14
|
+
componentDidMount() {
|
|
15
|
+
if (this.props.noBackground)
|
|
16
|
+
this.modalRef.classList.add("show");
|
|
17
|
+
else this.modalRef.classList.add("show-with-bg");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
componentWillUnmount() {
|
|
21
|
+
this.modalRef.classList.remove("show");
|
|
22
|
+
this.modalRef.classList.remove("show-with-bg");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
render() {
|
|
26
|
+
const { className = "", onHide = null } = { ...this.props };
|
|
27
|
+
|
|
28
|
+
return ReactDOM.createPortal(
|
|
29
|
+
<div className={`full-screen-modal__body-container ${className}`}>
|
|
30
|
+
{this.props.children}
|
|
31
|
+
{typeof onHide === 'function' && <div className="close-btn icon-dim-24" onClick={e => onHide(false)}>
|
|
32
|
+
<img className="close-img" src={closeIcon} alt="close" />
|
|
33
|
+
</div>}
|
|
34
|
+
</div>, document.getElementById('full-screen-modal'))
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import ReactDOM from 'react-dom'
|
|
3
|
+
|
|
4
|
+
export class VisibleModal extends React.Component<{
|
|
5
|
+
className: string
|
|
6
|
+
parentClassName?: string
|
|
7
|
+
noBackground?: boolean
|
|
8
|
+
close?: (e) => void
|
|
9
|
+
onEscape?: (e) => void
|
|
10
|
+
}> {
|
|
11
|
+
modalRef = document.getElementById('visible-modal')
|
|
12
|
+
|
|
13
|
+
constructor(props) {
|
|
14
|
+
super(props)
|
|
15
|
+
this.escFunction = this.escFunction.bind(this)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
escFunction(event) {
|
|
19
|
+
if (event.keyCode === 27 || event.key === 'Escape') {
|
|
20
|
+
if (this.props.onEscape) {
|
|
21
|
+
this.props.onEscape(event)
|
|
22
|
+
} else if (this.props.close) {
|
|
23
|
+
this.props.close(event)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
componentDidMount() {
|
|
29
|
+
document.addEventListener('keydown', this.escFunction)
|
|
30
|
+
this.modalRef.classList.add(this.props.noBackground ? 'show' : 'show-with-bg')
|
|
31
|
+
|
|
32
|
+
if (this.props.parentClassName) {
|
|
33
|
+
this.modalRef.classList.add(this.props.parentClassName)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
componentWillUnmount() {
|
|
38
|
+
document.removeEventListener('keydown', this.escFunction)
|
|
39
|
+
this.modalRef.classList.remove('show')
|
|
40
|
+
this.modalRef.classList.remove('show-with-bg')
|
|
41
|
+
|
|
42
|
+
if (this.props.parentClassName) {
|
|
43
|
+
this.modalRef.classList.remove(this.props.parentClassName)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
render() {
|
|
48
|
+
return ReactDOM.createPortal(
|
|
49
|
+
<div className={`visible-modal__body ${this.props.className}`} onClick={this.props?.close}>
|
|
50
|
+
{this.props.children}
|
|
51
|
+
</div>,
|
|
52
|
+
document.getElementById('visible-modal'),
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
}
|