px-react-ui-components 1.0.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.
Files changed (75) hide show
  1. package/.babelrc +3 -0
  2. package/README.md +126 -0
  3. package/dist/components/MyAlert/MyAlert.css +113 -0
  4. package/dist/components/MyAlert/MyAlert.js +109 -0
  5. package/dist/components/MyContainer/MyContainer.js +59 -0
  6. package/dist/components/MyContainer/MyContainer.module.css +110 -0
  7. package/dist/components/MyContainer/MyContainerBody.js +9 -0
  8. package/dist/components/MyContainer/MyContainerFooter.js +9 -0
  9. package/dist/components/MyContainer/MyContainerRight.js +10 -0
  10. package/dist/components/MyEditor/MyEditor.js +292 -0
  11. package/dist/components/MyEditor/MyEditor.scss +277 -0
  12. package/dist/components/MyFileUpload/MyFileUpload.js +288 -0
  13. package/dist/components/MyFileUpload/MyFileUpload.module.css +86 -0
  14. package/dist/components/MyImageCropper/MyImageCropper.js +95 -0
  15. package/dist/components/MyInput/MyInput.js +768 -0
  16. package/dist/components/MyInput/MyInput.module.css +420 -0
  17. package/dist/components/MyMaps/YandexMaps.js +162 -0
  18. package/dist/components/MyMenu/MenuItem.js +55 -0
  19. package/dist/components/MyMenu/MyMenu.module.css +102 -0
  20. package/dist/components/MyModal/MyModal.css +83 -0
  21. package/dist/components/MyModal/MyModal.js +71 -0
  22. package/dist/components/MyModal/MyModalBody.js +9 -0
  23. package/dist/components/MyModal/MyModalFooter.js +9 -0
  24. package/dist/components/MyNotFound/MyNotFound.css +22 -0
  25. package/dist/components/MyNotFound/MyNotFound.js +20 -0
  26. package/dist/components/MyScrollableCard/MyScrollableCard.js +74 -0
  27. package/dist/components/MyTable/MyTable.js +310 -0
  28. package/dist/components/MyTable/MyTable.module.css +350 -0
  29. package/dist/components/MyTable/MyTableBody.js +9 -0
  30. package/dist/components/MyTable/MyTableHead.js +9 -0
  31. package/dist/components/MyTabs/MyTabPane.js +17 -0
  32. package/dist/components/MyTabs/MyTabs.css +105 -0
  33. package/dist/components/MyTabs/MyTabs.js +66 -0
  34. package/dist/components/MyWaiting/MyWaiting.css +28 -0
  35. package/dist/components/MyWaiting/MyWaiting.js +27 -0
  36. package/dist/components/MyZoomImage/MyZoomImage.css +0 -0
  37. package/dist/components/MyZoomImage/MyZoomImage.js +108 -0
  38. package/dist/index.js +15 -0
  39. package/package.json +44 -0
  40. package/src/components/MyAlert/MyAlert.css +113 -0
  41. package/src/components/MyAlert/MyAlert.jsx +96 -0
  42. package/src/components/MyContainer/MyContainer.jsx +90 -0
  43. package/src/components/MyContainer/MyContainer.module.css +110 -0
  44. package/src/components/MyContainer/MyContainerBody.jsx +8 -0
  45. package/src/components/MyContainer/MyContainerFooter.jsx +8 -0
  46. package/src/components/MyContainer/MyContainerRight.jsx +11 -0
  47. package/src/components/MyEditor/MyEditor.jsx +252 -0
  48. package/src/components/MyEditor/MyEditor.scss +277 -0
  49. package/src/components/MyFileUpload/MyFileUpload.jsx +373 -0
  50. package/src/components/MyFileUpload/MyFileUpload.module.css +86 -0
  51. package/src/components/MyImageCropper/MyImageCropper.jsx +108 -0
  52. package/src/components/MyInput/MyInput.jsx +896 -0
  53. package/src/components/MyInput/MyInput.module.css +420 -0
  54. package/src/components/MyMaps/YandexMaps.jsx +186 -0
  55. package/src/components/MyMenu/MenuItem.jsx +62 -0
  56. package/src/components/MyMenu/MyMenu.module.css +102 -0
  57. package/src/components/MyModal/MyModal.css +83 -0
  58. package/src/components/MyModal/MyModal.jsx +78 -0
  59. package/src/components/MyModal/MyModalBody.jsx +8 -0
  60. package/src/components/MyModal/MyModalFooter.jsx +8 -0
  61. package/src/components/MyNotFound/MyNotFound.css +22 -0
  62. package/src/components/MyNotFound/MyNotFound.jsx +11 -0
  63. package/src/components/MyScrollableCard/MyScrollableCard.jsx +86 -0
  64. package/src/components/MyTable/MyTable.jsx +458 -0
  65. package/src/components/MyTable/MyTable.module.css +350 -0
  66. package/src/components/MyTable/MyTableBody.jsx +8 -0
  67. package/src/components/MyTable/MyTableHead.jsx +10 -0
  68. package/src/components/MyTabs/MyTabPane.jsx +9 -0
  69. package/src/components/MyTabs/MyTabs.css +105 -0
  70. package/src/components/MyTabs/MyTabs.jsx +63 -0
  71. package/src/components/MyWaiting/MyWaiting.css +28 -0
  72. package/src/components/MyWaiting/MyWaiting.jsx +27 -0
  73. package/src/components/MyZoomImage/MyZoomImage.css +0 -0
  74. package/src/components/MyZoomImage/MyZoomImage.jsx +139 -0
  75. package/src/index.js +15 -0
