github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/dashboard/frontend/src/components/widgets/TerminalText.tsx (about) 1 import React, { FC } from 'react' 2 import Box from '@mui/material/Box' 3 4 export type TerminalTextConfig = { 5 backgroundColor?: string, 6 color?: string, 7 } 8 9 const TerminalText: FC<{ 10 data: any, 11 } & TerminalTextConfig> = ({ 12 data, 13 backgroundColor = '#000', 14 color = '#fff', 15 }) => { 16 return ( 17 <Box 18 component="div" 19 sx={{ 20 width: '100%', 21 padding: 2, 22 margin: 0, 23 backgroundColor, 24 overflow: 'auto', 25 }} 26 > 27 <Box 28 component="pre" 29 sx={{ 30 padding: 1, 31 margin: 0, 32 color, 33 font: 'Courier', 34 fontSize: '12px', 35 }} 36 > 37 { typeof(data) === 'string' ? data : JSON.stringify(data, null, 4) } 38 </Box> 39 </Box> 40 ) 41 } 42 43 export default TerminalText