-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
14 changed files
with
585 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Copyright (c) 2021 Gitpod GmbH. All rights reserved. | ||
* Licensed under the GNU Affero General Public License (AGPL). | ||
* See License-AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
|
||
function CheckBox(props: { | ||
name?: string, | ||
title: string, | ||
desc: string, | ||
checked: boolean, | ||
disabled?: boolean, | ||
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void | ||
}) { | ||
const inputProps: React.InputHTMLAttributes<HTMLInputElement> = { | ||
checked: props.checked, | ||
disabled: props.disabled, | ||
onChange: props.onChange, | ||
}; | ||
if (props.name) { | ||
inputProps.name = props.name; | ||
} | ||
|
||
const checkboxId = `checkbox-${props.title}-${String(Math.random())}`; | ||
|
||
return <div className="flex mt-4"> | ||
<input className={"h-4 w-4 focus:ring-0 mt-1 rounded cursor-pointer border-2 " + (props.checked ? 'bg-gray-800' : '')} type="checkbox" | ||
id={checkboxId} | ||
{...inputProps} | ||
/> | ||
<div className="flex flex-col ml-2"> | ||
<label htmlFor={checkboxId} className="text-gray-800 text-md font-semibold tracking-wide">{props.title}</label> | ||
<div className="text-gray-400 text-md">{props.desc}</div> | ||
</div> | ||
</div> | ||
} | ||
|
||
export default CheckBox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.