Skip to content

Instantly share code, notes, and snippets.

@pffigueiredo
Created May 11, 2021 14:49
Show Gist options
  • Save pffigueiredo/31930f8d652aab979d4a210ae1b48f35 to your computer and use it in GitHub Desktop.
Save pffigueiredo/31930f8d652aab979d4a210ae1b48f35 to your computer and use it in GitHub Desktop.
RTL Compatible Icon
import React from 'react';
import styled from 'styled-components';
const IconWrapper = styled('div')`
html[dir='rtl'] &.flip-icon {
transform: scaleX(-1);
}
`;
const Icon = ({ name, onClick, noFlip }) => {
return (
<IconWrapper onClick={onClick} className={noFlip ? '' : 'flip-icon'}>
<i className={`icon icon-${name}`} title={name} />
</IconWrapper>
);
};
export default Icon;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment