@@ -73,7 +73,7 @@ const CopySnippetElement = tasty(Card, {
7373 styles : {
7474 display : 'block' ,
7575 fill : '#grey-light' ,
76- radius : '1r ' ,
76+ radius : '@large-radius ' ,
7777 border : 0 ,
7878 padding : 0 ,
7979
@@ -82,7 +82,7 @@ const CopySnippetElement = tasty(Card, {
8282 flow : 'row' ,
8383 gridColumns : 'minmax(0, 1fr) auto' ,
8484 width : 'min 20x' ,
85- radius : '1r ' ,
85+ radius : '@large-radius ' ,
8686 position : 'relative' ,
8787 overflow : 'hidden' ,
8888 } ,
@@ -151,6 +151,10 @@ export interface CubeCopySnippetProps extends CubeCardProps {
151151// const HIDDEN_SYMBOL = '●';
152152const HIDDEN_SYMBOL = '•' ;
153153
154+ function replaceSymbolsToHidden ( str : string ) {
155+ return HIDDEN_SYMBOL . repeat ( str . length ) ;
156+ }
157+
154158function CopySnippet ( allProps : CubeCopySnippetProps ) {
155159 const {
156160 code = '' ,
@@ -190,29 +194,17 @@ function CopySnippet(allProps: CubeCopySnippetProps) {
190194
191195 if ( ! showHidden ) {
192196 if ( hideText === true ) {
193- formattedCode = formattedCode
194- . split ( '' )
195- . map ( ( s ) => HIDDEN_SYMBOL )
196- . join ( '' )
197- . trim ( ) ;
197+ formattedCode = replaceSymbolsToHidden ( formattedCode ) ;
198198 } else if ( typeof hideText === 'string' ) {
199199 formattedCode = formattedCode . replaceAll (
200200 hideText ,
201- hideText
202- . split ( '' )
203- . map ( ( s ) => HIDDEN_SYMBOL )
204- . join ( '' )
205- . trim ( ) ,
201+ replaceSymbolsToHidden ( hideText ) ,
206202 ) ;
207203 } else if ( Array . isArray ( hideText ) ) {
208204 hideText . forEach ( ( text ) => {
209205 formattedCode = formattedCode . replaceAll (
210206 text ,
211- text
212- . split ( '' )
213- . map ( ( s ) => HIDDEN_SYMBOL )
214- . join ( '' )
215- . trim ( ) ,
207+ replaceSymbolsToHidden ( text ) ,
216208 ) ;
217209 } ) ;
218210 }
0 commit comments