diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-04 13:07:15 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-04 13:32:04 +0100 |
| commit | ab5e5f4bdf40b5bc1ccf82dc1b4aca94d5171ec3 (patch) | |
| tree | d5b26588c08cbc3aac1f281aa848e68c522eabcd /src/components/Icons | |
| parent | 1856796cef0989b10030906c9b1383d44800fb00 (diff) | |
refactor(sharing): avoid nested template literals
This improves readability. I also rename a variable to avoid duplicate
between global scope and useEffect scope.
Diffstat (limited to 'src/components/Icons')
| -rw-r--r-- | src/components/Icons/Hamburger/Hamburger.tsx | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/components/Icons/Hamburger/Hamburger.tsx b/src/components/Icons/Hamburger/Hamburger.tsx index 3b9e609..9b39272 100644 --- a/src/components/Icons/Hamburger/Hamburger.tsx +++ b/src/components/Icons/Hamburger/Hamburger.tsx @@ -1,13 +1,10 @@ import styles from './Hamburger.module.scss'; const HamburgerIcon = ({ isActive }: { isActive: boolean }) => { - return ( - <span - className={`${styles.icon}${ - isActive ? ` ${styles['icon--active']}` : '' - }`} - ></span> - ); + const withModifier = isActive ? ` ${styles['icon--active']}` : ''; + const iconClasses = `${styles.icon} ${withModifier}`; + + return <span className={iconClasses}></span>; }; export default HamburgerIcon; |
