11'use client' ;
22
3- import { ReactNode , useEffect , useRef , useState } from 'react' ;
3+ import { ReactNode , useEffect , useRef , useState } from 'react' ;
44import { ChevronDownIcon , ChevronRightIcon } from '@radix-ui/react-icons' ;
55import * as Sentry from '@sentry/nextjs' ;
66
@@ -26,7 +26,14 @@ function slugify(str: string) {
2626 . replace ( / [ ^ a - z 0 - 9 - ] / g, '' ) ;
2727}
2828
29- export function Expandable ( { title, level = 'info' , children, permalink, group, copy} : Props ) {
29+ export function Expandable ( {
30+ title,
31+ level = 'info' ,
32+ children,
33+ permalink,
34+ group,
35+ copy,
36+ } : Props ) {
3037 const id = permalink ? slugify ( title ) : undefined ;
3138
3239 const [ isExpanded , setIsExpanded ] = useState ( false ) ;
@@ -83,7 +90,7 @@ export function Expandable({title, level = 'info', children, permalink, group, c
8390 codeBlocks . forEach ( block => {
8491 // Exclude code elements within other code elements (e.g. inline code in a block)
8592 if ( ! block . closest ( 'code' ) ?. parentElement ?. closest ( 'code' ) ) {
86- contentToCopy += ( block . textContent || '' ) + '\n' ;
93+ contentToCopy += ( block . textContent || '' ) + '\n' ;
8794 }
8895 } ) ;
8996 contentToCopy = contentToCopy . trim ( ) ;
@@ -144,17 +151,20 @@ export function Expandable({title, level = 'info', children, permalink, group, c
144151 < div > { title } </ div >
145152 </ div >
146153 { copy && (
147- < button
154+ < button
148155 className = { styles [ 'copy-button' ] }
149156 onClick = { copyContentOnClick }
150157 type = "button" // Important for buttons in summaries
151158 >
152- { showCopyButton && ! copied && " Copy Rules" }
153- { showCopyButton && copied && " Copied!" }
159+ { showCopyButton && ! copied && ' Copy Rules' }
160+ { showCopyButton && copied && ' Copied!' }
154161 </ button >
155162 ) }
156163 </ summary >
157- < div ref = { contentRef } className = { `${ styles [ 'expandable-body' ] } callout-body content-flush-bottom` } >
164+ < div
165+ ref = { contentRef }
166+ className = { `${ styles [ 'expandable-body' ] } callout-body content-flush-bottom` }
167+ >
158168 { children }
159169 </ div >
160170 </ details >
0 commit comments