PluginProbe
Elementor Website Builder – more than just a page builder / 3.8.0-beta1
Elementor Website Builder – more than just a page builder v3.8.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
elementor / app / modules / kit-library / assets / js / components / kit-list-item.js

kit-list-item.js in Elementor Website Builder – more than just a page builder 3.8.0-beta1, at app/modules/kit-library/assets/js/components/kit-list-item.js

91 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import Badge from './badge';
2 import FavoritesActions from '../components/favorites-actions';
3 import Kit from '../models/kit';
4 import useKitCallToAction, { TYPE_PROMOTION } from '../hooks/use-kit-call-to-action';
5 import { Card, CardHeader, CardBody, Heading, CardImage, CardOverlay, Grid, Button } from '@elementor/app-ui';
6 import { appsEventTrackingDispatch } from 'elementor-app/event-track/apps-event-tracking';
7
8 import './kit-list-item.scss';
9
10 const KitListItem = ( props ) => {
11 const [ type, { subscriptionPlan } ] = useKitCallToAction( props.model.accessLevel );
12
13 const eventTracking = ( command ) => {
14 appsEventTrackingDispatch(
15 command,
16 {
17 kit_name: props.model.title,
18 grid_location: props.index,
19 search_term: props.queryParams,
20 page_source: props.source && '/' === props.source ? 'all kits' : 'favorites',
21 },
22 );
23 };
24
25 return (
26 <Card className="e-kit-library__kit-item">
27 <CardHeader>
28 <Heading
29 tag="h3"
30 title={ props.model.title }
31 variant="h5"
32 className="eps-card__headline"
33 >
34 { props.model.title }
35 </Heading>
36 <FavoritesActions
37 id={ props.model.id }
38 isFavorite={ props.model.isFavorite }
39 index={ props.index }
40 name={ props.model.title }
41 queryParams={ props.queryParams }
42 source={ props.source }
43 />
44 </CardHeader>
45 <CardBody>
46 <CardImage alt={ props.model.title } src={ props.model.thumbnailUrl || '' }>
47 {
48 subscriptionPlan?.label &&
49 <Badge
50 variant="sm"
51 className="e-kit-library__kit-item-subscription-plan-badge"
52 style={ { backgroundColor: subscriptionPlan.color } }
53 >
54 { subscriptionPlan.label }
55 </Badge>
56 }
57 <CardOverlay>
58 <Grid container direction="column" className="e-kit-library__kit-item-overlay">
59 <Button
60 className="e-kit-library__kit-item-overlay-overview-button"
61 text={ __( 'View Demo', 'elementor' ) }
62 icon="eicon-preview-medium"
63 url={ `/kit-library/preview/${ props.model.id }` }
64 onClick={ () => eventTracking( 'kit-library/check-out-kit' ) }
65 />
66 {
67 type === TYPE_PROMOTION && subscriptionPlan?.label && <Button
68 className="e-kit-library__kit-item-overlay-promotion-button"
69 text={ `Go ${ subscriptionPlan.label }` }
70 icon="eicon-external-link-square"
71 url={ subscriptionPlan.promotion_url }
72 target="_blank"
73 />
74 }
75 </Grid>
76 </CardOverlay>
77 </CardImage>
78 </CardBody>
79 </Card>
80 );
81 };
82
83 KitListItem.propTypes = {
84 model: PropTypes.instanceOf( Kit ).isRequired,
85 index: PropTypes.number,
86 queryParams: PropTypes.string,
87 source: PropTypes.string,
88 };
89
90 export default React.memo( KitListItem );
91