1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-02-13 16:42:01 +00:00

Finalized notification icon styles

This commit is contained in:
Vladimir Volek 2018-08-29 13:07:37 +02:00
parent 8b519544d7
commit e1d4faddfc

View File

@ -98,6 +98,28 @@ export const Notification = (props: NProps): React$Element<string> => {
return color; return color;
}; };
const getIconColor = (type) => {
let color;
switch (type) {
case 'info':
color = colors.INFO_PRIMARY;
break;
case 'error':
color = colors.ERROR_PRIMARY;
break;
case 'warning':
color = colors.WARNING_PRIMARY;
break;
case 'success':
color = colors.SUCCESS_PRIMARY;
break;
default:
color = null;
}
return color;
};
return ( return (
<Wrapper type={props.className}> <Wrapper type={props.className}>
{props.loading && <Loader size={50} /> } {props.loading && <Loader size={50} /> }
@ -108,7 +130,10 @@ export const Notification = (props: NProps): React$Element<string> => {
)} )}
<Body> <Body>
<IconContent> <IconContent>
<StyledIcon icon={icons[props.className.toUpperCase()]} /> <StyledIcon
color={getIconColor(props.className)}
icon={icons[props.className.toUpperCase()]}
/>
</IconContent> </IconContent>
<MessageContent> <MessageContent>
<Title>{ props.title }</Title> <Title>{ props.title }</Title>
@ -136,7 +161,7 @@ export const Notification = (props: NProps): React$Element<string> => {
); );
}; };
export const NotificationGroup = (props: Props) => { export const NotificationGroup = (props) => {
const { notifications, close } = props; const { notifications, close } = props;
return notifications.map((n, i) => ( return notifications.map((n, i) => (
<Notification <Notification
@ -152,10 +177,10 @@ export const NotificationGroup = (props: Props) => {
}; };
export default connect( export default connect(
(state: State) => ({ state => ({
notifications: state.notifications, notifications: state.notifications,
}), }),
(dispatch: Dispatch) => ({ dispatch => ({
close: bindActionCreators(NotificationActions.close, dispatch), close: bindActionCreators(NotificationActions.close, dispatch),
}), }),
)(NotificationGroup); )(NotificationGroup);