From e48b5f9bae53962a8d5c553b3f6f6fd0de7cb7d2 Mon Sep 17 00:00:00 2001 From: Atul Varma Date: Fri, 2 Apr 2021 16:33:07 -0400 Subject: [PATCH] Factor out a SvgCompositionContext. (#72) This fixes #67 by making the background color selection/randomization code more DRY via the addition of a new `SvgCompositionContext` and a `CompositionContextWidget`. It also documents the `SvgSymbolContext` type, and moves the "randomize colors" button closer to the actual colors. --- index.html | 6 ++++ lib/checkbox.tsx | 2 +- lib/pages/creature-page.tsx | 36 ++++++-------------- lib/pages/mandala-page.tsx | 47 +++++++++++--------------- lib/svg-composition-context.tsx | 60 +++++++++++++++++++++++++++++++++ lib/svg-symbol.tsx | 22 ++++++++++++ lib/symbol-context-widget.tsx | 19 ++++++++--- 7 files changed, 132 insertions(+), 60 deletions(-) create mode 100644 lib/svg-composition-context.tsx diff --git a/index.html b/index.html index 460fff5..54ad5bc 100644 --- a/index.html +++ b/index.html @@ -71,6 +71,12 @@ ul.navbar li:last-child { background-color: rgba(255, 255, 255, 0.9); } +.mandala-container label.checkbox { + display: block; + margin-top: 10px; + margin-bottom: 10px; +} + .mandala-container .color-widget { display: flex; } diff --git a/lib/checkbox.tsx b/lib/checkbox.tsx index 81ddb32..c43da36 100644 --- a/lib/checkbox.tsx +++ b/lib/checkbox.tsx @@ -8,7 +8,7 @@ type CheckboxProps = { export const Checkbox: React.FC = (props) => { return ( -