Skip to content

Commit d1011f2

Browse files
committed
wip
1 parent e6694bd commit d1011f2

File tree

4 files changed

+40
-5
lines changed

4 files changed

+40
-5
lines changed

components/dashboard/src/components/forms/CheckboxInput.tsx

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@
44
* See License.AGPL.txt in the project root for license information.
55
*/
66

7+
import classNames from "classnames";
78
import { FC, useCallback } from "react";
89
import { useId } from "../../hooks/useId";
10+
import { InputFieldHint } from "./InputFieldHint";
911

1012
type Props = {
1113
id?: string;
1214
value: string;
1315
checked: boolean;
16+
disabled?: boolean;
1417
label: string;
18+
hint?: string;
1519
onChange: (checked: boolean) => void;
1620
};
17-
export const CheckboxInput: FC<Props> = ({ id, value, label, checked, onChange }) => {
21+
export const CheckboxInput: FC<Props> = ({ id, value, label, hint, checked, disabled = false, onChange }) => {
1822
const maybeId = useId();
1923
const elementId = id || maybeId;
2024

@@ -26,16 +30,33 @@ export const CheckboxInput: FC<Props> = ({ id, value, label, checked, onChange }
2630
);
2731

2832
return (
29-
<label className="flex space-x-2 justify-start items-center" htmlFor={elementId}>
33+
<label className="flex space-x-2 justify-start items-start" htmlFor={elementId}>
3034
<input
3135
type="checkbox"
32-
className="rounded"
36+
// className="rounded border-2 mt-0.5 text-gray-600"
37+
className={classNames(
38+
"h-4 w-4 focus:ring-0 mt-0.5 rounded cursor-pointer bg-transparent border-2 dark:filter-invert border-gray-600 dark:border-gray-900 focus:border-gray-900 dark:focus:border-gray-800",
39+
{ "bg-gray-600 dark:bg-gray-900": checked },
40+
)}
3341
value={value}
3442
id={elementId}
3543
checked={checked}
44+
disabled={disabled}
3645
onChange={handleChange}
3746
/>
38-
<span className="text-sm dark:text-gray-400 text-gray-600">{label}</span>
47+
<div className="flex flex-col">
48+
<span
49+
// className="text-gray-600 dark:text-gray-400 text-sm"
50+
className={classNames(
51+
"text-md font-semibold cursor-pointer tracking-wide",
52+
disabled ? "text-gray-400 dark:text-gray-400" : "text-gray-600 dark:text-gray-100",
53+
)}
54+
>
55+
{label}
56+
</span>
57+
58+
{hint && <InputFieldHint>{hint}</InputFieldHint>}
59+
</div>
3960
</label>
4061
);
4162
};

components/dashboard/src/components/forms/InputField.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import classNames from "classnames";
88
import { FunctionComponent, memo, ReactNode } from "react";
9+
import { InputFieldHint } from "./InputFieldHint";
910

1011
type Props = {
1112
label?: ReactNode;
@@ -31,7 +32,7 @@ export const InputField: FunctionComponent<Props> = memo(({ label, id, hint, err
3132
)}
3233
{children}
3334
{error && <span className="text-red-500 text-sm">{error}</span>}
34-
{hint && <span className="text-gray-500 text-sm">{hint}</span>}
35+
{hint && <InputFieldHint>{hint}</InputFieldHint>}
3536
</div>
3637
);
3738
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* Copyright (c) 2023 Gitpod GmbH. All rights reserved.
3+
* Licensed under the GNU Affero General Public License (AGPL).
4+
* See License.AGPL.txt in the project root for license information.
5+
*/
6+
7+
import { FC } from "react";
8+
9+
export const InputFieldHint: FC = ({ children }) => {
10+
return <span className="text-gray-500 dark:text-gray-400 text-sm">{children}</span>;
11+
};

components/dashboard/src/onboarding/StepOrgInfo.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ export const StepOrgInfo: FC<Props> = ({ user, onComplete }) => {
210210
key={o.value}
211211
value={o.value}
212212
label={o.label}
213+
disabled
214+
hint="this is just a test"
213215
checked={signupGoals.includes(o.value)}
214216
onChange={(checked) => {
215217
if (checked) {

0 commit comments

Comments
 (0)