Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No QA] Create InlineSystemMessage component #9168

Merged
merged 7 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/components/InlineSystemMessage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react';
import {View} from 'react-native';
import PropTypes from 'prop-types';
import styles from '../styles/styles';
import Text from './Text';
import * as Expensicons from './Icon/Expensicons';
import colors from '../styles/colors';
import Icon from './Icon';

const propTypes = {
/** Error to display */
message: PropTypes.string.isRequired,
};

const InlineSystemMessage = (props) => {
if (props.message.length === 0) {
return null;
}
return (
<View style={[styles.flexRow, styles.alignItemsCenter]}>
<Icon src={Expensicons.Exclamation} fill={colors.red} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should never reference colors directly in the UI – instead we should always reference themes. This is so that we can easily add darkmode (and potentially other themes?) later on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a quick follow-up PR #9198

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nice spot Rory. Thanks

<Text style={[styles.inlineSystemMessage]}>{props.message}</Text>
</View>
);
};

InlineSystemMessage.propTypes = propTypes;
InlineSystemMessage.displayName = 'InlineSystemMessage';
export default InlineSystemMessage;
7 changes: 7 additions & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2525,6 +2525,13 @@ const styles = {
marginBottom: 40,
padding: 16,
},

inlineSystemMessage: {
color: themeColors.textSupporting,
fontSize: variables.fontSizeLabel,
fontFamily: fontFamily.GTA,
marginLeft: 4,
},
};

export default styles;