| 1 |
import react from 'react'; |
| 2 |
import { __ } from '@wordpress/i18n'; |
| 3 |
|
| 4 |
|
| 5 |
const ButtonIcon = ({ icon, position }) => { |
| 6 |
const newPosition = position == 'before' ? 'left' : 'right'; |
| 7 |
return ( |
| 8 |
<i className={`${icon} betterdocs-category-link-btn betterdocs-category-link-btn-${newPosition}`}></i> |
| 9 |
) |
| 10 |
} |
| 11 |
|
| 12 |
const Button = ({ label, permalink, showIcon, position, icon }) => { |
| 13 |
return ( |
| 14 |
<a onClick={(e) => e.preventDefault()} className="docs-cat-link-btn betterdocs-category-link-btn" href={permalink}> |
| 15 |
{showIcon && position === 'before' && <ButtonIcon icon={icon} position={position} />} |
| 16 |
{label ?? __('Explore More', 'betterdocs')} |
| 17 |
{showIcon && position === 'after' && <ButtonIcon icon={icon} position={position} />} |
| 18 |
</a> |
| 19 |
) |
| 20 |
} |
| 21 |
|
| 22 |
export default Button; |
| 23 |
|