go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/web/rpcexplorer/src/components/response_editor.tsx (about)

     1  // Copyright 2023 The LUCI Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  import Box from '@mui/material/Box';
    16  
    17  import * as ace from '../ace';
    18  
    19  export interface Props {
    20    value: string,
    21  }
    22  
    23  export const ResponseEditor = (props: Props) => {
    24    return (
    25      <Box
    26        component='div'
    27        sx={{
    28          border: '1px solid #e0e0e0',
    29          borderRadius: '2px',
    30          mb: 2,
    31        }}
    32      >
    33        <ace.AceEditor
    34          mode={ace.mode}
    35          theme={ace.theme}
    36          name='response-editor'
    37          width='100%'
    38          height='400px'
    39          value={props.value}
    40          setOptions={{
    41            readOnly: true,
    42            tabSize: 2,
    43            dragEnabled: false,
    44            showPrintMargin: false,
    45            useWorker: false,
    46          }}
    47        />
    48      </Box>
    49    );
    50  };