Server IP : 172.67.158.161 / Your IP : 3.12.149.174 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/components/summary/ |
Upload File : |
/** * External dependencies */ import { RawHTML, useMemo } from '@wordpress/element'; import { WordCountType } from '@woocommerce/block-settings'; import type { CSSProperties } from 'react'; /** * Internal dependencies */ import { generateSummary } from './utils'; interface SummaryProps { className?: string; source: string; maxLength?: number; countType?: WordCountType; style?: CSSProperties; } /** * Summary component. * * @param {Object} props Component props. * @param {string} props.source Source text. * @param {number} props.maxLength Max length of the summary, using countType. * @param {string} props.countType One of words, characters_excluding_spaces, or characters_including_spaces. * @param {string} props.className Class name for rendered component. * @param {CSSProperties} props.style Style Object for rendered component. * */ export const Summary = ( { source, maxLength = 15, countType = 'words', className = '', style = {}, }: SummaryProps ): JSX.Element => { const summaryText = useMemo( () => { return generateSummary( source, maxLength, countType ); }, [ source, maxLength, countType ] ); return ( <RawHTML style={ style } className={ className }> { summaryText } </RawHTML> ); }; export default Summary;