insomnia/packages/insomnia-components/components/list-group/unit-test-result-badge.js
Mike Ellan 1774bc72e2
Unit testing test output (#2533)
* Adding list group component with stubbed badge & list item

* Cleaning up stories, error padding tweak

* Results list item padding fix

* Review feedback and component provisioning

Shift to functional components
Abstract both list and list item away for re-use
Roll unit test result specific styling into UT source
Roll supporting UI over including badges > extend SC for flavors
Shift timestamp to render the value, JSX handling formatting

* Renaming UT specific badges

* List group and unit test wrapper component updates

- Pulled unit test results list item into SB
- All unique aspects of UT results are bundled in the IC which extend base item
- Cleansed UT wrapper of inline components
- Setting up list group and list group item base for middle area

* Abstrating badges, timestamp and updating unit test wrapper

* Update packages/insomnia-components/components/list-group/unit-test-result-badge.js

Co-authored-by: Opender Singh <opender94@gmail.com>

* Update packages/insomnia-components/components/list-group/unit-test-result-item.js

Co-authored-by: Opender Singh <opender94@gmail.com>

* Dep cleanup, PR feedback

Co-authored-by: Opender Singh <opender94@gmail.com>
2020-08-27 18:09:13 -04:00

40 lines
1.0 KiB
JavaScript

// @flow
import * as React from 'react';
import styled from 'styled-components';
type Props = {|
failed?: boolean,
|};
const StyledBadge: React.ComponentType<{}> = styled.span`
padding: var(--padding-xs) var(--padding-sm);
border: 1px solid var(--color-success);
background-color: var(--color-bg);
color: var(--color-success);
font-weight: var(--font-weight-bold);
border-radius: var(--radius-sm);
flex-basis: 3.5em;
flex-shrink: 0;
text-align: center;
text-transform: capitalize;
`;
const StyledFailedBadge: React.ComponentType<{}> = styled(StyledBadge)`
border-color: var(--color-danger);
color: var(--color-danger);
`;
const StyledPassedBadge: React.ComponentType<{}> = styled(StyledBadge)`
border-color: var(--color-success);
color: var(--color-success);
`;
const UnitTestResultBadge = ({ failed }: Props) => {
if (failed) {
return <StyledFailedBadge>Failed</StyledFailedBadge>;
}
return <StyledPassedBadge>Passed</StyledPassedBadge>;
};
export default UnitTestResultBadge;