Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/account/settings/text-setting.tsx
5891 views
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 { COLORS } from "@cocalc/util/theme";
9
10
import { LabeledRow } from "@cocalc/frontend/components";
11
12
// in a grid: Title [text input]
13
interface Props {
14
label: string;
15
value?: string;
16
onChange: (e) => void;
17
onBlur?: (e) => void;
18
onFocus?: () => void;
19
onPressEnter?: (e) => void;
20
maxLength?: number;
21
disabled?: boolean;
22
title?: string; // tooltip text
23
}
24
25
// Note -- we disable all password manager autocomplete, since this is a component
26
// that's used internally in the app for configuration. See https://github.com/sagemathinc/cocalc/issues/6868
27
28
export function TextSetting(props: Props): React.JSX.Element {
29
return (
30
<LabeledRow
31
label={props.label}
32
style={props.disabled ? { color: COLORS.GRAY_M } : undefined}
33
>
34
<Input
35
value={props.value}
36
onChange={props.onChange}
37
onBlur={props.onBlur}
38
onFocus={props.onFocus}
39
onPressEnter={props.onPressEnter}
40
maxLength={props.maxLength}
41
disabled={props.disabled}
42
title={props.title}
43
autoComplete={"off"}
44
data-lpignore="true"
45
data-1p-ignore
46
/>
47
</LabeledRow>
48
);
49
}
50
51