Created
May 11, 2021 14:49
-
-
Save pffigueiredo/31930f8d652aab979d4a210ae1b48f35 to your computer and use it in GitHub Desktop.
RTL Compatible Icon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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