From abd423d1eec86da4c7746f562eca9dcfcbf2c279 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Thu, 16 Mar 2023 22:20:45 +0900 Subject: [PATCH] fix: fix undefined image url (#92) --- src/console/components/console/CompletionItem.tsx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/console/components/console/CompletionItem.tsx b/src/console/components/console/CompletionItem.tsx index 394af041..415fecb5 100644 --- a/src/console/components/console/CompletionItem.tsx +++ b/src/console/components/console/CompletionItem.tsx @@ -3,10 +3,11 @@ import styled from "../../colorscheme/styled"; const Container = styled.li<{ shown: boolean; - icon: string; + icon?: string; highlight: boolean; }>` - background-image: ${({ icon }) => "url(" + icon + ")"}; + background-image: ${({ icon }) => + typeof icon !== "undefined" ? "url(" + icon + ")" : "unset"}; background-color: ${({ highlight, theme }) => highlight ? theme.completionSelectedBackground @@ -15,7 +16,7 @@ const Container = styled.li<{ highlight ? theme.completionSelectedForeground : theme.completionItemForeground}; - display: ${({ shown }) => (shown ? "display" : "none")}; + display: ${({ shown }) => (shown ? "block" : "none")}; padding-left: 1.8rem; background-position: 0 center; background-size: contain; @@ -47,11 +48,7 @@ interface Props extends React.HTMLAttributes { } const CompletionItem: React.FC = (props) => ( - + {props.primary} {props.secondary}