({ value, language, placeholder }: Props)
| 26 | } |
| 27 | |
| 28 | export default function BlockCode({ value, language, placeholder }: Props) { |
| 29 | const input = normalize(value, language); |
| 30 | const content = decodeHTML(input); |
| 31 | return ( |
| 32 | <> |
| 33 | <div className={styles.label}> |
| 34 | <span>{language}</span> |
| 35 | <span |
| 36 | className={styles.right} |
| 37 | onClick={() => { |
| 38 | copyToClipboard(value); |
| 39 | Toast.success('Copied code to clipboard'); |
| 40 | }} |
| 41 | > |
| 42 | <FiClipboard /> Copy code |
| 43 | </span> |
| 44 | </div> |
| 45 | <Code |
| 46 | className={styles.code} |
| 47 | block |
| 48 | content={isFormattable(content) ? formatCode(content) : content} |
| 49 | language={language} |
| 50 | highlight={!placeholder && isHighlighted(value)} |
| 51 | /> |
| 52 | </> |
| 53 | ); |
| 54 | } |
nothing calls this directly
no test coverage detected