Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
fix: set options interface for typing of onchange for filter
Browse files Browse the repository at this point in the history
  • Loading branch information
hetd54 committed Jul 1, 2024
1 parent c49cbbd commit 3edee5a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/components/Publications.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from "react"
import Select from "react-select"
import Select, { type Option } from "react-select"
import PubPlaceholder from "./svg/PubPlaceholder.tsx"

interface PubProps {
Expand All @@ -16,6 +16,11 @@ interface PubObject {
}
}

interface iOption {
label: string
value: string
}

const PublicationSection: React.FC<PubProps> = ({ publications }) => {
const classificationOptions = [
{ value: "Book", label: "Books" },
Expand Down Expand Up @@ -56,7 +61,7 @@ const PublicationSection: React.FC<PubProps> = ({ publications }) => {
<label className="pl-1">Show</label>
<Select
options={classificationOptions}
isMulti={true}
isMulti
isSearchable={false}
closeMenuOnSelect={false}
defaultValue={classificationOptions}
Expand All @@ -74,9 +79,7 @@ const PublicationSection: React.FC<PubProps> = ({ publications }) => {
paddingRight: "2rem",
}),
}}
onChange={(e) => {
setClassificationFilter(e)
}}
onChange={(option) => setClassificationFilter(option as Array<iOption>)}
/>
</div>
</section>
Expand Down

0 comments on commit 3edee5a

Please sign in to comment.