import CodeSnippet from '..';
import React from 'react';
import ReactDOM from 'react-dom';
const exampleCode = `
const list:any = Object.keys(data)?.map(item => item.id)?.sort((a, b) => a.index - b.index);
`.trim();
const multiExampleCode = `
import React, { useState } from "react";

function Example() {
  const [count, setCount] = useState(0);

  return (
    <div>
      <p>You clicked {count} times</p>
        <button onClick={() => setCount(count + 1)}>
        Click me
      </button>
    </div>
  );
}
`.trim();
ReactDOM.render(
  <div>
    <p>单行代码</p>
    <CodeSnippet code={exampleCode}></CodeSnippet>
    <p>多行代码</p>
    <CodeSnippet code={multiExampleCode} type="number"></CodeSnippet>
  </div>,
  document.getElementById('code-snippet-demo-1'),
);
