CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/account/settings/text-setting.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Input } from "antd";
7
8
import { LabeledRow } from "../../components";
9
10
// in a grid: Title [text input]
11
interface Props {
12
label: string;
13
value?: string;
14
onChange: (e) => void;
15
onBlur?: (e) => void;
16
onFocus?: () => void;
17
onPressEnter?: (e) => void;
18
maxLength?: number;
19
disabled?: boolean;
20
}
21
22
23
// Note -- we disable all password manager autocomplete, since this is a component
24
// that's used internally in the app for configuration. See https://github.com/sagemathinc/cocalc/issues/6868
25
26
export function TextSetting(props: Props): JSX.Element {
27
return (
28
<LabeledRow
29
label={props.label}
30
style={props.disabled ? { color: "#666" } : undefined}
31
>
32
<Input
33
value={props.value}
34
onChange={props.onChange}
35
onBlur={props.onBlur}
36
onFocus={props.onFocus}
37
onPressEnter={props.onPressEnter}
38
maxLength={props.maxLength}
39
disabled={props.disabled}
40
autoComplete={"off"}
41
data-lpignore="true"
42
data-1p-ignore
43
/>
44
</LabeledRow>
45
);
46
}
47
48