lbry-desktop/ui/component/common/error-text.jsx

21 lines
459 B
React
Raw Normal View History

2020-02-06 19:49:05 +01:00
// @flow
import React from 'react';
type Props = {
children: string,
2020-02-06 19:49:05 +01:00
};
export default function ErrorText(props: Props) {
const { children } = props;
if (!children) {
return null;
}
// Add a period to the end of error messages
let errorMessage = children[0].toUpperCase() + children.slice(1);
errorMessage = errorMessage.endsWith('.') ? errorMessage : `${errorMessage}.`;
return <span className="error__text">{errorMessage}</span>;
2020-02-06 19:49:05 +01:00
}