mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-09-10 20:08:19 +02:00
Rebuild with custom components
This commit is contained in:
40
tranga-website/src/Components/Inputs/TProps.ts
Normal file
40
tranga-website/src/Components/Inputs/TProps.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { ColorPaletteProp } from '@mui/joy'
|
||||
|
||||
export enum TState {
|
||||
clean,
|
||||
dirty,
|
||||
busy,
|
||||
success,
|
||||
failure,
|
||||
}
|
||||
|
||||
export const TDisabled = (state: TState): boolean => {
|
||||
switch (state) {
|
||||
case TState.busy:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export const TColor = (state: TState): ColorPaletteProp => {
|
||||
switch (state) {
|
||||
case TState.clean:
|
||||
return 'primary'
|
||||
case TState.dirty:
|
||||
return 'warning'
|
||||
case TState.busy:
|
||||
return 'neutral'
|
||||
case TState.success:
|
||||
return 'success'
|
||||
case TState.failure:
|
||||
return 'warning'
|
||||
}
|
||||
}
|
||||
|
||||
export default interface TProps {
|
||||
disabled?: boolean
|
||||
completionAction?: (
|
||||
value: string | number | readonly string[] | undefined
|
||||
) => Promise<void>
|
||||
}
|
Reference in New Issue
Block a user