File size: 682 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import { PremiumBadge } from '@automattic/components';
import type { FunctionComponent } from 'react';
import './style.scss';
interface Props {
badgeType?: 'premium' | 'none';
isPremiumThemeAvailable?: boolean;
}
const BadgeContainer: FunctionComponent< Props > = ( {
badgeType = 'none',
isPremiumThemeAvailable = false,
} ) => {
function getBadge() {
switch ( badgeType ) {
case 'premium':
return <PremiumBadge isPremiumThemeAvailable={ isPremiumThemeAvailable } />;
case 'none':
return null;
default:
throw new Error( 'Invalid badge type!' );
}
}
return <div className="badge-container">{ getBadge() }</div>;
};
export default BadgeContainer;
|