From 29ed55cf50298578a9fa92a209a1c9f70882ea43 Mon Sep 17 00:00:00 2001 From: Michelle Rodriguez <2316892579@qq.com> Date: Sat, 23 Nov 2024 20:53:28 +0800 Subject: [PATCH] feat: support to set icon color to the theme color when proxy icon starts with `data:image/svg+xml` (#1166) * feat: support to set icon color to the theme color when proxy icon starts with `data:image/svg+xml` * fix: errors related to set icon color to the theme color 1. remove incorrect CSS properties 2. rearrange these properties 3. use `fallback` property in `Show` component insead of using multiple `Show` components 4. Add reference link above `encodeSvg` function * fix:replace optional attributes with non-null assertions Co-authored-by: kunish <17328586+kunish@users.noreply.github.com> Signed-off-by: Michelle Rodriguez <2316892579@qq.com> --------- Signed-off-by: Michelle Rodriguez <2316892579@qq.com> Co-authored-by: kunish <17328586+kunish@users.noreply.github.com> --- src/pages/Proxies.tsx | 55 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/src/pages/Proxies.tsx b/src/pages/Proxies.tsx index a3d24c7..244ad15 100644 --- a/src/pages/Proxies.tsx +++ b/src/pages/Proxies.tsx @@ -92,7 +92,26 @@ export default () => { e.stopPropagation() void proxyGroupLatencyTest(groupName) } - + /** + * transform an SVG into a data URI + * @see https://gist.github.com/jennyknuth/222825e315d45a738ed9d6e04c7a88d0 + */ + const encodeSvg = (svg: string) => { + return svg + .replace( + '/g, '%3E') + } const onProxyProviderLatencyTestClick = ( e: MouseEvent, providerName: string, @@ -193,13 +212,33 @@ export default () => {
- + + } + > +
+ {proxyGroup.name}