nextemos 2.3.6 → 2.3.8

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.
@@ -1,2 +1,3 @@
1
1
  export { default as useFetch } from './useFetch';
2
2
  export { default as useLocalStorage } from './useLocalStorage';
3
+ export { default as useWindowSize } from './useWindowSize';
@@ -3,9 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.useLocalStorage = exports.useFetch = void 0;
6
+ exports.useWindowSize = exports.useLocalStorage = exports.useFetch = void 0;
7
7
  /// hooks
8
8
  var useFetch_1 = require("./useFetch");
9
9
  Object.defineProperty(exports, "useFetch", { enumerable: true, get: function () { return __importDefault(useFetch_1).default; } });
10
10
  var useLocalStorage_1 = require("./useLocalStorage");
11
11
  Object.defineProperty(exports, "useLocalStorage", { enumerable: true, get: function () { return __importDefault(useLocalStorage_1).default; } });
12
+ var useWindowSize_1 = require("./useWindowSize");
13
+ Object.defineProperty(exports, "useWindowSize", { enumerable: true, get: function () { return __importDefault(useWindowSize_1).default; } });
@@ -0,0 +1,14 @@
1
+ interface IWindowSize {
2
+ width: number;
3
+ height: number;
4
+ }
5
+ /**
6
+ * useWindowSize Hook
7
+ *
8
+ * @description
9
+ * A custom React hook that listens for the window size and returns it.
10
+ *
11
+ * @returns {Object} An object containing the width and height of the window window.
12
+ */
13
+ declare const useWindowSize: () => IWindowSize;
14
+ export default useWindowSize;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("react");
4
+ /**
5
+ * useWindowSize Hook
6
+ *
7
+ * @description
8
+ * A custom React hook that listens for the window size and returns it.
9
+ *
10
+ * @returns {Object} An object containing the width and height of the window window.
11
+ */
12
+ const useWindowSize = () => {
13
+ const [windowSize, setWindowSize] = (0, react_1.useState)({
14
+ width: 0,
15
+ height: 0,
16
+ });
17
+ /**
18
+ * handleResize
19
+ *
20
+ * @description
21
+ * A function to update the window size state when the window is resized.
22
+ */
23
+ const handleResize = () => {
24
+ setWindowSize({
25
+ width: window.innerWidth,
26
+ height: window.innerHeight,
27
+ });
28
+ };
29
+ /**
30
+ * useEffect Hook
31
+ *
32
+ * @description
33
+ * A React hook that is used for side-effects in functional components.
34
+ *
35
+ * @params {Function} () => {} A callback function that contains the side-effect logic.
36
+ * @params {Array} [] An array of dependencies. When empty, it means the useEffect runs once after the initial render.
37
+ */
38
+ (0, react_1.useEffect)(() => {
39
+ if (typeof window !== 'undefined') {
40
+ setWindowSize({
41
+ width: window.innerWidth,
42
+ height: window.innerHeight,
43
+ });
44
+ window.addEventListener('resize', handleResize);
45
+ return () => {
46
+ window.removeEventListener('resize', handleResize);
47
+ };
48
+ }
49
+ }, []);
50
+ return windowSize;
51
+ };
52
+ exports.default = useWindowSize;
@@ -60,7 +60,7 @@ export interface Banner {
60
60
  /**
61
61
  * Banner ile ilişkili dynamic type verileri.
62
62
  */
63
- extensionData: Object;
63
+ extensionData: any;
64
64
  /**
65
65
  * Banner ile ilişkili içerik öğesi için tanımlayıcı.
66
66
  */
@@ -13,7 +13,7 @@ export interface IBlogPost {
13
13
  targetLink: string;
14
14
  imageLink: string;
15
15
  isApproved: boolean;
16
- extensionData: Object;
16
+ extensionData: any;
17
17
  updatedAtUtc: string;
18
18
  updatedBy: number;
19
19
  createdAtUtc: string;
@@ -40,7 +40,7 @@ export interface IBlogCategory {
40
40
  path: string;
41
41
  hierarchy: number[];
42
42
  blogPostBlogCategoryMappings: BlogPostBlogCategoryMapping[];
43
- extensionData: Object;
43
+ extensionData: any;
44
44
  }
45
45
  /**
46
46
  * Blog etiketini temsil eden arayüz
@@ -130,7 +130,7 @@ export interface ICategoryTreeItem {
130
130
  path: string;
131
131
  hierarchy: number[];
132
132
  blogPostBlogCategoryMappings: BlogPostBlogCategoryMapping[];
133
- extensionData: object;
133
+ extensionData: any;
134
134
  childCategories?: IChildCategory[];
135
135
  }
136
136
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "2.3.6",
3
+ "version": "2.3.8",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",