From b9ead1c402e87537523825a08a9d037870eed84b Mon Sep 17 00:00:00 2001 From: Evangeline Ireland Date: Thu, 11 Jul 2024 08:33:34 -0700 Subject: [PATCH] 187810830 edit attr prop modal tuneup (#1336) * Updates modals to have a gray background and inputs have white background. * Capitalizes edit atrribute form labels * Tunes up edit attribute properties modal styling * Adds default button color * Adds attribute icon to eidt attribute modal * Tunes up formula modal styling * Closes the edit attribute modal and applies the changes when user types "Enter" in the inputs or text area. * Makes input fields more responsive * Handle Escape key down --- v3/src/assets/icons/attribute-icon.svg | 10 ++ .../attribute-menu/attribute-menu.scss | 27 ++++ .../edit-attribute-properties-modal.tsx | 140 ++++++++++-------- .../attribute-menu/edit-formula-modal.tsx | 32 ++-- v3/src/components/codap-modal.scss | 21 ++- v3/src/utilities/translation/lang/en-US.json5 | 14 +- v3/src/utilities/translation/lang/es.json | 14 +- v3/src/utilities/translation/lang/nb.json | 16 +- v3/src/utilities/translation/lang/nn.json | 16 +- v3/src/utilities/translation/lang/pt-BR.json | 16 +- v3/src/utilities/translation/lang/tr.json | 16 +- 11 files changed, 202 insertions(+), 120 deletions(-) create mode 100644 v3/src/assets/icons/attribute-icon.svg create mode 100644 v3/src/components/case-table/attribute-menu/attribute-menu.scss diff --git a/v3/src/assets/icons/attribute-icon.svg b/v3/src/assets/icons/attribute-icon.svg new file mode 100644 index 0000000000..0cf49c3455 --- /dev/null +++ b/v3/src/assets/icons/attribute-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/v3/src/components/case-table/attribute-menu/attribute-menu.scss b/v3/src/components/case-table/attribute-menu/attribute-menu.scss new file mode 100644 index 0000000000..075167de06 --- /dev/null +++ b/v3/src/components/case-table/attribute-menu/attribute-menu.scss @@ -0,0 +1,27 @@ +// Edit Attribute Modal Styles +.edit-attribute-form-row { + display: flex !important; + flex-direction: row; + align-items: center; + justify-content: space-between; + + input, .chakra-select__wrapper { + margin-left: 10px; + } + input { + padding: 0 8px; + } +} +.edit-attribute-form-row.editable { + justify-content: flex-start; + .chakra-radio-group { + margin-left: 10px; + } +} + +// Formula Editor Styles +.formula-form-control { + input { + max-width: 270px; + } +} diff --git a/v3/src/components/case-table/attribute-menu/edit-attribute-properties-modal.tsx b/v3/src/components/case-table/attribute-menu/edit-attribute-properties-modal.tsx index de1adde7a7..23122de3af 100644 --- a/v3/src/components/case-table/attribute-menu/edit-attribute-properties-modal.tsx +++ b/v3/src/components/case-table/attribute-menu/edit-attribute-properties-modal.tsx @@ -7,6 +7,9 @@ import { updateAttributesNotification } from "../../../models/data/data-set-noti import { uniqueName } from "../../../utilities/js-utils" import { t } from "../../../utilities/translation/translate" import { CodapModal } from "../../codap-modal" +import AttributeIcon from "../../../assets/icons/attribute-icon.svg" + +import "./attribute-menu.scss" // for use in menus of attribute types const selectableAttributeTypes = ["none", ...attributeTypes] as const @@ -78,90 +81,105 @@ export const EditAttributePropertiesModal = ({ attributeId, isOpen, onClose }: I onClose() } + const handleKeyDown = (e: React.KeyboardEvent) => { + e.stopPropagation() + if (e.key === "Escape") { + closeModal() + } + if (e.key === "Enter") { + applyChanges() + } + } + const buttons = [ { label: t("DG.AttrFormView.cancelBtnTitle"), tooltip: t("DG.AttrFormView.cancelBtnTooltip"), onClick: closeModal }, - { label: t("DG.AttrFormView.applyBtnTitle"), onClick: applyChanges } + { label: t("DG.AttrFormView.applyBtnTitle"), onClick: applyChanges, default: true } ] return ( -
+
+ +
{t("DG.TableController.attributeEditor.title")}
- - {t("DG.CaseTable.attributeEditor.name")} - e.target.select()} - onChange={event => setAttributeName(event.target.value)} data-testid="attr-name-input" - onKeyDown={(e) => e.stopPropagation()} - /> - - {t("DG.CaseTable.attributeEditor.description")} -