Skip to content

Commit

Permalink
Remove search box from Metadata Panel (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
guergana authored Jun 17, 2024
1 parent 5f6e7fb commit 65911b9
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 50 deletions.
4 changes: 2 additions & 2 deletions client/components/Editors/Base/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface EditorListProps {
query?: string
onAddClick: () => void
// We accept search as a prop otherwise it loses focus
SearchInput: React.ReactNode
SearchInput?: React.ReactNode
}

export default function EditorList(props: React.PropsWithChildren<EditorListProps>) {
Expand All @@ -28,7 +28,7 @@ export default function EditorList(props: React.PropsWithChildren<EditorListProp
return (
<React.Fragment>
<HeadingBox>
<Columns spacing={1} layout={[4, 5, 3]}>
<Columns spacing={1} layout={props.SearchInput ? [4, 5, 3] : [6, 6]}>
<Box sx={{ whiteSpace: 'nowrap' }}>{startCase(props.kind)}s</Box>
<Box sx={{ float: 'right' }}>
<AddButton />
Expand Down
13 changes: 1 addition & 12 deletions client/components/Editors/Resource/Sections/Contributors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import InputField from '../../../Parts/Fields/Input'
import EditorItem from '../../Base/Item'
import EditorList from '../../Base/List'
import EditorListItem from '../../Base/ListItem'
import EditorSearch from '../../Base/Search'
import { useStore, selectors, select } from '../store'

export default function Contributors() {
Expand All @@ -19,17 +18,7 @@ function ContributorList() {
const addContributor = useStore((state) => state.addContributor)
const removeContributor = useStore((state) => state.removeContributor)
return (
<EditorList
kind="contributor"
query={query}
onAddClick={() => addContributor()}
SearchInput={
<EditorSearch
value={query || ''}
onChange={(query) => updateContributorState({ query })}
/>
}
>
<EditorList kind="contributor" query={query} onAddClick={() => addContributor()}>
{contributorItems.map(({ index, contributor }) => (
<EditorListItem
key={index}
Expand Down
13 changes: 1 addition & 12 deletions client/components/Editors/Resource/Sections/Licenses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import InputField from '../../../Parts/Fields/Input'
import EditorItem from '../../Base/Item'
import EditorList from '../../Base/List'
import EditorListItem from '../../Base/ListItem'
import EditorSearch from '../../Base/Search'
import { useStore, selectors, select } from '../store'
import validator from 'validator'

Expand All @@ -21,17 +20,7 @@ function LicenseList() {
const addLicense = useStore((state) => state.addLicense)
const removeLicense = useStore((state) => state.removeLicense)
return (
<EditorList
kind="license"
query={query}
onAddClick={() => addLicense()}
SearchInput={
<EditorSearch
value={query || ''}
onChange={(query) => updateLicenseState({ query })}
/>
}
>
<EditorList kind="license" query={query} onAddClick={() => addLicense()}>
{licenseItems.map(({ index, license }) => (
<EditorListItem
key={index}
Expand Down
13 changes: 1 addition & 12 deletions client/components/Editors/Resource/Sections/Sources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import InputField from '../../../Parts/Fields/Input'
import EditorItem from '../../Base/Item'
import EditorList from '../../Base/List'
import EditorListItem from '../../Base/ListItem'
import EditorSearch from '../../Base/Search'
import { useStore, selectors, select } from '../store'
import validator from 'validator'

Expand All @@ -21,17 +20,7 @@ function SourceList() {
const addSource = useStore((state) => state.addSource)
const removeSource = useStore((state) => state.removeSource)
return (
<EditorList
kind="source"
query={query}
onAddClick={() => addSource()}
SearchInput={
<EditorSearch
value={query || ''}
onChange={(query) => updateSourceState({ query })}
/>
}
>
<EditorList kind="source" query={query} onAddClick={() => addSource()}>
{sourceItems.map(({ index, source }) => (
<EditorListItem
key={index}
Expand Down
13 changes: 1 addition & 12 deletions client/components/Editors/Schema/Sections/ForeignKeys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import SelectField from '../../../Parts/Fields/Select'
import EditorItem from '../../Base/Item'
import EditorList from '../../Base/List'
import EditorListItem from '../../Base/ListItem'
import EditorSearch from '../../Base/Search'
import { useStore, selectors, select } from '../store'

export default function ForeignKey() {
Expand All @@ -20,17 +19,7 @@ function ForeignKeyList() {
const addForeignKey = useStore((state) => state.addForeignKey)
const removeForeignKey = useStore((state) => state.removeForeignKey)
return (
<EditorList
kind="foreign key"
query={query}
onAddClick={() => addForeignKey()}
SearchInput={
<EditorSearch
value={query || ''}
onChange={(query) => updateForeignKeyState({ query })}
/>
}
>
<EditorList kind="foreign key" query={query} onAddClick={() => addForeignKey()}>
{foreignKeyItems.map(({ index, foreignKey }) => (
<EditorListItem
key={index}
Expand Down

0 comments on commit 65911b9

Please sign in to comment.