mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix: more random fixes related to incorrect parsing svg-icon content, added static Icon.isSvg(content: string)
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
5b88f23a5f
commit
81560d5357
@ -25,7 +25,7 @@ interface Props<T extends CatalogEntity> {
|
|||||||
@observer
|
@observer
|
||||||
export class CatalogEntityDetails<T extends CatalogEntity> extends Component<Props<T>> {
|
export class CatalogEntityDetails<T extends CatalogEntity> extends Component<Props<T>> {
|
||||||
categoryIcon(category: CatalogCategory) {
|
categoryIcon(category: CatalogCategory) {
|
||||||
if (category.metadata.icon.includes("<svg")) {
|
if (Icon.isSvg(category.metadata.icon)) {
|
||||||
return <Icon svg={category.metadata.icon} smallest />;
|
return <Icon svg={category.metadata.icon} smallest />;
|
||||||
} else {
|
} else {
|
||||||
return <Icon material={category.metadata.icon} smallest />;
|
return <Icon material={category.metadata.icon} smallest />;
|
||||||
|
|||||||
@ -65,7 +65,7 @@ export class CatalogEntityDrawerMenu<T extends CatalogEntity> extends React.Comp
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const key = menuItem.icon.includes("<svg") ? "svg" : "material";
|
const key = Icon.isSvg(menuItem.icon) ? "svg" : "material";
|
||||||
|
|
||||||
items.push(
|
items.push(
|
||||||
<MenuItem key={menuItem.title} onClick={() => this.onMenuItemClick(menuItem)}>
|
<MenuItem key={menuItem.title} onClick={() => this.onMenuItemClick(menuItem)}>
|
||||||
|
|||||||
@ -28,7 +28,7 @@ function getCategoryIcon(category: CatalogCategory) {
|
|||||||
const { icon } = category.metadata ?? {};
|
const { icon } = category.metadata ?? {};
|
||||||
|
|
||||||
if (typeof icon === "string") {
|
if (typeof icon === "string") {
|
||||||
return icon.includes("<svg")
|
return Icon.isSvg(icon)
|
||||||
? <Icon small svg={icon}/>
|
? <Icon small svg={icon}/>
|
||||||
: <Icon small material={icon}/>;
|
: <Icon small material={icon}/>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,7 +47,7 @@ export class HotbarEntityIcon extends React.Component<Props> {
|
|||||||
return <Icon material="bug_report" className={className} />;
|
return <Icon material="bug_report" className={className} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (category.metadata.icon.includes("svg+xml")) {
|
if (Icon.isSvg(category.metadata.icon)) {
|
||||||
return <Icon svg={category.metadata.icon} className={className} />;
|
return <Icon svg={category.metadata.icon} className={className} />;
|
||||||
} else {
|
} else {
|
||||||
return <Icon material={category.metadata.icon} className={className} />;
|
return <Icon material={category.metadata.icon} className={className} />;
|
||||||
|
|||||||
@ -37,6 +37,10 @@ export class Icon extends React.PureComponent<IconProps> {
|
|||||||
focusable: true,
|
focusable: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static isSvg(content: string){
|
||||||
|
return String(content).includes("svg+xml"); // data-url for raw svg-icon
|
||||||
|
}
|
||||||
|
|
||||||
get isInteractive() {
|
get isInteractive() {
|
||||||
const { interactive, onClick, href, link } = this.props;
|
const { interactive, onClick, href, link } = this.props;
|
||||||
|
|
||||||
|
|||||||
@ -33,8 +33,8 @@ export function createDevServer(lensProxyPort: number): WebpackDevServer {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
client: {
|
client: {
|
||||||
// don't show warnings and errors on top of rendered app view
|
overlay: false, // don't show warnings and errors on top of rendered app view
|
||||||
overlay: false,
|
logging: "error",
|
||||||
},
|
},
|
||||||
}, compiler);
|
}, compiler);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user