UNPKG

creevey

Version:

Cross-browser screenshot testing tool for Storybook with fancy UI Runner

59 lines 2.3 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.TestStatusIcon = void 0; const react_1 = __importDefault(require("react")); const theming_1 = require("@storybook/theming"); const components_1 = require("@storybook/components"); const Container = theming_1.styled.span({ width: '16px', height: '13px', padding: 1, display: 'inline-block', }); const Icon = (0, theming_1.styled)(components_1.Icons)({ position: 'relative', top: '1px', verticalAlign: 'baseline', }); const Spinner = (0, theming_1.styled)(components_1.Loader)({ top: '12px', left: 'unset', marginLeft: '0px', }); exports.TestStatusIcon = (0, theming_1.withTheme)(({ inverted, status, skip, theme }) => { let icon = null; switch (status) { case 'failed': { icon = react_1.default.createElement(Icon, { color: inverted ? theme.color.lightest : theme.color.negative, icon: "cross" }); break; } case 'success': { icon = react_1.default.createElement(Icon, { color: inverted ? theme.color.lightest : theme.color.green, icon: "check" }); break; } case 'approved': { icon = react_1.default.createElement(Icon, { color: inverted ? theme.color.lightest : theme.color.mediumdark, icon: "thumbsup" }); break; } case 'running': { icon = react_1.default.createElement(Spinner, { size: 10 }); break; } case 'pending': { icon = react_1.default.createElement(Icon, { color: inverted ? theme.color.lightest : theme.color.mediumdark, icon: "time" }); break; } default: { if (skip) icon = react_1.default.createElement(Icon, { color: inverted ? theme.color.lightest : undefined, icon: "alert" }); else icon = react_1.default.createElement(Icon, { color: inverted ? theme.color.lightest : undefined, icon: "circlehollow" }); break; } } return react_1.default.createElement(Container, null, icon); }); //# sourceMappingURL=TestStatusIcon.js.map