1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

moving entity-icon inside name column / fixes

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2021-11-08 19:08:32 +02:00
parent de6764a7de
commit cef043db8d
3 changed files with 49 additions and 49 deletions

View File

@ -19,21 +19,47 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
.Catalog {} .Catalog {
:global(.TableRow):hover .pinIcon {
display: block;
}
}
.entityName { .entityName {
position: relative; position: relative;
width: min-content; width: 100%;
max-width: 100%; max-width: 100%;
display: flex;
align-items: center;
padding: 0 var(--padding);
padding-bottom: 0;
padding-right: 24px; // + reserved space for .pinIcon
> span {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
padding-right: 24px; padding-left: var(--padding);
}
:global(.HotbarIcon){
align-self: center;
div {
/* icons with plain text */
font-size: var(--unit);
}
.Icon {
/* icons with font-icon */
font-size: var(--small-size);
}
}
.pinIcon { .pinIcon {
position: absolute; position: absolute;
right: 0; right: 0;
opacity: 0;
transition: none; transition: none;
display: none;
&:hover { &:hover {
/* Drop styles defined for <Icon/> */ /* Drop styles defined for <Icon/> */
@ -43,23 +69,6 @@
} }
} }
.iconCell {
padding-top: calc(var(--padding) / 2);
flex: 0 0 40px !important;
:global(.content) {
display: none; /* hide "Icon" text in the header */
}
div * {
font-size: var(--unit); /* icon's with plain text */
}
:global(.Icon) {
font-size: var(--small-size) !important;
}
}
.sourceCell { .sourceCell {
max-width: 100px; max-width: 100px;
} }

View File

@ -212,23 +212,7 @@ export class Catalog extends React.Component<Props> {
const isItemInHotbar = HotbarStore.getInstance().isAddedToActive(item.entity); const isItemInHotbar = HotbarStore.getInstance().isAddedToActive(item.entity);
return ( return (
<div className={styles.entityName}> <>
{item.name}
<Icon
small
className={styles.pinIcon}
material={!isItemInHotbar && "push_pin"}
svg={isItemInHotbar && "push_off"}
tooltip={isItemInHotbar ? "Remove from Hotbar" : "Add to Hotbar"}
onClick={prevDefault(() => isItemInHotbar ? this.removeFromHotbar(item) : this.addToHotbar(item))}
/>
</div>
);
}
renderIcon(item: CatalogEntityItem<CatalogEntity>) {
return (
<RenderDelay>
<HotbarIcon <HotbarIcon
uid={`catalog-icon-${item.getId()}`} uid={`catalog-icon-${item.getId()}`}
title={item.getName()} title={item.getName()}
@ -238,7 +222,16 @@ export class Catalog extends React.Component<Props> {
background={item.entity.spec.icon?.background} background={item.entity.spec.icon?.background}
size={24} size={24}
/> />
</RenderDelay> <span>{item.name}</span>
<Icon
small
className={styles.pinIcon}
material={!isItemInHotbar && "push_pin"}
svg={isItemInHotbar ? "push_off" : "push_pin"}
tooltip={isItemInHotbar ? "Remove from Hotbar" : "Add to Hotbar"}
onClick={prevDefault(() => isItemInHotbar ? this.removeFromHotbar(item) : this.addToHotbar(item))}
/>
</>
); );
} }
@ -268,8 +261,7 @@ export class Catalog extends React.Component<Props> {
entity => entity.searchFields, entity => entity.searchFields,
]} ]}
renderTableHeader={[ renderTableHeader={[
{ title: "Icon", className: styles.iconCell, id: "icon" }, { title: "Name", className: styles.entityName, sortBy: sortBy.name, id: "name" },
{ title: "Name", sortBy: sortBy.name, id: "name" },
!activeCategory && { title: "Kind", sortBy: sortBy.kind, id: "kind" }, !activeCategory && { title: "Kind", sortBy: sortBy.kind, id: "kind" },
{ title: "Source", className: styles.sourceCell, sortBy: sortBy.source, id: "source" }, { title: "Source", className: styles.sourceCell, sortBy: sortBy.source, id: "source" },
{ title: "Labels", className: styles.labelsCell, id: "labels" }, { title: "Labels", className: styles.labelsCell, id: "labels" },
@ -279,7 +271,6 @@ export class Catalog extends React.Component<Props> {
disabled: !item.enabled, disabled: !item.enabled,
})} })}
renderTableContents={item => [ renderTableContents={item => [
this.renderIcon(item),
this.renderName(item), this.renderName(item),
!activeCategory && item.kind, !activeCategory && item.kind,
item.source, item.source,

View File

Before

Width:  |  Height:  |  Size: 959 B

After

Width:  |  Height:  |  Size: 959 B