@hifi/react-tos-modal
Advanced tools
Comparing version 1.0.6 to 1.0.8
@@ -100,3 +100,3 @@ "use strict"; | ||
`; | ||
const Modal = ({ handleAgree, isScrollable, backgroundColor, modalBorderRadius, modalHeight, modalHeightMobile, modalWidth, scrollBarWidth, scrollTrackColor, scrollThumbColor, scrollThumbHoverColor, tosJsx, modalButtonHeight, modalButtonWidth, modalButtonFontSize, modalButtonColorEnabled, modalButtonColorHover, modalPaddingTopBottom, modalPaddingSides, }) => { | ||
const Modal = ({ handleAgree, isScrollable, backgroundColor, modalBorderRadius, modalHeight, modalHeightMobile, modalWidth, scrollBarWidth, scrollTrackColor, scrollThumbColor, scrollThumbHoverColor, tosJsx, modalButtonHeight, modalButtonWidth, modalButtonFontSize, modalButtonColorEnabled, modalButtonColorHover, modalButtonText, modalPaddingTopBottom, modalPaddingSides, }) => { | ||
const [disabled, setDisabled] = (0, react_1.useState)(isScrollable); | ||
@@ -112,6 +112,6 @@ const handleScroll = (event) => { | ||
}; | ||
return ((0, jsx_runtime_1.jsx)(ModalBackground, { children: (0, jsx_runtime_1.jsx)(ModalForeground, Object.assign({ backgroundColor: backgroundColor, modalBorderRadius: modalBorderRadius, modalHeight: modalHeight, modalHeightMobile: modalHeightMobile, modalWidth: modalWidth, modalPaddingTopBottom: modalPaddingTopBottom, modalPaddingSides: modalPaddingSides }, { children: (0, jsx_runtime_1.jsxs)(ModalBody, { children: [(0, jsx_runtime_1.jsx)(ModalContent, Object.assign({ isScrollable: isScrollable, onScroll: handleScroll, scrollBarWidth: scrollBarWidth, scrollTrackColor: scrollTrackColor, scrollThumbColor: scrollThumbColor, scrollThumbHoverColor: scrollThumbHoverColor }, { children: tosJsx })), (0, jsx_runtime_1.jsx)(ModalButton, Object.assign({ disabled: disabled, onClick: handleAgree, modalButtonHeight: modalButtonHeight, modalButtonWidth: modalButtonWidth, modalButtonFontSize: modalButtonFontSize, modalButtonColorEnabled: modalButtonColorEnabled, modalButtonColorHover: modalButtonColorHover, id: "accept" }, { children: "I Agree" }))] }) })) })); | ||
return ((0, jsx_runtime_1.jsx)(ModalBackground, { children: (0, jsx_runtime_1.jsx)(ModalForeground, Object.assign({ backgroundColor: backgroundColor, modalBorderRadius: modalBorderRadius, modalHeight: modalHeight, modalHeightMobile: modalHeightMobile, modalWidth: modalWidth, modalPaddingTopBottom: modalPaddingTopBottom, modalPaddingSides: modalPaddingSides }, { children: (0, jsx_runtime_1.jsxs)(ModalBody, { children: [(0, jsx_runtime_1.jsx)(ModalContent, Object.assign({ isScrollable: isScrollable, onScroll: handleScroll, scrollBarWidth: scrollBarWidth, scrollTrackColor: scrollTrackColor, scrollThumbColor: scrollThumbColor, scrollThumbHoverColor: scrollThumbHoverColor }, { children: tosJsx })), (0, jsx_runtime_1.jsx)(ModalButton, Object.assign({ disabled: disabled, onClick: handleAgree, modalButtonHeight: modalButtonHeight, modalButtonWidth: modalButtonWidth, modalButtonFontSize: modalButtonFontSize, modalButtonColorEnabled: modalButtonColorEnabled, modalButtonColorHover: modalButtonColorHover, id: "accept" }, { children: modalButtonText }))] }) })) })); | ||
}; | ||
function TosModal({ children, config, tosJsx }) { | ||
const { backgroundColor, isScrollable, modalHeight, modalHeightMobile, modalBorderRadius, modalWidth, scrollBarWidth, scrollTrackColor, scrollThumbColor, scrollThumbHoverColor, modalButtonHeight, modalButtonWidth, modalButtonFontSize, modalButtonColorEnabled, modalButtonColorHover, modalPaddingTopBottom, modalPaddingSides, } = config; | ||
const { backgroundColor, isScrollable, modalHeight, modalHeightMobile, modalBorderRadius, modalWidth, scrollBarWidth, scrollTrackColor, scrollThumbColor, scrollThumbHoverColor, modalButtonHeight, modalButtonWidth, modalButtonFontSize, modalButtonColorEnabled, modalButtonColorHover, modalButtonText, modalPaddingTopBottom, modalPaddingSides, } = config; | ||
const [agreed, setAgreed] = (0, react_1.useState)(() => { | ||
@@ -126,4 +126,4 @@ const cached = localStorage.getItem("agreed") || JSON.parse("false"); | ||
}, [agreed]); | ||
return ((0, jsx_runtime_1.jsxs)("div", { children: [!agreed && ((0, jsx_runtime_1.jsx)(Modal, { handleAgree: handleAgree, backgroundColor: backgroundColor, isScrollable: isScrollable, modalBorderRadius: modalBorderRadius, modalHeight: modalHeight, modalHeightMobile: modalHeightMobile, modalWidth: modalWidth, scrollBarWidth: scrollBarWidth, scrollTrackColor: scrollTrackColor, scrollThumbColor: scrollThumbColor, scrollThumbHoverColor: scrollThumbHoverColor, tosJsx: tosJsx, modalButtonHeight: modalButtonHeight, modalButtonWidth: modalButtonWidth, modalButtonFontSize: modalButtonFontSize, modalButtonColorEnabled: modalButtonColorEnabled, modalButtonColorHover: modalButtonColorHover, modalPaddingTopBottom: modalPaddingTopBottom, modalPaddingSides: modalPaddingSides })), children] })); | ||
return ((0, jsx_runtime_1.jsxs)("div", { children: [!agreed && ((0, jsx_runtime_1.jsx)(Modal, { handleAgree: handleAgree, backgroundColor: backgroundColor, isScrollable: isScrollable, modalBorderRadius: modalBorderRadius, modalHeight: modalHeight, modalHeightMobile: modalHeightMobile, modalWidth: modalWidth, scrollBarWidth: scrollBarWidth, scrollTrackColor: scrollTrackColor, scrollThumbColor: scrollThumbColor, scrollThumbHoverColor: scrollThumbHoverColor, tosJsx: tosJsx, modalButtonHeight: modalButtonHeight, modalButtonWidth: modalButtonWidth, modalButtonFontSize: modalButtonFontSize, modalButtonColorEnabled: modalButtonColorEnabled, modalButtonColorHover: modalButtonColorHover, modalButtonText: modalButtonText, modalPaddingTopBottom: modalPaddingTopBottom, modalPaddingSides: modalPaddingSides })), children] })); | ||
} | ||
exports.default = TosModal; |
@@ -6,2 +6,3 @@ /// <reference types="react" /> | ||
tosJsx: any; | ||
modalButtonText: string; | ||
} & ModalButtonProps & ModalContentProps & ModalForegroundProps; | ||
@@ -31,3 +32,5 @@ declare type ModalButtonProps = { | ||
}; | ||
declare type TosModalConfig = ModalButtonProps & ModalContentProps & ModalForegroundProps; | ||
declare type TosModalConfig = ModalButtonProps & ModalContentProps & ModalForegroundProps & { | ||
modalButtonText: string; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@hifi/react-tos-modal", | ||
"description": "A React modal for displaying terms of service at the start of a session", | ||
"version": "1.0.6", | ||
"version": "1.0.8", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Hifi", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Unpopular package
QualityThis package is not very popular.
Found 1 instance in 1 package
13245
202
0
0
1