This repository was archived by the owner on Feb 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +20
-9
lines changed
cart-checkout/product-summary Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,11 @@ import PropTypes from 'prop-types';
55import Summary from '@woocommerce/base-components/summary' ;
66import { blocksConfig } from '@woocommerce/block-settings' ;
77
8+ interface ProductSummaryProps {
9+ className ?: string ;
10+ shortDescription ?: string ;
11+ fullDescription ?: string ;
12+ }
813/**
914 * Returns an element containing a summary of the product.
1015 *
@@ -17,7 +22,7 @@ const ProductSummary = ( {
1722 className,
1823 shortDescription = '' ,
1924 fullDescription = '' ,
20- } ) => {
25+ } : ProductSummaryProps ) : JSX . Element | null => {
2126 const source = shortDescription ? shortDescription : fullDescription ;
2227
2328 if ( ! source ) {
@@ -34,10 +39,4 @@ const ProductSummary = ( {
3439 ) ;
3540} ;
3641
37- ProductSummary . propTypes = {
38- className : PropTypes . string ,
39- shortDescription : PropTypes . string ,
40- fullDescription : PropTypes . string ,
41- } ;
42-
4342export default ProductSummary ;
Original file line number Diff line number Diff line change 22 * External dependencies
33 */
44import { RawHTML , useMemo } from '@wordpress/element' ;
5+ import { WordCountType } from '@woocommerce/block-settings' ;
56
67/**
78 * Internal dependencies
89 */
910import { generateSummary } from './utils' ;
1011
12+ interface SummaryProps {
13+ className ?: string ;
14+ source : string ;
15+ maxLength ?: number ;
16+ countType ?: WordCountType ;
17+ }
1118/**
1219 * Summary component.
1320 *
@@ -22,7 +29,7 @@ export const Summary = ( {
2229 maxLength = 15 ,
2330 countType = 'words' ,
2431 className = '' ,
25- } ) => {
32+ } : SummaryProps ) : JSX . Element => {
2633 const summaryText = useMemo ( ( ) => {
2734 return generateSummary ( source , maxLength , countType ) ;
2835 } , [ source , maxLength , countType ] ) ;
Original file line number Diff line number Diff line change 33 */
44import { getSetting , STORE_PAGES } from '@woocommerce/settings' ;
55
6+ export type WordCountType =
7+ | 'words'
8+ | 'characters_excluding_spaces'
9+ | 'characters_including_spaces' ;
10+
611interface WcBlocksConfig {
712 buildPhase : number ;
813 pluginUrl : string ;
914 productCount : number ;
1015 restApiRoutes : Record < string , string [ ] > ;
11- wordCountType : string ;
16+ wordCountType : WordCountType ;
1217}
1318
1419export const blocksConfig = getSetting ( 'wcBlocksConfig' , {
You can’t perform that action at this time.
0 commit comments