Spaces:
Running
Running
Download frontend/src/components/shared/CodeBlock.js from braindecode/OpenEEGBench: direct link, hf CLI and curl.
- Browser
- Download file 853 Bytes
-
https://huggingface.co/spaces/braindecode/OpenEEGBench/resolve/refs%2Fpr%2F3/frontend/src/components/shared/CodeBlock.js
- Command line
-
hf download hf://spaces/braindecode/OpenEEGBench@refs/pr/3/frontend/src/components/shared/CodeBlock.js
-
curl -L -o CodeBlock.js https://huggingface.co/spaces/braindecode/OpenEEGBench/resolve/refs%2Fpr%2F3/frontend/src/components/shared/CodeBlock.js
853 Bytes
| import React from 'react'; | |
| import { Box, IconButton } from '@mui/material'; | |
| import ContentCopyIcon from '@mui/icons-material/ContentCopy'; | |
| const CodeBlock = ({ code }) => ( | |
| <Box sx={{ position: 'relative' }}> | |
| <IconButton | |
| onClick={() => navigator.clipboard.writeText(code)} | |
| sx={{ | |
| position: 'absolute', | |
| top: 8, | |
| right: 8, | |
| color: 'grey.500', | |
| '&:hover': { color: 'grey.300' }, | |
| }} | |
| > | |
| <ContentCopyIcon fontSize="small" /> | |
| </IconButton> | |
| <Box | |
| sx={{ | |
| backgroundColor: 'grey.900', | |
| color: 'grey.100', | |
| p: 2, | |
| borderRadius: 1, | |
| fontFamily: 'monospace', | |
| fontSize: '0.875rem', | |
| overflowX: 'auto', | |
| textAlign: 'left', | |
| whiteSpace: 'pre', | |
| }} | |
| > | |
| {code} | |
| </Box> | |
| </Box> | |
| ); | |
| export default CodeBlock; |