From 404fd9056aba9ffcd12f3169b25f014c167aef8a Mon Sep 17 00:00:00 2001 From: Jenny <32821331+jenny-s51@users.noreply.github.com> Date: Mon, 16 Sep 2024 16:21:53 -0400 Subject: [PATCH 1/9] WIP label theming --- .../screens/RegisteredModels/MUI-theme.scss | 46 +++++++++++++------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss b/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss index 97bfe26bb3..a88e37db16 100644 --- a/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss +++ b/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss @@ -135,28 +135,44 @@ margin-bottom: 20px; } + + .mui-theme .pf-v6-c-form__label { position: absolute; - top: 0; - left: 0; + top: 40%; + left: 12px; font-size: 14px; color: #757575; /* MUI label color */ pointer-events: none; transition: all 0.2s ease; - transform-origin: left top; - transform: translateY(-50%) translateX(12px); - background-color: white; /* Ensure label background matches input */ - padding: 0 4px; /* Space between label text and border */ -} - -.mui-theme .form-input { - border: 1px solid #ccc; /* Border color */ - border-radius: 4px; /* Rounded corners */ - padding: 12px 12px 12px 12px; /* Adjust padding to fit label */ - font-size: 16px; /* Font size for input text */ - width: 100%; /* Full width of parent */ - box-sizing: border-box; /* Include padding and border in element’s total width and height */ + transform-origin: left center; + transform: translateY(-50%) scale(0.75); + background-color: white; + padding: 0 4px; + z-index: 1; +} + +.mui-theme .pf-v6-c-form-control { + font-size: 16px; + width: 100%; + box-sizing: border-box; transition: border-color 0.2s ease; + line-height: 1.5; /* Ensure consistency in line height */ +} + +.mui-theme .pf-v6-c-form-control:hover { + --pf-v6-c-form-control--after--BorderColor: var(--mui-palette-common-black); +} + +mui-theme .pf-v6-c-form__group .pf-v6-c-form-control:focus + .pf-v6-c-form__label, +.pf-v6-c-form__group .pf-v6-c-form-control:not(:placeholder-shown) + .pf-v6-c-form__label { + color: var(--mui-palette-primary-light); /* MUI blue for focused/active label */ +} + +.pf-v6-c-form__group .pf-v6-c-form-control:focus, +.pf-v6-c-form__group .pf-v6-c-form-control:active + { + border: 2px solid var(--mui-palette-primary-light); /* Blue border when focused */ } From 3e7c9e6d5ca4e6328c0f760817aaf614877362f2 Mon Sep 17 00:00:00 2001 From: Jenny <32821331+jenny-s51@users.noreply.github.com> Date: Tue, 17 Sep 2024 16:06:23 -0400 Subject: [PATCH 2/9] update border states to match MUI colors and styling when focused, label alignment and colors WIP --- .../screens/RegisteredModels/MUI-theme.scss | 59 ++++++++++++++++--- 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss b/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss index a88e37db16..5f4c72202d 100644 --- a/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss +++ b/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss @@ -96,6 +96,10 @@ --pf-t--global--color--nonstatus--blue--default: var(--mui-palette-primary-main); --pf-t--global--text--color--inverse: var(--mui-palette-common-white); + --pf-t--global--font--family--100: Roboto, Helvetica, Arial, sans-serif; + --pf-t--global--font--family--200: Roboto, Helvetica, Arial, sans-serif; + --pf-t--global--font--family--300: Roboto, Courier, monospace; + } .mui-theme .pf-v6-c-alert { @@ -135,8 +139,6 @@ margin-bottom: 20px; } - - .mui-theme .pf-v6-c-form__label { position: absolute; top: 40%; @@ -160,19 +162,58 @@ line-height: 1.5; /* Ensure consistency in line height */ } +/* Adjust the label when the textarea is a child of .form__group-control */ +.mui-theme .pf-v6-c-form__group-control textarea { + position: relative; /* Make sure textarea is positioned relative */ + padding-top: 24px; /* Space for the label */ + box-sizing: border-box; /* Include padding in element’s width */ +} + +.mui-theme .pf-v6-c-form-control>:is(input,select,textarea):focus { + --pf-v6-c-form-control--OutlineOffset: none; + outline: none; +} + +.mui-theme .pf-v6-c-form__group-control textarea ~ .pf-v6-c-form__label { + top: 10%; /* Adjust based on the height of the textarea */ + transform: translateY(-50%) scale(0.75); +} .mui-theme .pf-v6-c-form-control:hover { - --pf-v6-c-form-control--after--BorderColor: var(--mui-palette-common-black); + --pf-v6-c-form-control--hover--after--BorderColor: var(--mui-palette-common-black); } -mui-theme .pf-v6-c-form__group .pf-v6-c-form-control:focus + .pf-v6-c-form__label, +mui-theme .pf-v6-c-form__group .pf-v6-c-form-control:focus-within + .pf-v6-c-form__label, .pf-v6-c-form__group .pf-v6-c-form-control:not(:placeholder-shown) + .pf-v6-c-form__label { color: var(--mui-palette-primary-light); /* MUI blue for focused/active label */ } -.pf-v6-c-form__group .pf-v6-c-form-control:focus, -.pf-v6-c-form__group .pf-v6-c-form-control:active +.pf-v6-c-form__group .pf-v6-c-form-control:focus-within { - border: 2px solid var(--mui-palette-primary-light); /* Blue border when focused */ + --pf-v6-c-form-control--after--BorderWidth: 2px; + --pf-v6-c-form-control--after--BorderColor: var(--mui-palette-primary-light); +} + +/* Styles for disabled state */ +.mui-theme .pf-v6-c-form-control.pf-m-disabled input { + background-color: #f5f5f5; /* Light grey background */ + color: #a0a0a0; /* Grey text color */ + cursor: not-allowed; /* Indicate disabled state */ + border: none; /* Remove default border */ + border-bottom: 1px dotted #dcdcdc; /* Dotted bottom border */ + padding: 12px 0; /* Adjust padding to fit dotted border */ +} + +/* Adjust label positioning for disabled state */ +.mui-theme .pf-v6-c-form-control.pf-m-disabled input ~ .pf-v6-c-form__label { + top: 12px; /* Adjust label position for disabled state */ + transform: translateY(0) scale(0.75); /* Static label on top */ + color: #bdbdbd; /* Light grey color for disabled label */ +} + +/* Adjust padding-top for textarea to make room for label */ +.form__group-control textarea { + padding-top: 24px; /* Space for the label */ + box-sizing: border-box; /* Include padding in element’s width */ } @@ -259,6 +300,10 @@ mui-theme .pf-v6-c-form__group .pf-v6-c-form-control:focus + .pf-v6-c-form__labe display: block; } +.mui-theme .pf-v6-radio { + --pf-v6-c-radio--AccentColor: var(--mui-palette-primary-light); +} + .mui-theme .pf-v6-c-table { --pf-v6-c-table__sort--m-selected__button--Color: var(--mui-palette-text-primary); --pf-v6-c-table__sort-indicator--Color: var(--mui-palette-text-secondary); From bba7672e19b95f89aaf4d8534efd7e0adfd0ea44 Mon Sep 17 00:00:00 2001 From: Jenny <32821331+jenny-s51@users.noreply.github.com> Date: Wed, 18 Sep 2024 15:47:46 -0400 Subject: [PATCH 3/9] update form label color when field selected, add disabled styling --- .../screens/RegisteredModels/MUI-theme.scss | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss b/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss index 5f4c72202d..183084f1ee 100644 --- a/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss +++ b/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss @@ -136,12 +136,11 @@ .mui-theme .pf-v6-c-form__group { position: relative; - margin-bottom: 20px; } .mui-theme .pf-v6-c-form__label { position: absolute; - top: 40%; + top: 35%; left: 12px; font-size: 14px; color: #757575; /* MUI label color */ @@ -159,14 +158,16 @@ width: 100%; box-sizing: border-box; transition: border-color 0.2s ease; - line-height: 1.5; /* Ensure consistency in line height */ + line-height: 1.5; +} + +.mui-theme .pf-v6-c-form-control input { + padding: 16.5px 14px; } -/* Adjust the label when the textarea is a child of .form__group-control */ .mui-theme .pf-v6-c-form__group-control textarea { - position: relative; /* Make sure textarea is positioned relative */ - padding-top: 24px; /* Space for the label */ - box-sizing: border-box; /* Include padding in element’s width */ + position: relative; + box-sizing: border-box; } .mui-theme .pf-v6-c-form-control>:is(input,select,textarea):focus { @@ -174,49 +175,49 @@ outline: none; } -.mui-theme .pf-v6-c-form__group-control textarea ~ .pf-v6-c-form__label { - top: 10%; /* Adjust based on the height of the textarea */ - transform: translateY(-50%) scale(0.75); -} .mui-theme .pf-v6-c-form-control:hover { --pf-v6-c-form-control--hover--after--BorderColor: var(--mui-palette-common-black); } mui-theme .pf-v6-c-form__group .pf-v6-c-form-control:focus-within + .pf-v6-c-form__label, .pf-v6-c-form__group .pf-v6-c-form-control:not(:placeholder-shown) + .pf-v6-c-form__label { - color: var(--mui-palette-primary-light); /* MUI blue for focused/active label */ + color: var(--mui-palette-primary-light); } -.pf-v6-c-form__group .pf-v6-c-form-control:focus-within +.mui-theme .pf-v6-c-form__group:focus-within .pf-v6-c-form-control { --pf-v6-c-form-control--after--BorderWidth: 2px; --pf-v6-c-form-control--after--BorderColor: var(--mui-palette-primary-light); } -/* Styles for disabled state */ +.mui-theme .pf-v6-c-form__group:focus-within .pf-v6-c-form__label { + color: var(--mui-palette-primary-light); /* Change color of the label when the input is focused */ +} + +/* disabled state */ .mui-theme .pf-v6-c-form-control.pf-m-disabled input { background-color: #f5f5f5; /* Light grey background */ color: #a0a0a0; /* Grey text color */ cursor: not-allowed; /* Indicate disabled state */ border: none; /* Remove default border */ border-bottom: 1px dotted #dcdcdc; /* Dotted bottom border */ - padding: 12px 0; /* Adjust padding to fit dotted border */ + padding: 25px 12px 8px; } -/* Adjust label positioning for disabled state */ +/* Label positioning for disabled state */ .mui-theme .pf-v6-c-form-control.pf-m-disabled input ~ .pf-v6-c-form__label { top: 12px; /* Adjust label position for disabled state */ transform: translateY(0) scale(0.75); /* Static label on top */ color: #bdbdbd; /* Light grey color for disabled label */ } -/* Adjust padding-top for textarea to make room for label */ -.form__group-control textarea { - padding-top: 24px; /* Space for the label */ - box-sizing: border-box; /* Include padding in element’s width */ +/* Adjust label, does not work */ +.mui-theme .pf-v6-c-form__group-control .pf-v6-c-form-control.pf-m-disabled .pf-v6-c-form__label { + background-color: #f0f0f0; /* Match the label background to disabled input */ + top: 12px; /* Adjust label position if needed */ + transform: translateY(0) scale(0.75); /* Static label on top */ } - .mui-theme .pf-v6-c-menu { --pf-v6-c-menu--BoxShadow: var(--mui-shadows-8); --pf-v6-c-menu--BorderRadius: var(--mui-shape-borderRadius); From dc18e5e15f577c58f02df9d861d587c1f8542a19 Mon Sep 17 00:00:00 2001 From: Jenny <32821331+jenny-s51@users.noreply.github.com> Date: Wed, 18 Sep 2024 16:03:25 -0400 Subject: [PATCH 4/9] fix outline colors to match KF --- .../modelRegistry/screens/RegisteredModels/MUI-theme.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss b/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss index 183084f1ee..71bbd26e30 100644 --- a/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss +++ b/frontend/src/pages/modelRegistry/screens/RegisteredModels/MUI-theme.scss @@ -181,17 +181,17 @@ mui-theme .pf-v6-c-form__group .pf-v6-c-form-control:focus-within + .pf-v6-c-form__label, .pf-v6-c-form__group .pf-v6-c-form-control:not(:placeholder-shown) + .pf-v6-c-form__label { - color: var(--mui-palette-primary-light); + color: var(--mui-palette-primary-main); } .mui-theme .pf-v6-c-form__group:focus-within .pf-v6-c-form-control { --pf-v6-c-form-control--after--BorderWidth: 2px; - --pf-v6-c-form-control--after--BorderColor: var(--mui-palette-primary-light); + --pf-v6-c-form-control--after--BorderColor: var(--mui-palette-primary-main); } .mui-theme .pf-v6-c-form__group:focus-within .pf-v6-c-form__label { - color: var(--mui-palette-primary-light); /* Change color of the label when the input is focused */ + color: var(--mui-palette-primary-main); /* Change color of the label when the input is focused */ } /* disabled state */ @@ -302,7 +302,7 @@ mui-theme .pf-v6-c-form__group .pf-v6-c-form-control:focus-within + .pf-v6-c-for } .mui-theme .pf-v6-radio { - --pf-v6-c-radio--AccentColor: var(--mui-palette-primary-light); + --pf-v6-c-radio--AccentColor: var(--mui-palette-primary-main); } .mui-theme .pf-v6-c-table { From ac52b17a3b5499e888d26e863cbfc58cdd4708a7 Mon Sep 17 00:00:00 2001 From: Jenny <32821331+jenny-s51@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:34:43 -0400 Subject: [PATCH 5/9] fieldset updates with mcoker, disabled state WIP --- frontend/src/app/HeaderTools.tsx | 2 +- .../screens/RegisterModel/RegisterModel.tsx | 244 ++++++++++++------ .../screens/RegisteredModels/MUI-theme.scss | 82 ++++-- 3 files changed, 223 insertions(+), 105 deletions(-) diff --git a/frontend/src/app/HeaderTools.tsx b/frontend/src/app/HeaderTools.tsx index 349d18ae32..ea0eebda28 100644 --- a/frontend/src/app/HeaderTools.tsx +++ b/frontend/src/app/HeaderTools.tsx @@ -43,7 +43,7 @@ const HeaderTools: React.FC = ({ onNotificationsClick }) => { React.useEffect(() => { window.isSwitched = !isChecked; - }, [isChecked]); + }, [window.isSwitched]); const handleChange = (_event: React.FormEvent, checked: boolean) => { setIsChecked(!checked); diff --git a/frontend/src/pages/modelRegistry/screens/RegisterModel/RegisterModel.tsx b/frontend/src/pages/modelRegistry/screens/RegisterModel/RegisterModel.tsx index 673547f819..b16641bbfd 100644 --- a/frontend/src/pages/modelRegistry/screens/RegisterModel/RegisterModel.tsx +++ b/frontend/src/pages/modelRegistry/screens/RegisterModel/RegisterModel.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { ActionGroup, Alert, @@ -27,6 +26,7 @@ import { useParams } from 'react-router'; import { Link } from 'react-router-dom'; import ApplicationsPage from '~/pages/ApplicationsPage'; import useRegisterModelData from './useRegisterModelData'; +import React from 'react'; const RegisterModel: React.FC = () => { const { modelRegistry: mrName } = useParams(); @@ -51,6 +51,13 @@ const RegisterModel: React.FC = () => { const [loading, setIsLoading] = React.useState(false); const [error, setError] = React.useState(undefined); + const [isChecked, setIsChecked] = React.useState(true); + + React.useEffect(() => { + console.log(window.isSwitched) + setIsChecked(window?.isSwitched!); + }, [isChecked]); + enum ModelLocationType { ObjectStorage = 'Object storage', URI = 'URI', @@ -87,6 +94,28 @@ const RegisterModel: React.FC = () => { }); }; + const mrTextInput = ( + + ); + + const modelNameInput = ( + setData('modelName', value)} + /> + ) + return ( { - + {isChecked ? + (
+ {mrTextInput} + +
) + : mrTextInput }
@@ -132,23 +163,31 @@ const RegisterModel: React.FC = () => { } > - setData('modelName', value)} - /> + {isChecked ? ( +
+ {modelNameInput} + +
) : modelNameInput}
-