Add a black & white button. (#228)

This adds a "B&W" button to the colors area in the cluster and mandala pages. Clicking it will reset the background, stroke and fill colors to their monochromatic defaults.

I'm calling the button "B&W" for now to minimize the amount of space the button takes up, since I'd like to add at least one more to that area.  At some point we might want to use a UI that scales a bit better, like a dropdown button.
pull/229/head
Atul Varma 2021-09-27 08:00:57 -04:00 zatwierdzone przez GitHub
rodzic 64f7ca7852
commit 1bfd8d1bba
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 19 dodań i 1 usunięć

Wyświetl plik

@ -34,8 +34,26 @@ export function CompositionContextWidget<T extends SvgCompositionContext>({
onChange,
children,
}: CompositionContextWidgetProps<T>): JSX.Element {
const resetColors = () => {
const { background, stroke, fill } = DEFAULT_CONTEXT;
onChange({ ...ctx, background, stroke, fill });
};
const extraButtons = (
<>
<button
onClick={resetColors}
title="Reset colors to their black &amp; white defaults"
>
B&amp;W
</button>{" "}
</>
);
return (
<SymbolContextWidget ctx={ctx} onChange={onChange}>
<SymbolContextWidget
ctx={ctx}
onChange={onChange}
extraButtons={extraButtons}
>
{children}
<ColorWidget
label="Background"