UNPKG

@s20.ai/safecam-360-rn-lite

Version:

A React Native component to view the interior panorama and exterior 360 degree views of a product featuring suppport for hotspots. Compatible with Android and iOS

85 lines (80 loc) 2.37 kB
/* * Copyright © 2022 S20.AI India Pvt. Ltd. * Contact - origin@s20.ai * License - Licensed as per https://docs.s20.ai/license.html */ import React from 'react'; import {connect} from 'react-redux'; import {CardImageFocusModal, IconButton} from '@s20.ai/safecam-components-rn'; import {setHotspotDetailMode} from '../../redux/actions/currentHotspotAction'; import {triggerHapticFeedback, useScreenDimensions} from '../../utils/device'; import {responsiveStyleConfig} from '../responsiveStyleConfig'; const HotspotDetailOverlay = ({ hotspotDetailMode, currentHotspotState, setHotspotDetailMode, customFontFamily, }) => { const screenDimensions = useScreenDimensions(); const cardFocusModalStyles = responsiveStyleConfig.stylePicker( 'cardFocusModal', screenDimensions.width, ); return ( <CardImageFocusModal visible={hotspotDetailMode} sx={{ ...cardFocusModalStyles, title: { fontFamily: customFontFamily && customFontFamily === 'Poppins' ? 'Poppins-Regular' : 'Helvetica', }, description: { fontFamily: customFontFamily && customFontFamily === 'Poppins' ? 'Poppins-Regular' : 'Helvetica', }, width: '100%', height: '100%', }} notifyClose={() => { setHotspotDetailMode(false); triggerHapticFeedback(); }} closeIconJSX={ <IconButton onPress={() => { setHotspotDetailMode(false); triggerHapticFeedback(); }} src="https://safecam-org-logos.s3.ap-south-1.amazonaws.com/close.svg" svg sx={{ iconSize: 15, base: { backgroundColor: '#fff', width: 40, height: 40, }, }} /> } src={currentHotspotState.imageSrc} title={currentHotspotState.description} description={currentHotspotState.imageTitle} /> ); }; const mapStateToProps = ({hotspotDetailMode, currentHotspot, currentView}) => { return { hotspotDetailMode: hotspotDetailMode, currentHotspotState: currentHotspot, orientation: currentView.orientation, }; }; export default connect(mapStateToProps, { setHotspotDetailMode, })(HotspotDetailOverlay);