From bd576ca80864b8f7d649a2e81717b2e3858f7f05 Mon Sep 17 00:00:00 2001 From: GyDi Date: Tue, 16 Aug 2022 01:08:54 +0800 Subject: [PATCH] fix: adjust web ui item style --- src/components/setting/mods/web-ui-item.tsx | 165 +++++++++++--------- 1 file changed, 91 insertions(+), 74 deletions(-) diff --git a/src/components/setting/mods/web-ui-item.tsx b/src/components/setting/mods/web-ui-item.tsx index dd6a84f..afc775d 100644 --- a/src/components/setting/mods/web-ui-item.tsx +++ b/src/components/setting/mods/web-ui-item.tsx @@ -1,5 +1,11 @@ import { useState } from "react"; -import { IconButton, Stack, TextField, Typography } from "@mui/material"; +import { + Divider, + IconButton, + Stack, + TextField, + Typography, +} from "@mui/material"; import { CheckRounded, CloseRounded, @@ -32,83 +38,94 @@ const WebUIItem = (props: Props) => { if (editing || onlyEdit) { return ( - - setEditValue(e.target.value)} - placeholder={`Support %host %port %secret`} - autoComplete="off" - /> - { - onChange(editValue); - setEditing(false); - }} - > - - - { - onCancel?.(); - setEditing(false); - }} - > - - - + <> + + setEditValue(e.target.value)} + placeholder={`Support %host %port %secret`} + autoComplete="off" + /> + { + onChange(editValue); + setEditing(false); + }} + > + + + { + onCancel?.(); + setEditing(false); + }} + > + + + + + ); } + const html = value + ?.replace("%host", "%host") + .replace("%port", "%port") + .replace("%secret", "%secret"); + return ( - - - {value || "NULL"} - - onOpenUrl?.(value)} - > - - - { - setEditing(true); - setEditValue(value); - }} - > - - - - - - + <> + + ({ + "> span": { + color: palette.primary.main, + }, + })} + dangerouslySetInnerHTML={{ __html: html || "NULL" }} + /> + onOpenUrl?.(value)} + > + + + { + setEditing(true); + setEditValue(value); + }} + > + + + + + + + + ); };