Merge pull request #9903 from nixocio/ui_remove_not_used_code

Remove not used code

Remove not used code

Reviewed-by: Jake McDermott <yo@jakemcdermott.me>
This commit is contained in:
softwarefactory-project-zuul[bot] 2021-04-14 16:35:08 +00:00 committed by GitHub
commit c633313152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 80 deletions

View File

@ -1,54 +0,0 @@
import React from 'react';
import 'styled-components/macro';
import styled, { keyframes } from 'styled-components';
import { oneOf, string } from 'prop-types';
import { CloudIcon } from '@patternfly/react-icons';
const COLORS = {
success: '--pf-global--palette--green-400',
syncing: '--pf-global--palette--green-400',
error: '--pf-global--danger-color--100',
disabled: '--pf-global--disabled-color--200',
};
const Pulse = keyframes`
from {
opacity: 0;
}
to {
opacity: 1.0;
}
`;
const PulseWrapper = styled.div`
animation: ${Pulse} 1.5s linear infinite alternate;
`;
export default function SyncStatusIndicator({ status, title }) {
const color = COLORS[status] || COLORS.disabled;
if (status === 'syncing') {
return (
<>
<PulseWrapper aria-hidden="true">
<CloudIcon color={`var(${color})`} title={title} />
</PulseWrapper>
<span className="pf-screen-reader">{status}</span>
</>
);
}
return (
<>
<CloudIcon color={`var(${color})`} title={title} aria-hidden="true" />
<span className="pf-screen-reader">{status}</span>
</>
);
}
SyncStatusIndicator.propTypes = {
status: oneOf(['success', 'error', 'disabled', 'syncing']).isRequired,
title: string,
};
SyncStatusIndicator.defaultProps = {
title: null,
};

View File

@ -1 +0,0 @@
export { default } from './SyncStatusIndicator';

View File

@ -1,12 +1,3 @@
// TODO: switch to using Lingui i18n for articles
export function getArticle(str) {
const first = str[0];
if ('aeiou'.includes(first)) {
return 'an';
}
return 'a';
}
export const toTitleCase = string => {
if (!string) {
return '';

View File

@ -1,21 +1,6 @@
import { getArticle, toTitleCase } from './strings';
import { toTitleCase } from './strings';
describe('string utils', () => {
describe('getArticle', () => {
test('should return "a"', () => {
expect(getArticle('team')).toEqual('a');
expect(getArticle('notification')).toEqual('a');
});
test('should return "an"', () => {
expect(getArticle('aardvark')).toEqual('an');
expect(getArticle('ear')).toEqual('an');
expect(getArticle('interest')).toEqual('an');
expect(getArticle('ogre')).toEqual('an');
expect(getArticle('umbrella')).toEqual('an');
});
});
describe('toTitleCase', () => {
test('should upper case each word', () => {
expect(toTitleCase('a_string_of_words')).toEqual('A String Of Words');