Skip to content
Snippets Groups Projects
Select Git revision
  • 0acb570731089790b09464ae5c7fce1c9ae75f91
  • master default protected
2 results

index.twig

Blame
  • AnnotationFormManifestNetwork.js 1.18 KiB
    import React from 'react';
    import {
      Grid, Paper, TextField, Typography, Button, Link,
    } from '@mui/material';
    import PropTypes from 'prop-types';
    import { isValidUrl } from '../utils';
    
    /** Form part for edit annotation content and body */
    function AnnotationFormNetwork({ manifestNetwork, updateManifestNetwork }) {
      return (
        <Paper style={{ padding: '5px' }}>
          <Typography variant="overline">
            Network
          </Typography>
          <Grid>
            <TextField
              value={manifestNetwork}
              onChange={(event) => updateManifestNetwork(event.target.value.trim())}
              label="Manifest URL"
              type="url"
            />
            {
              isValidUrl(manifestNetwork) ? (
                <Link
                  href={manifestNetwork}
                  target="_blank"
                >
                  {manifestNetwork}
                </Link>
              ) : (
                <Typography variant="caption">
                  Not a valid URL
                </Typography>
              )
            }
          </Grid>
        </Paper>
      );
    }
    
    AnnotationFormNetwork.propTypes = {
      manifestNetwork: PropTypes.string.isRequired,
      updateManifestNetwork: PropTypes.func.isRequired,
    };
    
    export default AnnotationFormNetwork;