From 8b2f801b913f8d90f2cad1b238bb8590919d0465 Mon Sep 17 00:00:00 2001 From: Kyle Doherty <kyle.l.doherty@gmail.com> Date: Mon, 2 Jul 2018 15:17:48 -0700 Subject: [PATCH] initial default color --- .../components/form/widgets/FormColorWidget.jsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/metabase/components/form/widgets/FormColorWidget.jsx b/frontend/src/metabase/components/form/widgets/FormColorWidget.jsx index 91d93194dde..5c8cd379214 100644 --- a/frontend/src/metabase/components/form/widgets/FormColorWidget.jsx +++ b/frontend/src/metabase/components/form/widgets/FormColorWidget.jsx @@ -3,9 +3,15 @@ import React from "react"; import ColorPicker from "metabase/components/ColorPicker"; import cx from "classnames"; -const FormColorWidget = ({ field, offset }) => ( +const FormColorWidget = ({ field, offset, initial }) => ( <div className={cx({ "Form-offset": offset })}> - <ColorPicker {...field} /> + <ColorPicker + {...field} + value={ + // if the field has a value use that, otherwise use the initial + field.value || initial() + } + /> </div> ); -- GitLab