UNPKG

@livelike/react-native

Version:

LiveLike React Native package

56 lines 1.48 kB
import React from 'react'; import { StyleSheet, View } from 'react-native'; import { useIsEndWidgetUIPhase, useStyles, useWidgetUIPhase } from '../../hooks'; import { WidgetUIPhase } from '../../types'; import { LLText } from '../LLText'; const WidgetUIPhaseLabel = { [WidgetUIPhase.INTERACTIVE_TIMED_OUT]: 'Timed out', [WidgetUIPhase.EXPIRED]: 'Expired' }; export function LLEndWidgetUIPhaseLabel(_ref) { let { widgetId, styles: stylesProp } = _ref; const widgetUIPhase = useWidgetUIPhase({ widgetId }); const isEndWidgetUIPhase = useIsEndWidgetUIPhase({ widgetId }); const labelStyles = useStyles({ componentStylesFn: getEndWidgetUIPhaseLabelStyles, stylesProp }); if (!isEndWidgetUIPhase) { return undefined; } return /*#__PURE__*/React.createElement(View, { style: labelStyles.container }, /*#__PURE__*/React.createElement(LLText, { style: labelStyles.label }, WidgetUIPhaseLabel[widgetUIPhase])); } const getEndWidgetUIPhaseLabelStyles = _ref2 => { let { theme } = _ref2; return StyleSheet.create({ container: { width: 120, height: 22, marginRight: 16, marginBottom: 16, backgroundColor: theme.incorrect, justifyContent: 'center', alignItems: 'center' }, label: { textAlignVertical: 'center', fontSize: 12, lineHeight: 14, color: theme.correctIncorrectText } }); }; //# sourceMappingURL=LLEndWidgetUIPhaseLabel.js.map