This commit is contained in:
fisker Cheung authored and GitHub committed 2024-09-18 16:40:10 +08:00
1 parent aa3853b776
commit e0117a165b
19 files changed
+208 -171

No files matched your search

-14
View File
@@ -1,14 +0,0 @@
import * as React from "react";
import * as ReactDOM from "react-dom";
const root = document.getElementById("bottom-bar");
export default function BottomBar({ left, right }) {
return ReactDOM.createPortal(
<React.Fragment>
<div className="bottom-bar-buttons">{left}</div>
<div className="bottom-bar-buttons bottom-bar-buttons-right">{right}</div>
</React.Fragment>,
root,
);
}
+3 -3
View File
@@ -2,7 +2,7 @@ import * as React from "react";
import { Checkbox, NumberInput, Select } from "./inputs.js";
export function BooleanOption({ option, value, onChange }) {
function BooleanOption({ option, value, onChange }) {
function maybeInvert(value) {
return option.inverted ? !value : value;
}
@@ -16,7 +16,7 @@ export function BooleanOption({ option, value, onChange }) {
);
}
export function ChoiceOption({ option, value, onChange }) {
function ChoiceOption({ option, value, onChange }) {
return (
<Select
label={option.cliName}
@@ -28,7 +28,7 @@ export function ChoiceOption({ option, value, onChange }) {
);
}
export function NumberOption({ option, value, onChange }) {
function NumberOption({ option, value, onChange }) {
return (
<NumberInput
label={option.cliName}
-24
View File
@@ -118,27 +118,3 @@ export function convertOffsetToSelection(offset, content) {
}
return { anchor: { line, ch } };
}
/**
* Copied from https://github.com/prettier/prettier/blob/6fe21780115cf5f74f83876d64b03a727fbab220/src/cli/utils.js#L6-L27
* @template Obj
* @template Key
* @param {Array<Obj>} array
* @param {(value: Obj) => Key} iteratee
* @returns {{[p in Key]: T}}
*/
export function groupBy(array, iteratee) {
const result = Object.create(null);
for (const value of array) {
const key = iteratee(value);
if (Array.isArray(result[key])) {
result[key].push(value);
} else {
result[key] = [value];
}
}
return result;
}