2023-09-30 00:17:36 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { Link } from '@woocommerce/components';
|
|
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import { ThemeCard as TypeThemeCard } from './types';
|
|
|
|
import { ColorPalettes } from './color-palettes';
|
|
|
|
|
|
|
|
export const ThemeCard = ( {
|
|
|
|
slug,
|
|
|
|
description,
|
2023-10-05 13:33:50 +00:00
|
|
|
thumbnail_url,
|
2023-09-30 00:17:36 +00:00
|
|
|
name,
|
2023-10-05 13:33:50 +00:00
|
|
|
color_palettes = [],
|
2023-10-09 07:45:04 +00:00
|
|
|
total_palettes = 0,
|
2023-10-05 13:33:50 +00:00
|
|
|
link_url = '',
|
|
|
|
is_active = false,
|
2023-09-30 00:17:36 +00:00
|
|
|
}: TypeThemeCard ) => {
|
|
|
|
return (
|
|
|
|
<div className="theme-card" key={ slug }>
|
|
|
|
<div>
|
2023-10-05 13:33:50 +00:00
|
|
|
{ link_url ? (
|
|
|
|
<Link href={ link_url }>
|
|
|
|
<img src={ thumbnail_url } alt={ description } />
|
2023-09-30 00:17:36 +00:00
|
|
|
</Link>
|
|
|
|
) : (
|
2023-10-05 13:33:50 +00:00
|
|
|
<img src={ thumbnail_url } alt={ description } />
|
2023-09-30 00:17:36 +00:00
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
<div className="theme-card__info">
|
|
|
|
<h2 className="theme-card__title">{ name }</h2>
|
2023-10-05 13:33:50 +00:00
|
|
|
{ color_palettes && (
|
2023-10-09 07:45:04 +00:00
|
|
|
<ColorPalettes
|
|
|
|
colorPalettes={ color_palettes }
|
|
|
|
totalPalettes={ total_palettes }
|
|
|
|
/>
|
2023-09-30 00:17:36 +00:00
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
<div>
|
2023-10-05 13:33:50 +00:00
|
|
|
{ is_active && (
|
2023-09-30 00:17:36 +00:00
|
|
|
<span className="theme-card__active">
|
|
|
|
{ __( 'Active theme', 'woocommerce' ) }
|
|
|
|
</span>
|
|
|
|
) }
|
|
|
|
<span className="theme-card__free">Free</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|