@etsoo/materialui 1.2.3 → 1.2.4

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,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { CustomFabProps } from './CustomFabProps';
2
+ import { CustomFabProps } from "./CustomFabProps";
3
3
  /**
4
4
  * Scroll to top fab
5
5
  * @returns Component
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { Fab, useScrollTrigger, Zoom } from '@mui/material';
3
- import VerticalAlignTopIcon from '@mui/icons-material/VerticalAlignTop';
1
+ import React from "react";
2
+ import { Fab, useScrollTrigger, Zoom } from "@mui/material";
3
+ import VerticalAlignTopIcon from "@mui/icons-material/VerticalAlignTop";
4
4
  /**
5
5
  * Scroll to top fab
6
6
  * @returns Component
@@ -19,7 +19,7 @@ export function ScrollTopFab(props) {
19
19
  const handleClick = () => {
20
20
  target.scrollTo({ top: 0 });
21
21
  };
22
- return (React.createElement(Zoom, { in: trigger },
22
+ return trigger ? (React.createElement(Zoom, { in: trigger },
23
23
  React.createElement(Fab, { color: color, size: size, title: title, onClick: handleClick },
24
- React.createElement(VerticalAlignTopIcon, null))));
24
+ React.createElement(VerticalAlignTopIcon, null)))) : (React.createElement(React.Fragment, null));
25
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,34 +1,36 @@
1
- import React from 'react';
2
- import { Fab, useScrollTrigger, Zoom } from '@mui/material';
3
- import VerticalAlignTopIcon from '@mui/icons-material/VerticalAlignTop';
4
- import { CustomFabProps } from './CustomFabProps';
1
+ import React from "react";
2
+ import { Fab, useScrollTrigger, Zoom } from "@mui/material";
3
+ import VerticalAlignTopIcon from "@mui/icons-material/VerticalAlignTop";
4
+ import { CustomFabProps } from "./CustomFabProps";
5
5
 
6
6
  /**
7
7
  * Scroll to top fab
8
8
  * @returns Component
9
9
  */
10
10
  export function ScrollTopFab(props: CustomFabProps) {
11
- // Destruct
12
- const { color, size, target, title } = props;
11
+ // Destruct
12
+ const { color, size, target, title } = props;
13
13
 
14
- // Scroll trigger
15
- const trigger = useScrollTrigger({
16
- target,
17
- disableHysteresis: true,
18
- threshold: 120
19
- });
14
+ // Scroll trigger
15
+ const trigger = useScrollTrigger({
16
+ target,
17
+ disableHysteresis: true,
18
+ threshold: 120
19
+ });
20
20
 
21
- // Icon click handler
22
- // behavior: 'smooth'
23
- const handleClick = () => {
24
- target.scrollTo({ top: 0 });
25
- };
21
+ // Icon click handler
22
+ // behavior: 'smooth'
23
+ const handleClick = () => {
24
+ target.scrollTo({ top: 0 });
25
+ };
26
26
 
27
- return (
28
- <Zoom in={trigger}>
29
- <Fab color={color} size={size} title={title} onClick={handleClick}>
30
- <VerticalAlignTopIcon />
31
- </Fab>
32
- </Zoom>
33
- );
27
+ return trigger ? (
28
+ <Zoom in={trigger}>
29
+ <Fab color={color} size={size} title={title} onClick={handleClick}>
30
+ <VerticalAlignTopIcon />
31
+ </Fab>
32
+ </Zoom>
33
+ ) : (
34
+ <React.Fragment />
35
+ );
34
36
  }