mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
docs: tsx,todo,select (2 files)
This commit is contained in:
@@ -19,7 +19,7 @@ Use this file when you’re not sure what to do next, or you want a quick “mak
|
||||
|
||||
Run from `frontends/nextjs/`:
|
||||
|
||||
From repo root: `cd frontends/nextjs`
|
||||
From repo root: `cd frontends/nextjs` (or from `docs/todo/`: `cd ../../frontends/nextjs`)
|
||||
|
||||
- [ ] `npm ci` (or `npm install`)
|
||||
- [ ] `npm run typecheck`
|
||||
|
||||
@@ -14,20 +14,21 @@ import {
|
||||
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'
|
||||
|
||||
// Select wrapper with FormControl
|
||||
export interface SelectProps extends Omit<MuiSelectProps, 'onChange'> {
|
||||
export interface SelectProps extends Omit<MuiSelectProps<string>, 'onChange'> {
|
||||
onValueChange?: (value: string) => void
|
||||
helperText?: ReactNode
|
||||
}
|
||||
|
||||
const Select = forwardRef<HTMLDivElement, SelectProps>(
|
||||
({ onValueChange, value, defaultValue, label, error, helperText, children, sx, ...props }, ref) => {
|
||||
({ onValueChange, value, defaultValue, label, error, helperText, children, sx, variant = 'outlined', ...props }, ref) => {
|
||||
return (
|
||||
<FormControl ref={ref} fullWidth error={error} sx={sx}>
|
||||
{label && <InputLabel>{label}</InputLabel>}
|
||||
<MuiSelect
|
||||
<MuiSelect<string>
|
||||
value={value}
|
||||
defaultValue={defaultValue}
|
||||
label={label}
|
||||
variant={variant}
|
||||
onChange={(e) => onValueChange?.(e.target.value as string)}
|
||||
IconComponent={KeyboardArrowDownIcon}
|
||||
{...props}
|
||||
|
||||
Reference in New Issue
Block a user