UNPKG

@audira/carbon-react-native

Version:

Build React Native apps with component and shared patterns using Carbon

83 lines (82 loc) 3.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useSuccess = useSuccess; var _react = require("react"); var _carbonReactNativeElements = require("@audira/carbon-react-native-elements"); var _checkmarkFilled = _interopRequireDefault(require("@carbon/icons/svg/32/checkmark--filled.svg")); var _index = require("../../../../carbon-style-sheet/index.js"); var _index2 = require("../../../../contexts/index.js"); var _index3 = require("../_base/index.js"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } function useSuccess({ color, transparentBorderColor }) { const themeContext = (0, _react.useContext)(_index2.ThemeContext), data = (0, _index3.useBase)({ color, transparentBorderColor, style: statusStyle, titleStyle, leftBarStyle, iconColor: mapIconColor[themeContext.colorScheme], iconCloseColor: mapIconCloseColor[themeContext.colorScheme] }); return { ...data, Icon: _checkmarkFilled.default }; } const statusStyle = _index.CarbonStyleSheet.create({ low_contrast: { backgroundColor: _index.CarbonStyleSheet.color.notification_success_background, borderTopColor: _index.CarbonStyleSheet.color.notification_success_border, borderRightColor: _index.CarbonStyleSheet.color.notification_success_border, borderBottomColor: _index.CarbonStyleSheet.color.notification_success_border }, high_contrast: { backgroundColor: _index.CarbonStyleSheet.color.background_inverse, borderTopColor: _index.CarbonStyleSheet.color.background_inverse, borderRightColor: _index.CarbonStyleSheet.color.background_inverse, borderBottomColor: _index.CarbonStyleSheet.color.background_inverse } }), titleStyle = _index.CarbonStyleSheet.create({ low_contrast: { color: _index.CarbonStyleSheet.color.text_primary }, high_contrast: { color: _index.CarbonStyleSheet.color.text_inverse } }), leftBarStyle = _index.CarbonStyleSheet.create({ low_contrast: { backgroundColor: _index.CarbonStyleSheet.color.support_success }, high_contrast: { backgroundColor: _index.CarbonStyleSheet.color.support_success_inverse } }), mapIconColor = { gray_10: { low_contrast: _carbonReactNativeElements.Color.Token.gray_10.support_success, high_contrast: _carbonReactNativeElements.Color.Token.gray_10.support_success_inverse }, gray_100: { low_contrast: _carbonReactNativeElements.Color.Token.gray_100.support_success, high_contrast: _carbonReactNativeElements.Color.Token.gray_100.support_success_inverse } }, mapIconCloseColor = { gray_10: { low_contrast: _carbonReactNativeElements.Color.Token.gray_10.icon_primary, high_contrast: _carbonReactNativeElements.Color.Token.gray_10.icon_inverse }, gray_100: { low_contrast: _carbonReactNativeElements.Color.Token.gray_100.icon_primary, high_contrast: _carbonReactNativeElements.Color.Token.gray_100.icon_inverse } }; //# sourceMappingURL=useSuccess.js.map