| 1 |
import FolderIcon from "../icons/FolderIcon"; |
| 2 |
import FolderOpenIcon from "../icons/FolderOpenIcon"; |
| 3 |
|
| 4 |
const IconLayoutTwo = ({icon, categoryIcon = 'folder'}) => { |
| 5 |
const renderIcon = () => { |
| 6 |
// If custom image is provided and categoryIcon is not 'custom', show image in folder wrapper |
| 7 |
if (icon && categoryIcon !== 'custom') { |
| 8 |
return <img className="betterdocs-category-folder-img" src={icon}/>; |
| 9 |
} |
| 10 |
|
| 11 |
// If custom image is provided and categoryIcon is 'custom', show just the image |
| 12 |
if (icon && categoryIcon === 'custom') { |
| 13 |
return <img alt="betterdocs-category-icon" className="betterdocs-category-icon-img" src={icon}/>; |
| 14 |
} |
| 15 |
|
| 16 |
// Show folder icons based on categoryIcon setting |
| 17 |
if (categoryIcon === 'folder-open') { |
| 18 |
return <FolderOpenIcon/>; |
| 19 |
} |
| 20 |
|
| 21 |
return <FolderIcon/>; |
| 22 |
}; |
| 23 |
|
| 24 |
// For custom icons, don't wrap in folder span |
| 25 |
if (categoryIcon === 'custom') { |
| 26 |
return ( |
| 27 |
<div className="betterdocs-category-icon"> |
| 28 |
{renderIcon()} |
| 29 |
</div> |
| 30 |
); |
| 31 |
} |
| 32 |
|
| 33 |
// For folder icons, wrap in folder span with appropriate arrow class |
| 34 |
const arrowClass = categoryIcon === 'folder-open' ? 'arrow-down' : 'arrow-right'; |
| 35 |
|
| 36 |
return ( |
| 37 |
<div className="betterdocs-category-icon"> |
| 38 |
<span className={`betterdocs-folder-icon toggle-arrow ${arrowClass}`}> |
| 39 |
{renderIcon()} |
| 40 |
</span> |
| 41 |
</div> |
| 42 |
); |
| 43 |
} |
| 44 |
|
| 45 |
export default IconLayoutTwo; |
| 46 |
|