Skip to content

Commit

Permalink
Get rid of the remove functionality from the qnode/pnode input compon…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
g1eb committed Jul 7, 2021
1 parent de01d5a commit 2d850ab
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 96 deletions.
44 changes: 12 additions & 32 deletions src/components/PropertyInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import React, { useEffect, useState } from 'react'
import Grid from '@material-ui/core/Grid'
import Link from '@material-ui/core/Link'
import Button from '@material-ui/core/Button'
import Tooltip from '@material-ui/core/Tooltip'
import IconButton from '@material-ui/core/IconButton'
import Typography from '@material-ui/core/Typography'
import CloseIcon from '@material-ui/icons/Close'
import AddIcon from '@material-ui/icons/Add'
import { makeStyles } from '@material-ui/styles'

Expand Down Expand Up @@ -57,11 +54,6 @@ const PropertyInput = ({
setSelected(property)
}

const removeSelected = () => {
onSelectProperty()
setSelected()
}

const renderTitle = () => {
return (
<Grid item xs={12}>
Expand All @@ -76,30 +68,18 @@ const PropertyInput = ({
if ( !selected || !selected.label ) { return }
return (
<Grid item xs={12}>
<Grid container spacing={3}>
<Grid item xs={10}>
<Link
variant="body1"
className={classes.link}
target="_blank" rel="noopener noreferrer"
href={`https://ringgaard.com/kb/${selected.id}`}>
{`${selected.label} (${selected.id})`}
</Link>
{!!selected.description && (
<Typography variant="body1">
{selected.description}
</Typography>
)}
</Grid>
<Grid item xs={2}>
<Tooltip arrow placement="top" title={'remove variable'}>
<IconButton className={classes.removeButton}
onClick={removeSelected}>
<CloseIcon />
</IconButton>
</Tooltip>
</Grid>
</Grid>
<Link
variant="body1"
className={classes.link}
target="_blank" rel="noopener noreferrer"
href={`https://ringgaard.com/kb/${selected.id}`}>
{`${selected.label} (${selected.id})`}
</Link>
{!!selected.description && (
<Typography variant="body1">
{selected.description}
</Typography>
)}
</Grid>
)
}
Expand Down
44 changes: 12 additions & 32 deletions src/components/QnodeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import React, { useEffect, useState } from 'react'
import Grid from '@material-ui/core/Grid'
import Link from '@material-ui/core/Link'
import Button from '@material-ui/core/Button'
import Tooltip from '@material-ui/core/Tooltip'
import IconButton from '@material-ui/core/IconButton'
import Typography from '@material-ui/core/Typography'
import FormHelperText from '@material-ui/core/FormHelperText'
import CloseIcon from '@material-ui/icons/Close'
import AddIcon from '@material-ui/icons/Add'
import { makeStyles } from '@material-ui/styles'

Expand Down Expand Up @@ -45,11 +42,6 @@ const QnodeInput = ({
setSelected(selectedQnode)
}, [selectedQnode])

const removeSelected = () => {
onSelectQnode()
setSelected()
}

const renderTitle = () => {
return (
<Grid item xs={12}>
Expand All @@ -64,30 +56,18 @@ const QnodeInput = ({
if ( !selected || !selected.label ) { return }
return (
<Grid item xs={12}>
<Grid container spacing={3}>
<Grid item xs={10}>
<Link
variant="body1"
className={classes.link}
target="_blank" rel="noopener noreferrer"
href={`https://ringgaard.com/kb/${selected.id}`}>
{`${selected.label} (${selected.id})`}
</Link>
{!!selected.description && (
<Typography variant="body1">
{selected.description}
</Typography>
)}
</Grid>
<Grid item xs={2}>
<Tooltip arrow placement="top" title={'remove selected country'}>
<IconButton className={classes.removeButton}
onClick={removeSelected}>
<CloseIcon />
</IconButton>
</Tooltip>
</Grid>
</Grid>
<Link
variant="body1"
className={classes.link}
target="_blank" rel="noopener noreferrer"
href={`https://ringgaard.com/kb/${selected.id}`}>
{`${selected.label} (${selected.id})`}
</Link>
{!!selected.description && (
<Typography variant="body1">
{selected.description}
</Typography>
)}
</Grid>
)
}
Expand Down
44 changes: 12 additions & 32 deletions src/components/UnitInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ import React, { useEffect, useRef, useState } from 'react'
import Grid from '@material-ui/core/Grid'
import Link from '@material-ui/core/Link'
import Button from '@material-ui/core/Button'
import Tooltip from '@material-ui/core/Tooltip'
import TextField from '@material-ui/core/TextField'
import IconButton from '@material-ui/core/IconButton'
import Typography from '@material-ui/core/Typography'
import FormHelperText from '@material-ui/core/FormHelperText'
import CircularProgress from '@material-ui/core/CircularProgress'
import Autocomplete from '@material-ui/lab/Autocomplete'
import CloseIcon from '@material-ui/icons/Close'
import DoneIcon from '@material-ui/icons/Done'
import AddIcon from '@material-ui/icons/Add'
import { makeStyles } from '@material-ui/styles'
Expand Down Expand Up @@ -104,11 +101,6 @@ const UnitInput = ({
setUnits([])
}

const removeSelected = () => {
onSelectUnit()
setSelected()
}

const renderTitle = () => {
return (
<Grid item xs={12}>
Expand All @@ -123,30 +115,18 @@ const UnitInput = ({
if ( !selected || !selected.label ) { return }
return (
<Grid item xs={12}>
<Grid container spacing={3}>
<Grid item xs={10}>
<Link
variant="body1"
className={classes.link}
target="_blank" rel="noopener noreferrer"
href={`https://ringgaard.com/kb/${selected.id}`}>
{`${selected.label} (${selected.id})`}
</Link>
{!!selected.description && (
<Typography variant="body1">
{selected.description}
</Typography>
)}
</Grid>
<Grid item xs={2}>
<Tooltip arrow placement="top" title={'remove unit'}>
<IconButton className={classes.removeButton}
onClick={removeSelected}>
<CloseIcon />
</IconButton>
</Tooltip>
</Grid>
</Grid>
<Link
variant="body1"
className={classes.link}
target="_blank" rel="noopener noreferrer"
href={`https://ringgaard.com/kb/${selected.id}`}>
{`${selected.label} (${selected.id})`}
</Link>
{!!selected.description && (
<Typography variant="body1">
{selected.description}
</Typography>
)}
</Grid>
)
}
Expand Down

0 comments on commit 2d850ab

Please sign in to comment.