79412130

Date: 2025-02-04 15:04:18
Score: 0.5
Natty:
Report link
               const URLBox = ({ url, onDelete }) => {
      const handleCopy = async () => {
        try {
          await navigator.clipboard.writeText(url);
        } catch (err) {
          console.error('Copy failed', err);
        }
      };

      return (
        <Box
          sx={{
            width: '100%',
            border: '1px solid #ccc',
            borderRadius: 0,
            p: 1,
            display: 'flex',
            alignItems: 'center',
            wordBreak: 'break-all', // allows long URLs to wrap within the container
          }}
        >
          <Typography variant="body2" sx={{ flexGrow: 1 }}>
            {url}
          </Typography>
          <IconButton size="small" onClick={handleCopy}>
            <ContentCopyIcon fontSize="small" />
          </IconButton>
          <IconButton size="small" onClick={() => onDelete(url)}>
            <DeleteIcon fontSize="small" />
          </IconButton>
        </Box>
      );
    };
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Kumar