Skip to content

Commit

Permalink
fix(BTS-152): code review observations
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Oliveira committed Mar 26, 2019
1 parent d54bd00 commit 2d44df4
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions components/Alert/Alert.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,24 @@ const CloseButton = styled(Button.Icon).attrs({
}
`;

CloseButton.displayName = 'CloseButton';

const getStylesBySkin = skin => {
const colorSchema = skin.toUpperCase();
const colorName = skin.toUpperCase();
const colorSchema = Colors[colorName];

return `
color: ${Colors[colorSchema][900]};
background-color: ${Colors[colorSchema][200]};
border: ${BORDER_SIZE} solid ${Colors[colorSchema][500]};
${colorSchema[900] && `color: ${colorSchema[900]}`};
background-color: ${colorSchema[200]};
border: ${BORDER_SIZE} solid ${colorSchema[500]};
${Content} ${AlertIcon} {
color: ${Colors[colorSchema][500]};
color: ${colorSchema[500]};
margin-right: ${DEFAULT_SPACING};
}
${Content} ${CloseButton} {
color: ${Colors[colorSchema][500]};
color: ${colorSchema[500]};
}
`;
};
Expand All @@ -59,10 +62,8 @@ const Wrapper = styled.div`
${({ skin }) => getStylesBySkin(skin)}
`;

CloseButton.displayName = 'CloseButton';

const Alert = ({ icon, children, onClose, ...rest }) => (
<Wrapper {...rest}>
<Wrapper {...rest} role="alert">
<Content onClose={onClose}>
{icon && <AlertIcon name={icon} />}
{children && <span>{children}</span>}
Expand Down

0 comments on commit 2d44df4

Please sign in to comment.