Skip to content

Commit

Permalink
refactor(select): move Select and upgrade types
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteWither committed Aug 17, 2024
1 parent f750d3c commit 9573390
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
File renamed without changes.
22 changes: 9 additions & 13 deletions src/Components/Select/index.tsx → src/Shared/Ui/Select/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
import { ChangeEventHandler } from "react"
import "./index.sass"

type value = string
export type SelectOption = { value: string; title: string }

export type Select = Array<{
value: value
title: string
}>

type selectProps = {
value: value
options: Select
onChange?: (value: value) => void
interface SelectProps {
value: string
options: SelectOption[]
onChange: (value: string) => void
}

export function Select({ value = null, options = [], onChange = null }: selectProps) {
const changeHandler = (e: React.ChangeEvent<HTMLSelectElement>) => {
if (onChange) onChange(e.target.value)
export function Select({ value, options, onChange }: SelectProps) {
const changeHandler: ChangeEventHandler<HTMLSelectElement> = (event) => {
onChange(event.target.value)
}

return (
Expand Down

0 comments on commit 9573390

Please sign in to comment.