summaryrefslogtreecommitdiff
path: root/src/components/Field.tsx
diff options
context:
space:
mode:
authorHaishan <[email protected]>2021-06-13 15:20:12 +0800
committerHaishan <[email protected]>2021-06-13 18:26:30 +0800
commitc78dbcf8f89072dc9c2fa8ba81e2cf5a80218cd7 (patch)
tree1801b2954623c3b6710ba769836e5c25a68cf65a /src/components/Field.tsx
parentaad1d2681e4415add1ab440159bf1253b5b34d8e (diff)
Support switch theme on backend config page
Diffstat (limited to 'src/components/Field.tsx')
-rw-r--r--src/components/Field.tsx10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/components/Field.tsx b/src/components/Field.tsx
index 4134d3e..a0d43cf 100644
--- a/src/components/Field.tsx
+++ b/src/components/Field.tsx
@@ -1,27 +1,25 @@
-import cx from 'clsx';
-import React from 'react';
+import * as React from 'react';
import s from './Field.module.scss';
const { useCallback } = React;
type Props = {
+ name: string;
value?: string | number;
type?: 'text' | 'number';
onChange?: (...args: any[]) => any;
id?: string;
label?: string;
+ placeholder?: string;
};
export default function Field({ id, label, value, onChange, ...props }: Props) {
const valueOnChange = useCallback((e) => onChange(e), [onChange]);
- const labelClassName = cx({
- [s.floatAbove]: typeof value === 'string' && value !== '',
- });
return (
<div className={s.root}>
<input id={id} value={value} onChange={valueOnChange} {...props} />
- <label htmlFor={id} className={labelClassName}>
+ <label htmlFor={id} className={s.floatAbove}>
{label}
</label>
</div>