@@ -0,0 +1,105 @@
1
+ .my-TabsContainer {
2
+ display: flex;
3
+ width: 100%;
4
+ gap: 0px;
5
+ flex-direction: column;
6
+ }
7
+
8
+ .my-TabsTabList {
9
+ display: flex;
10
+ flex-direction: row;
11
+ width: 100%;
12
+ list-style: none;
13
+ padding: 0 0 0 7px;
14
+ margin: 0px;
15
+ }
16
+
17
+ .my-TabsTabList li {
18
+ display: flex;
19
+ flex-direction: row;
20
+ padding: 8px 17px;
21
+ min-width: 100px;
22
+ text-align: center;
23
+ background: #f5f5f5;
24
+ margin-right: 1px;
25
+ font-size: 13px;
26
+ border-radius: 8px 8px 0 0;
27
+ gap: 0.5rem;
28
+ justify-content: center;
29
+ align-items: center;
30
+ -webkit-user-select: none; /* Safari */
31
+ -ms-user-select: none; /* IE 10 and IE 11 */
32
+ user-select: none; /* Standard syntax */
33
+ border: 1px solid #dfe3e6;
34
+ border-bottom: none;
35
+ }
36
+
37
+ .my-TabsTabList li .icon {
38
+ font-size: 17px;
39
+ color: #8a9ba4;
40
+ }
41
+
42
+ .my-TabsTabList li .badge {
43
+ font-size: 9px;
44
+ color: #39464d;
45
+ background-color: #0000001f;
46
+ border-radius: 5px;
47
+ padding: 1px 5px 1px 5px;
48
+ margin-left: 5px;
49
+ margin-right: -8px;
50
+ }
51
+
52
+ .my-TabsTabList li .title {
53
+ font-size: 13px;
54
+ color: #000;
55
+
56
+ }
57
+
58
+
59
+ .my-TabsTabList li .description {
60
+ font-size: 11px;
61
+ color: #8a9ba4;
62
+ }
63
+
64
+ .my-TabsTabList li.active {
65
+ background: #b3d2e6;
66
+ }
67
+ .my-TabsTabList li.active .badge {
68
+ background-color: #2e465685;
69
+ color: #fff;
70
+ }
71
+ .my-TabsTabList li.active .title {
72
+ font-weight: 600;
73
+ }
74
+ .my-TabsTabList li.active .icon {
75
+ color: #000;
76
+ }
77
+ .my-TabsTabList li.active .description {
78
+ color: #435d6e;
79
+ }
80
+
81
+ .my-TabsTabList li:hover {
82
+ cursor: pointer;
83
+ background: #eeeeee;
84
+ }
85
+ .my-TabsTabList li.active:hover {
86
+ background: #c1ddf3;
87
+ }
88
+
89
+ .my-TabsTabBody {
90
+ display: inline-block;
91
+ width: 100%;
92
+ padding: 12px;
93
+ border: 1px solid #d9dee1;
94
+ border-radius: 8px;
95
+ border-top-width: 2px;
96
+ border-top-color: #b3d2e6;
97
+ }
98
+ .my-TabsTabBody .my-TabsTabContainer {
99
+ display: none;
100
+ width: 100%;
101
+ }
102
+ .my-TabsTabBody .my-TabsTabContainer.active {
103
+ display: inline-block;
104
+ width: 100%;
105
+ }
@@ -0,0 +1,66 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import "./MyTabs.css";
3
+ function MyTabs({
4
+ children,
5
+ className = null,
6
+ style = null,
7
+ onChange = null,
8
+ activePaneIndex = -1,
9
+ activePaneName = null
10
+ }) {
11
+ const [activei, setActivei] = useState(activePaneIndex > -1 ? activePaneIndex : 0);
12
+ const arrChild = React.Children.toArray(children);
13
+ useEffect(() => {
14
+ if (onChange) {
15
+ onChange({
16
+ index: activei,
17
+ name: arrChild[activei].props.name,
18
+ label: arrChild[activei].props.label && arrChild[activei].props.label || arrChild[activei].props.title
19
+ });
20
+ }
21
+ }, [activei]);
22
+ useEffect(() => {
23
+ if (activePaneName) {
24
+ const index = arrChild.findIndex(item => item.props.name === activePaneName);
25
+ if (index > -1) {
26
+ setActivei(index);
27
+ }
28
+ }
29
+ }, [activePaneName]);
30
+ return /*#__PURE__*/React.createElement("div", {
31
+ className: "my-TabsContainer " + (className ? className : ''),
32
+ style: style
33
+ }, /*#__PURE__*/React.createElement("ul", {
34
+ className: "my-TabsTabList"
35
+ }, arrChild.map((item, i) => {
36
+ return /*#__PURE__*/React.createElement("li", {
37
+ key: i,
38
+ className: (i == activei && 'active') + ' ' + (item.props.tabClassName ? item.props.tabClassName : ''),
39
+ style: item.props.tabStyle,
40
+ onClick: () => setActivei(i),
41
+ title: item.props.title
42
+ }, item.props.icon != undefined && /*#__PURE__*/React.createElement("div", {
43
+ className: "icon"
44
+ }, item.props.icon), /*#__PURE__*/React.createElement("div", {
45
+ className: "flex flex-col gap-0 text-start"
46
+ }, item.props.label != undefined ? /*#__PURE__*/React.createElement("span", {
47
+ className: "title"
48
+ }, item.props.label) : /*#__PURE__*/React.createElement("span", {
49
+ className: "title"
50
+ }, item.props.title), item.props.description != undefined && /*#__PURE__*/React.createElement("div", {
51
+ className: "description"
52
+ }, item.props.description)), item.props.badge != undefined && /*#__PURE__*/React.createElement("div", {
53
+ className: "badge"
54
+ }, item.props.badge));
55
+ })), /*#__PURE__*/React.createElement("div", {
56
+ className: "my-TabsTabBody"
57
+ }, arrChild.map((item, i) => {
58
+ return /*#__PURE__*/React.createElement("div", {
59
+ key: i,
60
+ className: "my-TabsTabContainer " + (i == activei && 'active') + ' ' + (item.props.className ? item.props.className : ''),
61
+ style: item.props.style,
62
+ onClick: () => setActivei(i)
63
+ }, item.props.children);
64
+ })));
65
+ }
66
+ export default MyTabs;
@@ -0,0 +1,28 @@
1
+ .my-waiting-backdrop {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ background-color: #282c39de;
8
+ display: flex;
9
+ justify-content: center;
10
+ align-items: center;
11
+ z-index: 9999999;
12
+ }
13
+
14
+ .my-waiting-content{
15
+ display: block;
16
+ color : #fff;
17
+ }
18
+
19
+ .my-waiting-content > div{
20
+ justify-content: center;
21
+ }
22
+
23
+
24
+ .my-waiting-message{
25
+ display: block;
26
+ padding: 15px 0;
27
+ text-align: center;
28
+ }
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import { Oval } from "react-loader-spinner";
3
+ import './MyWaiting.css'; // Modal için CSS dosyası
4
+
5
+ export default function MyWaiting({
6
+ show = false,
7
+ message = null
8
+ }) {
9
+ if (!show) {
10
+ return null;
11
+ }
12
+ return /*#__PURE__*/React.createElement("div", {
13
+ className: "my-waiting-backdrop"
14
+ }, /*#__PURE__*/React.createElement("div", {
15
+ className: "my-waiting-content"
16
+ }, /*#__PURE__*/React.createElement(Oval, {
17
+ visible: true,
18
+ height: "60",
19
+ width: "60",
20
+ color: "#fff",
21
+ secondaryColor: "#cdcdcd",
22
+ ariaLabel: "oval-loading",
23
+ strokeWidth: 5
24
+ }), message && /*#__PURE__*/React.createElement("span", {
25
+ className: "my-waiting-message"
26
+ }, message)));
27
+ }
File without changes
@@ -0,0 +1,108 @@
1
+ import React, { useRef, useState } from "react";
2
+ import { TransformWrapper, TransformComponent, useControls } from "react-zoom-pan-pinch";
3
+ import "./MyZoomImage.css";
4
+ import { PiMinusBold, PiPlusBold, PiX, PiArrowUpBold, PiArrowDownBold, PiArrowLeftBold, PiArrowRightBold, PiArrowsIn } from "react-icons/pi";
5
+ const Controls = ({
6
+ wrapperRef,
7
+ openArrow
8
+ }) => {
9
+ const {
10
+ zoomIn,
11
+ zoomOut,
12
+ resetTransform,
13
+ centerView
14
+ } = useControls();
15
+ const handlePan = (x, y) => {
16
+ if (wrapperRef.current) {
17
+ // debugger
18
+ // Mevcut pozisyonu al
19
+ const state = wrapperRef.current.instance.transformState;
20
+ // Pozisyonu güncelle
21
+ wrapperRef.current.instance.setTransformState(state.scale, state.positionX + x, state.positionY + y);
22
+ }
23
+ };
24
+ return /*#__PURE__*/React.createElement("div", {
25
+ className: "absolute flex flex-col gap-1 z-50 top-3 left-5"
26
+ }, /*#__PURE__*/React.createElement("div", {
27
+ className: "flex gap-1 mb-3"
28
+ }, /*#__PURE__*/React.createElement("button", {
29
+ className: "bg-slate-400 hover:bg-slate-500 rounded-full p-2",
30
+ onClick: () => zoomIn(),
31
+ title: "Zoom +"
32
+ }, /*#__PURE__*/React.createElement(PiPlusBold, {
33
+ className: "text-lg text-white"
34
+ })), /*#__PURE__*/React.createElement("button", {
35
+ className: "bg-slate-400 hover:bg-slate-500 rounded-full p-2",
36
+ onClick: () => zoomOut(),
37
+ title: "Zoom -"
38
+ }, /*#__PURE__*/React.createElement(PiMinusBold, {
39
+ className: "text-lg text-white"
40
+ })), /*#__PURE__*/React.createElement("button", {
41
+ className: "bg-slate-400 hover:bg-slate-500 rounded-full p-2",
42
+ onClick: () => resetTransform(),
43
+ title: "Zoom Cancel"
44
+ }, /*#__PURE__*/React.createElement(PiX, {
45
+ className: "text-lg text-white"
46
+ }))), openArrow && /*#__PURE__*/React.createElement("div", {
47
+ className: "flex flex-col items-center p-2"
48
+ }, /*#__PURE__*/React.createElement("button", {
49
+ className: "bg-blue-400 hover:bg-blue-500 rounded-full p-2 mb-1",
50
+ onClick: () => handlePan(0, 30)
51
+ }, /*#__PURE__*/React.createElement(PiArrowUpBold, {
52
+ className: "text-lg text-white"
53
+ })), /*#__PURE__*/React.createElement("div", {
54
+ className: "flex"
55
+ }, /*#__PURE__*/React.createElement("button", {
56
+ className: "bg-blue-400 hover:bg-blue-500 rounded-full p-2",
57
+ onClick: () => handlePan(30, 0)
58
+ }, /*#__PURE__*/React.createElement(PiArrowLeftBold, {
59
+ className: "text-lg text-white"
60
+ })), /*#__PURE__*/React.createElement("button", {
61
+ className: "bg-blue-400 hover:bg-blue-500 rounded-full p-2 ml-1 mr-1",
62
+ onClick: () => centerView(),
63
+ title: "Center"
64
+ }, /*#__PURE__*/React.createElement(PiArrowsIn, {
65
+ className: "text-lg text-white"
66
+ })), /*#__PURE__*/React.createElement("button", {
67
+ className: "bg-blue-400 hover:bg-blue-500 rounded-full p-2",
68
+ onClick: () => handlePan(-30, 0)
69
+ }, /*#__PURE__*/React.createElement(PiArrowRightBold, {
70
+ className: "text-lg text-white"
71
+ }))), /*#__PURE__*/React.createElement("button", {
72
+ className: "bg-blue-400 hover:bg-blue-500 rounded-full p-2 mt-1",
73
+ onClick: () => handlePan(0, -30)
74
+ }, /*#__PURE__*/React.createElement(PiArrowDownBold, {
75
+ className: "text-lg text-white"
76
+ }))));
77
+ };
78
+ const MyImageZoom = ({
79
+ image,
80
+ children = null,
81
+ onZoomChange = null
82
+ }) => {
83
+ const wrapperRef = useRef(null); // Ref oluştur
84
+ const [openArrow, setOpenArrow] = useState(false);
85
+ const handlerTransform = e => {
86
+ setOpenArrow(e.state.scale != 1);
87
+ if (onZoomChange != null) {
88
+ onZoomChange(e.state);
89
+ }
90
+ };
91
+ return /*#__PURE__*/React.createElement("div", {
92
+ className: "zoom-container flex justify-center items-center"
93
+ }, /*#__PURE__*/React.createElement(TransformWrapper, {
94
+ ref: wrapperRef,
95
+ className: "w-full flex items-center justify-center",
96
+ onTransformed: handlerTransform
97
+ }, /*#__PURE__*/React.createElement(Controls, {
98
+ wrapperRef: wrapperRef,
99
+ openArrow: openArrow
100
+ }), /*#__PURE__*/React.createElement(TransformComponent, {
101
+ className: "w-full flex items-center justify-center"
102
+ }, children || /*#__PURE__*/React.createElement("img", {
103
+ src: image,
104
+ alt: "Zoomable",
105
+ className: "max-w-full object-cover rounded-md "
106
+ }))));
107
+ };
108
+ export default MyImageZoom;
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ export { default as MyInput } from './components/MyInput';
2
+ export { default as MyAlert } from './components/MyAlert';
3
+ export { default as MyContainer } from './components/MyContainer';
4
+ export { default as MyEditor } from './components/MyEditor';
5
+ export { default as MyFileUpload } from './components/MyFileUpload';
6
+ export { default as MyImageCropper } from './components/MyImageCropper';
7
+ export { default as MyMaps } from './components/MyMaps';
8
+ export { default as MyMenu } from './components/MyMenu';
9
+ export { default as MyModal } from './components/MyModal';
10
+ export { default as MyNotFound } from './components/MyNotFound';
11
+ export { default as MyScrollableCard } from './components/MyScrollableCard';
12
+ export { default as MyTable } from './components/MyTable';
13
+ export { default as MyTabs } from './components/MyTabs';
14
+ export { default as MyWaiting } from './components/MyWaiting';
15
+ export { default as MyZoomImage } from './components/MyZoomImage';
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "px-react-ui-components",
3
+ "version": "1.0.0",
4
+ "main": "dist/index.js",
5
+ "scripts": {
6
+ "build": "babel src --out-dir dist --copy-files"
7
+ },
8
+ "keywords": [
9
+ "react",
10
+ "components",
11
+ "ui",
12
+ "ui-components",
13
+ "library",
14
+ "design system",
15
+ "styled-components",
16
+ "tailwindcss",
17
+ "input",
18
+ "select",
19
+ "datepicker",
20
+ "container",
21
+ "tabs"
22
+ ],
23
+ "author": "Piri AYKUT | piriaykut@gmail.com",
24
+ "license": "MIT",
25
+ "description": "React UI components library",
26
+ "devDependencies": {
27
+ "@babel/cli": "^7.27.0",
28
+ "@babel/core": "^7.26.10",
29
+ "@babel/preset-react": "^7.26.3"
30
+ },
31
+ "peerDependencies": {
32
+ "react": "^18.3.1",
33
+ "react-dom": "^18.3.1",
34
+ "katex": "^0.16.21",
35
+ "quill": "^2.0.3",
36
+ "quill-image-resize-module-react": "^3.0.0",
37
+ "quill-table-ui": "^1.0.7",
38
+ "react-confirm-alert": "^3.0.6",
39
+ "react-icons": "^5.5.0",
40
+ "react-image-crop": "^11.0.7",
41
+ "react-loader-spinner": "^6.1.6",
42
+ "react-zoom-pan-pinch": "^3.7.0"
43
+ }
44
+ }
@@ -0,0 +1,113 @@
1
+
2
+ .react-confirm-alert-blur {
3
+ filter: url(#gaussian-blur);
4
+ filter: blur(2px);
5
+ -webkit-filter: blur(2px);
6
+ }
7
+
8
+ .react-confirm-alert-overlay {
9
+ position: fixed;
10
+ top: 0;
11
+ left: 0;
12
+ right: 0;
13
+ bottom: 0;
14
+ z-index: 9999;
15
+ background: rgba(99, 99, 99, 0.9);
16
+ display: -webkit-flex;
17
+ display: -moz-flex;
18
+ display: -ms-flex;
19
+ display: -o-flex;
20
+ display: flex;
21
+ justify-content: center;
22
+ -ms-align-items: center;
23
+ align-items: center;
24
+ opacity: 0;
25
+ -webkit-animation: react-confirm-alert-fadeIn 0.5s 0.2s forwards;
26
+ -moz-animation: react-confirm-alert-fadeIn 0.5s 0.2s forwards;
27
+ -o-animation: react-confirm-alert-fadeIn 0.5s 0.2s forwards;
28
+ animation: react-confirm-alert-fadeIn 0.5s 0.2s forwards;
29
+ }
30
+
31
+ .react-confirm-alert-body {
32
+ font-family: "Nunito", sans-serif;
33
+ width: 90%; /* Daha geniş cihazlarda %90 genişlik */
34
+ max-width: 400px; /* Maksimum genişlik sınırı */
35
+ padding: 20px;
36
+ text-align: left;
37
+ background: #fff;
38
+ border-radius: 10px;
39
+ box-shadow: 0 20px 75px rgba(0, 0, 0, 0.13);
40
+ color: #666;
41
+ text-align: center;
42
+ margin: 0 auto; /* Orta hizalama */
43
+ }
44
+
45
+ @media (max-width: 600px) {
46
+ .react-confirm-alert-body {
47
+ width: 95%; /* Küçük ekranlarda daha fazla boşluk */
48
+ max-width: 320px; /* Maksimum genişlik daha küçük */
49
+ }
50
+ }
51
+
52
+ .react-confirm-alert-svg {
53
+ position: absolute;
54
+ top: 0;
55
+ left: 0;
56
+ }
57
+
58
+ .react-confirm-alert-body > h1 {
59
+ margin-top: 0;
60
+ color: #1e293b !important;
61
+ font-weight: bold;
62
+ font-size: 1.3em;
63
+ border-radius: 0px;
64
+ }
65
+
66
+ .react-confirm-alert-body > h3 {
67
+ margin: 0;
68
+ font-size: 3.5em !important;
69
+ color: #1e293b !important;
70
+ }
71
+
72
+ .react-confirm-alert-button-group {
73
+ display: -webkit-flex;
74
+ display: -moz-flex;
75
+ display: -ms-flex;
76
+ display: -o-flex;
77
+ display: flex;
78
+ justify-content: space-between;
79
+ margin-top: 30px;
80
+ }
81
+
82
+ .react-confirm-alert-button-group > button {
83
+ outline: none;
84
+ background: #1e293b;
85
+ border: none;
86
+ display: inline-block;
87
+ padding: 10px 18px;
88
+ color: #fff;
89
+ margin-right: 10px;
90
+ border-radius: 5px;
91
+ font-size: 1em;
92
+ cursor: pointer;
93
+ width: 100%;
94
+
95
+ &:hover {
96
+ opacity: 0.8;
97
+ }
98
+
99
+ &:last-child {
100
+ background: #506280 !important;
101
+ color: #fff;
102
+ }
103
+ &:first-child {
104
+ background: #1e293b !important;
105
+ color: #fff;
106
+ }
107
+ }
108
+
109
+ .react-confirm-alert-body {
110
+ width: 500px;
111
+ max-height: 300px;
112
+ overflow: auto;
113
+ }
@@ -0,0 +1,96 @@
1
+ import React from "react";
2
+
3
+ import { confirmAlert } from "react-confirm-alert";
4
+ import "react-confirm-alert/src/react-confirm-alert.css";
5
+ import "./MyAlert.css";
6
+
7
+ // import Swal from "sweetalert2";
8
+
9
+ export const MyAlertType = {
10
+ WARNING: 'warning',
11
+ ERROR: 'error',
12
+ SUCCESS: 'success',
13
+ INFO: 'info',
14
+ QUESTION: 'question'
15
+ };
16
+
17
+ Object.freeze(MyAlertType); // Enum sabitlerini değiştirmeyi engeller
18
+
19
+ export const MyAlert = (message, type = MyAlertType.INFO, { title = '', buttontext = { confirm: 'Tamam', cancel: 'İptal' }, callback = null } = {}) => {
20
+ let _showCancelButton = false;
21
+ switch (type) {
22
+ case MyAlertType.WARNING:
23
+ title = title ? title : 'Uyarı';
24
+ break;
25
+ case MyAlertType.ERROR:
26
+ title = title ? title : 'Hata!';
27
+ break;
28
+ case MyAlertType.SUCCESS:
29
+ title = title ? title : 'İşlem Başarılı';
30
+ break;
31
+ case MyAlertType.INFO:
32
+ title = title ? title : 'Bilgi';
33
+ break;
34
+ case MyAlertType.QUESTION:
35
+ title = title ? title : 'Onaylıyor musunuz?';
36
+ _showCancelButton = true;
37
+
38
+ if (buttontext.confirm == "Tamam") {
39
+ buttontext.confirm = "Evet";
40
+ buttontext.cancel = "Hayır";
41
+ }
42
+ break;
43
+ }
44
+
45
+ let _buttons = [
46
+ {
47
+ label: buttontext.confirm,
48
+ onClick: () => {
49
+ if (callback) callback({ isConfirmed: true, isDenied: false });
50
+ },
51
+ },
52
+ ];
53
+
54
+ if (_showCancelButton) {
55
+ _buttons.push({
56
+ label: buttontext.cancel,
57
+ onClick: () => {
58
+ if (callback) callback({ isConfirmed: false, isDenied: true });
59
+ },
60
+ });
61
+ }
62
+
63
+ confirmAlert({
64
+ title: title,
65
+ message: <div dangerouslySetInnerHTML={{
66
+ __html: (typeof message === 'string' ? message : message.props?.children || message.toString())
67
+ }}></div>,
68
+ buttons: _buttons,
69
+ onClickOutside: () => {
70
+ if (callback) callback({ isConfirmed: false, isDenied: true });
71
+ },
72
+ onKeypressEscape: () => {
73
+ if (callback) callback({ isConfirmed: false, isDenied: true });
74
+ }
75
+ });
76
+
77
+ // Swal.fire({
78
+ // title: title,
79
+ // html: message,
80
+ // icon: type,
81
+ // focusConfirm: true,
82
+ // confirmButtonText: buttontext.confirm,
83
+ // cancelButtonText: buttontext.cancel,
84
+ // showCancelButton: _showCancelButton
85
+ // }).then((result) => {
86
+ // if (callback){
87
+ // callback(result);
88
+ // }
89
+ // // /* Read more about isConfirmed, isDenied below */
90
+ // // if (result.isConfirmed) {
91
+ // // // Swal.fire("Saved!", "", "success");
92
+ // // } else if (result.isDenied) {
93
+ // // // Swal.fire("Changes are not saved", "", "info");
94
+ // // }
95
+ // });
96
+ }
@@ -0,0 +1,90 @@
1
+ import React from "react";
2
+ import styles from "./MyContainer.module.css";
3
+
4
+ function MyContainer({
5
+ children,
6
+ title = "",
7
+ description = null,
8
+ icon = null,
9
+ className = null,
10
+ titleTextStyle = null,
11
+ style = null,
12
+ headerClassName = null,
13
+ headerStyle = null,
14
+ bodyClassName = null,
15
+ bodyStyle = null,
16
+ footerClassName = null,
17
+ footerStyle = null,
18
+ }) {
19
+ const arrChild = React.Children.toArray(children);
20
+
21
+ let childHeaderRight = null;
22
+ let childBody = null;
23
+ let childFooter = null;
24
+
25
+ for (let i = 0; i < arrChild.length; i++) {
26
+ const el = arrChild[i];
27
+ if (el.type && el.type.toString().includes("MyContainerTagRight")) {
28
+ childHeaderRight = el;
29
+ } else if (
30
+ el.type &&
31
+ el.type.toString().includes("MyContainerTagBody")
32
+ ) {
33
+ childBody = el;
34
+ } else if (
35
+ el.type &&
36
+ el.type.toString().includes("MyContainerTagFooter")
37
+ ) {
38
+ childFooter = el;
39
+ } else if (childBody == null) {
40
+ childBody = el;
41
+ } else if (
42
+ childBody != null &&
43
+ childFooter == null &&
44
+ i == arrChild.length - 1
45
+ ) {
46
+ childFooter = el;
47
+ }
48
+ }
49
+
50
+ return (
51
+ <section
52
+ className={`${styles.container} ${className || ""}`}
53
+ style={style}
54
+ >
55
+ {(title || childHeaderRight) && (
56
+ <div className={`${styles.header} ${headerClassName || ""}`} style={headerStyle}>
57
+ {title &&
58
+ <>
59
+ <h3 className={styles.title} style={titleTextStyle}>
60
+ {title}
61
+ </h3>
62
+ {description && (
63
+ <span className={styles.description}>
64
+ {description}
65
+ </span>
66
+ )}
67
+ </>
68
+ }
69
+ {childHeaderRight && childHeaderRight}
70
+ </div>
71
+ )}
72
+ <div
73
+ className={`${styles.body} ${bodyClassName || ""}`}
74
+ style={(title ? { paddingTop: "12px" } : null)}
75
+ >
76
+ {childBody}
77
+ </div>
78
+ {childFooter && (
79
+ <div
80
+ className={`${styles.footer} ${footerClassName || ""}`}
81
+ style={(title ? { paddingTop: "12px" } : null) }
82
+ >
83
+ {childFooter}
84
+ </div>
85
+ )}
86
+ </section>
87
+ );
88
+ }
89
+
90
+ export default MyContainer;