zotero/scss/components/_item-tree.scss
Abe Jellinek a2f259d14c Use item type CSS icons in more places
.icon-item-type is now global, with extra styling to handle row selection when
it's inside the item tree.

getImageSrc() is still used for progress windows, which is probably OK for now
because those don't stay on screen for very long. I've updated it to return SVGs
based on the current UI color scheme.

Other code uses treeitem-* images directly; getting rid of those references will
cause a lot of conflicts and be a bit more involved than this initial pass, so
I'll put that in a separate PR.
2024-01-24 03:42:43 -05:00

143 lines
2.5 KiB
SCSS

@use "sass:map";
#zotero-items-tree {
.virtualized-table-header .icon {
width: 13px;
height: 13px;
}
.cell.primary {
.retracted {
width: 12px;
margin-inline-start: 3px;
}
.tag-swatch {
display: inline-block;
min-width: .728em;
min-height: .728em;
margin-inline-start: 3px;
border-radius: .15em;
}
}
.cell.hasAttachment {
box-sizing: content-box;
padding: 0 4px;
height: 100%;
// Don't show ellipsis
text-overflow: unset;
.icon-treeitemattachmentpdf {
min-width: 10px;
max-width: 10px;
margin: 3px;
}
.icon-link {
min-width: 14px;
max-width: 14px;
margin: 2px 1px;
}
.icon-missing-file {
opacity: 0.4;
}
}
.cell.numNotes {
text-align: center;
}
}
$-itemTypesIcons: (
artwork,
attachment-epub,
attachment-epub-link,
attachment-file, // mapped to document below
attachment-link,
attachment-pdf-link,
attachment-pdf,
attachment-snapshot,
attachment-web-link,
audio-recording,
bill,
blog-post,
book-section,
book,
case,
computer-program,
conference-paper,
dataset,
dictionary-entry,
document,
email,
encyclopedia-article,
epub,
film,
forum-post,
hearing,
instant-message,
interview,
journal-article,
letter,
magazine-article,
manuscript,
map,
newspaper-article,
note,
patent,
podcast,
preprint,
presentation,
radio-broadcast,
report,
standard,
statute,
thesis,
tv-broadcast,
video-recording,
webpage
);
$-itemTypesMap: (
"attachment-file": "document"
);
.icon-item-type {
width: 16px;
height: 16px;
}
// Due to quirks of the state() mixin, we need two sets of .icon-item-type rules:
// one when the icon is within a virtualized-table, and one when it isn't. We declare
// a mixin here to avoid duplication.
@mixin -icon-item-type-rules($color) {
.icon-item-type {
// default icon, for known item types more specific selectors below will apply
@include svgicon("document", $color, "16", "item-type", true);
}
@each $itemTypeIcon in $-itemTypesIcons {
$itemType: camelCase(str-replace(str-replace($itemTypeIcon, "pdf", "PDF"), "epub", "EPUB"));
@if map.has-key($-itemTypesMap, $itemTypeIcon) {
$itemTypeIcon: map.get($-itemTypesMap, $itemTypeIcon);
}
.icon-item-type[data-item-type=#{$itemType}] {
@include svgicon($itemTypeIcon, $color, "16", "item-type", true);
}
}
}
@include focus-states using($color) {
@include -icon-item-type-rules($color);
}
.virtualized-table .row {
@include focus-states using($color) {
@include -icon-item-type-rules($color);
}
}