give
/
src
/
Promotions
/
WelcomeBanner
/
resources
/
js
/
app
/
components
/
Badge
Last commit date
index.tsx
2 years ago
styles.scss
2 years ago
index.tsx
27 lines
| 1 | import cx from 'classnames'; |
| 2 | import './styles.scss'; |
| 3 | |
| 4 | type BadgeProps = { |
| 5 | variant: 'primary' | 'secondary'; |
| 6 | caption: string; |
| 7 | iconSrc: string; |
| 8 | alt: string; |
| 9 | }; |
| 10 | |
| 11 | /** |
| 12 | * @since 3.0.0 |
| 13 | */ |
| 14 | export default function Badge({variant, caption, iconSrc, alt}: BadgeProps) { |
| 15 | return ( |
| 16 | <div |
| 17 | className={cx('givewp-welcome-banner-badge', { |
| 18 | ['givewp-welcome-banner-badge--primary']: variant === 'primary', |
| 19 | ['givewp-welcome-banner-badge--secondary']: variant === 'secondary', |
| 20 | })} |
| 21 | > |
| 22 | <img src={iconSrc} alt={alt} /> |
| 23 | {caption} |
| 24 | </div> |
| 25 | ); |
| 26 | } |
| 27 |