diff --git a/webapp/src/components/Inputs/InputAutoComplete.css b/webapp/src/components/Inputs/InputAutoComplete.css index 3c70bf5..cd5e623 100644 --- a/webapp/src/components/Inputs/InputAutoComplete.css +++ b/webapp/src/components/Inputs/InputAutoComplete.css @@ -38,4 +38,9 @@ max-width: 7em; text-overflow: ellipsis; overflow: hidden; +} + +.input-autocomplete--popper { + min-width: fit-content; + /* max-width: 90vw; */ } \ No newline at end of file diff --git a/webapp/src/components/Inputs/InputAutoComplete.tsx b/webapp/src/components/Inputs/InputAutoComplete.tsx index 055ab30..4a702b6 100644 --- a/webapp/src/components/Inputs/InputAutoComplete.tsx +++ b/webapp/src/components/Inputs/InputAutoComplete.tsx @@ -2,10 +2,11 @@ import "./InputAutoComplete.css"; import Autocomplete from "@mui/material/Autocomplete"; import TextField from "@mui/material/TextField"; import Chip from "@mui/material/Chip"; -import { Badge } from "@mui/material"; +import { Badge, Popper } from "@mui/material"; import { SearchItem } from "./extras"; import { ReactNode } from "react"; import { prettyName } from "utils/formatting"; +import { ModalStyleProps } from "../Modal/index"; export type BaseOption = { id: string; @@ -142,6 +143,16 @@ export function InputAutoComplete( options={options} onChange={onChange} getOptionLabel={getLabel as any} + PopperComponent={(props) => { + return ( + + ); + }} filterOptions={(opts, s) => { const searchTerm = s.inputValue; if (!searchTerm) { diff --git a/webapp/src/components/Inputs/extras-SearchItem.stories.tsx b/webapp/src/components/Inputs/extras-SearchItem.stories.tsx index d01cea4..4261519 100644 --- a/webapp/src/components/Inputs/extras-SearchItem.stories.tsx +++ b/webapp/src/components/Inputs/extras-SearchItem.stories.tsx @@ -4,25 +4,33 @@ import { Page } from "components/Page"; import { SearchItem } from "./extras"; export default { - title: 'Inputs/Extras/SearchItem', + title: "Inputs/Extras/SearchItem", component: SearchItem, - parameters: { actions: { argTypesRegex: '^on.*' } }, - argTypes: {} + parameters: { actions: { argTypesRegex: "^on.*" } }, + argTypes: {}, } as ComponentMeta; +const Template: ComponentStory = (args) => { + return ( + +
+ +
+
+ ); +}; - -const Template: ComponentStory = args => { - return - - - -} - -export const Simple = Template.bind({}) +export const Simple = Template.bind({}); Simple.args = { id: "sensor.humidity_main_bedroom", - label: 'Main Bedroom Humidity', + label: "Main Bedroom Humidity", searchTerm: "bedroom", listProps: {}, -} as any + onlyShowLabel: false, +}; diff --git a/webapp/src/components/Inputs/extras.css b/webapp/src/components/Inputs/extras.css index 634031c..7f7ce9c 100644 --- a/webapp/src/components/Inputs/extras.css +++ b/webapp/src/components/Inputs/extras.css @@ -1,9 +1,42 @@ .input-extras--search-item--list { display: flex; - flex-direction: row; - gap: 0.15em; + flex-direction: column; + gap: 0; + + justify-content: center; + align-items: flex-start !important; + + margin: 0; + padding: 0; + + min-height: 2em; + max-height: 100%; + height: 100%; + width: 100%; + max-width: 20em; + + text-overflow: ellipsis; + overflow: hidden; } -.input-extras--search-item--list>small::before { +.input-extras--search-item--list small { + /* max-height: 2em; */ + max-width: 100%; + width: fit-content; + overflow: hidden; + text-overflow: ellipsis; +} + +.input-extras--search-item--list b { + max-height: 1.5em; + width: fit-content; + max-width: 100%; + padding-right: 0.25em; + overflow: hidden; + text-overflow: ellipsis; + word-break: break-all; +} + +/* .input-extras--search-item--list>small::before { content: "/ "; -} \ No newline at end of file +} */ \ No newline at end of file diff --git a/webapp/src/components/Inputs/extras.tsx b/webapp/src/components/Inputs/extras.tsx index 0b07c94..ff308e7 100644 --- a/webapp/src/components/Inputs/extras.tsx +++ b/webapp/src/components/Inputs/extras.tsx @@ -36,34 +36,29 @@ export const SearchItem: FC<{ searchTerm: string; onlyShowLabel?: boolean; }> = ({ listProps, label, id, searchTerm, onlyShowLabel = false }) => { + const labelElm = ( + + + + ); + const idElm = ( + + + + ); + let inner = ( <> - - - {" "} - - - + {labelElm} + {idElm} ); if (onlyShowLabel) { if (label) { - inner = ( - <> - - - {" "} - - ); + inner = labelElm; } else { - inner = ( - <> - - - - - ); + inner = idElm; } } diff --git a/webapp/src/components/ServiceEditor/ServiceEditorTarget.css b/webapp/src/components/ServiceEditor/ServiceEditorTarget.css index 49d4627..1554772 100644 --- a/webapp/src/components/ServiceEditor/ServiceEditorTarget.css +++ b/webapp/src/components/ServiceEditor/ServiceEditorTarget.css @@ -3,8 +3,19 @@ flex-direction: row; gap: 1em; padding-bottom: 0.5em; + overflow: hidden; + flex-wrap: wrap; + align-items: center; + justify-content: center; } .service-editor--targets>div { flex: 1; + min-width: 8em; +} + +@media (max-width: 450px) { + .service-editor--targets>div { + max-width: 38vw; + } } \ No newline at end of file diff --git a/webapp/src/components/ServiceEditor/ServiceEditorTarget.tsx b/webapp/src/components/ServiceEditor/ServiceEditorTarget.tsx index d55a42e..98c6421 100644 --- a/webapp/src/components/ServiceEditor/ServiceEditorTarget.tsx +++ b/webapp/src/components/ServiceEditor/ServiceEditorTarget.tsx @@ -34,7 +34,7 @@ export const ServiceEditorTarget: FC = (props) => { return (
props.onChange({ @@ -46,7 +46,7 @@ export const ServiceEditorTarget: FC = (props) => { multiple /> props.onChange({ @@ -57,7 +57,7 @@ export const ServiceEditorTarget: FC = (props) => { multiple /> props.onChange({ diff --git a/webapp/src/components/ServiceEditor/index.css b/webapp/src/components/ServiceEditor/index.css index 93b1929..7d78c81 100644 --- a/webapp/src/components/ServiceEditor/index.css +++ b/webapp/src/components/ServiceEditor/index.css @@ -1,8 +1,8 @@ .service-editor { display: flex; flex-direction: column; - padding: 0.5em 1em; - margin: 0.5em 1em; + padding: 0.5em 0.25em; + margin: 0.5em 0.25em; border-color: var(--primary-accent); border-width: 1px; border-style: solid;