From 3fdc7bb87a131f651b98476629f401b49702f8c9 Mon Sep 17 00:00:00 2001 From: rektdeckard Date: Sun, 27 Sep 2020 13:47:49 -0400 Subject: [PATCH] InfoPanel: indicate lack of support for duotone weight in JS lib While phosphor-icons uses an icon font implementation, we won't be able to provide the duotone weight in that library. We now indicate lack of support by disabling the code snippet and copy button. --- src/components/IconGrid/IconGrid.css | 4 ++ src/components/IconGrid/InfoPanel.tsx | 55 ++++++++++++++++----------- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/src/components/IconGrid/IconGrid.css b/src/components/IconGrid/IconGrid.css index 7c8d783..d669ae6 100644 --- a/src/components/IconGrid/IconGrid.css +++ b/src/components/IconGrid/IconGrid.css @@ -121,6 +121,10 @@ cursor: pointer; } +.snippet button:disabled { + cursor: not-allowed; +} + .button-row { display: flex; } diff --git a/src/components/IconGrid/InfoPanel.tsx b/src/components/IconGrid/InfoPanel.tsx index 05e1b11..c56de80 100644 --- a/src/components/IconGrid/InfoPanel.tsx +++ b/src/components/IconGrid/InfoPanel.tsx @@ -45,15 +45,18 @@ const InfoPanel: React.FC = (props) => { const ref = useRef(null); const snippets = { - html: ``, + html: + weight === "duotone" + ? "This weight is not yet supported" + : ``, react: `<${Icon.displayName} size={${size}} ${ color !== "#000000" ? `color="${color}" ` : "" }${weight === "regular" ? "" : `weight="${weight}" `}/>`, vue: `` + }${weight === "regular" ? "" : `weight="${weight}" `}/>`, }; const handleCopySnippet = ( @@ -101,22 +104,6 @@ const InfoPanel: React.FC = (props) => {
-
- HTML/CSS -
-            {snippets.html}
-            
-          
-
React
@@ -149,13 +136,33 @@ const InfoPanel: React.FC = (props) => {
             
           
+
+ HTML/CSS +
+            {snippets.html}
+            
+          
+