You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1000 B
TypeScript
47 lines
1000 B
TypeScript
3 years ago
|
import "./ToolIcon.scss";
|
||
|
|
||
|
import clsx from "clsx";
|
||
|
import { ToolButtonSize } from "./ToolButton";
|
||
2 years ago
|
import { PenModeIcon } from "./icons";
|
||
3 years ago
|
|
||
|
type PenModeIconProps = {
|
||
|
title?: string;
|
||
|
name?: string;
|
||
|
checked: boolean;
|
||
|
onChange?(): void;
|
||
|
zenModeEnabled?: boolean;
|
||
|
isMobile?: boolean;
|
||
|
penDetected: boolean;
|
||
|
};
|
||
|
|
||
|
const DEFAULT_SIZE: ToolButtonSize = "medium";
|
||
|
|
||
|
export const PenModeButton = (props: PenModeIconProps) => {
|
||
|
if (!props.penDetected) {
|
||
2 years ago
|
return null;
|
||
3 years ago
|
}
|
||
2 years ago
|
|
||
3 years ago
|
return (
|
||
|
<label
|
||
|
className={clsx(
|
||
2 years ago
|
"ToolIcon ToolIcon__penMode",
|
||
3 years ago
|
`ToolIcon_size_${DEFAULT_SIZE}`,
|
||
|
{
|
||
|
"is-mobile": props.isMobile,
|
||
|
},
|
||
|
)}
|
||
|
title={`${props.title}`}
|
||
|
>
|
||
|
<input
|
||
|
className="ToolIcon_type_checkbox"
|
||
|
type="checkbox"
|
||
|
name={props.name}
|
||
|
onChange={props.onChange}
|
||
|
checked={props.checked}
|
||
|
aria-label={props.title}
|
||
|
/>
|
||
2 years ago
|
<div className="ToolIcon__icon">{PenModeIcon}</div>
|
||
3 years ago
|
</label>
|
||
|
);
|
||
|
};
|