Skip to content

Commit

Permalink
feat(icon): Added touchable prop to icon
Browse files Browse the repository at this point in the history
Icon reacts to touch / click by changing the opacity
  • Loading branch information
Temzasse committed Sep 12, 2017
1 parent 0959d25 commit 8a5cb8b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Icon.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import styled, { css } from 'styled-components';
import colorGetter from './colorGetter';

const getIconClassname = (type, name) => {
Expand All @@ -17,6 +17,15 @@ const IconEl = styled.i`
line-height: 1;
font-size: ${props => props.size || '18px'};
color: ${props => props.color ? colorGetter(props, props.color) : '#222'};
${props => props.touchable && css`
opacity: 1;
transition: opacity 0.1s linear;
&:active {
opacity: 0.4;
}
`}
`;

Icon.propTypes = {
Expand Down

0 comments on commit 8a5cb8b

Please sign in to comment.