@nexusui/components
Version:
These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.
2 lines (1 loc) • 937 B
JavaScript
import{jsxs as o,jsx as e}from"react/jsx-runtime";import{useState as r}from"react";import n from"@mui/material/Box";import{useTranslate as t}from"../locales/index.js";import a from"./locale.json.js";import{styles as s}from"./CodeSnippet.style.js";import{CodeToolBar as i}from"./components/CodeToolBar/CodeToolBar.js";import{CodeViewer as p}from"./components/CodeViewer/CodeViewer.js";const m=m=>{const{code:d,previewCode:c,language:l="tsx",showLineNumbers:C,showCopyInCode:u=!1,onOpenInSandbox:x,sx:f,...w}=m,[g,j]=r(!1),b=!!c,h=!g&&b?c:d.replace(/\n$/,""),y=t(a);return o(n,{className:"NexusCodeSnippet-root","aria-label":"codeSnippetLabel","data-testid":"Code-snippet-root",sx:[s.root,...Array.isArray(f)?f:[f]],...w,children:[e(i,{code:h,codeOpen:g,onCodeOpenChange:()=>{j((o=>!o))},onOpenInSandbox:x,showPreview:b,language:l,t:y}),e(p,{code:h,language:l,copyButtonHidden:!u,showLineNumbers:C})]})};export{m as CodeSnippetComponent};