fix: add ellipsis overflow to tag text on note options

This commit is contained in:
Antonella Sgarlatta
2021-06-03 18:48:04 -03:00
parent bb6f65d8e5
commit 75cefc122e
2 changed files with 21 additions and 9 deletions

View File

@@ -72,11 +72,11 @@ export const NotesOptions = observer(
const buttonRect = tagsButtonRef.current.getBoundingClientRect(); const buttonRect = tagsButtonRef.current.getBoundingClientRect();
const footerHeight = 32; const footerHeight = 32;
if ((buttonRect.top + maxTagsMenuSize) > (clientHeight - footerHeight)) { if (buttonRect.top + maxTagsMenuSize > clientHeight - footerHeight) {
setTagsMenuMaxHeight(clientHeight - buttonRect.top - footerHeight - 2); setTagsMenuMaxHeight(clientHeight - buttonRect.top - footerHeight - 2);
} }
if ((buttonRect.right + maxTagsMenuSize) > clientWidth) { if (buttonRect.right + maxTagsMenuSize > clientWidth) {
setTagsMenuPosition({ setTagsMenuPosition({
top: buttonRect.top, top: buttonRect.top,
right: clientWidth - buttonRect.left, right: clientWidth - buttonRect.left,
@@ -88,7 +88,6 @@ export const NotesOptions = observer(
}); });
} }
setTagsMenuOpen(!tagsMenuOpen); setTagsMenuOpen(!tagsMenuOpen);
}; };
@@ -169,7 +168,7 @@ export const NotesOptions = observer(
{appState.tags.tags.map((tag) => ( {appState.tags.tags.map((tag) => (
<button <button
key={tag.title} key={tag.title}
className={`${buttonClass} py-2`} className={`${buttonClass} py-2 max-w-80`}
onBlur={closeOnBlur} onBlur={closeOnBlur}
onClick={() => { onClick={() => {
appState.notes.isTagInSelectedNotes(tag) appState.notes.isTagInSelectedNotes(tag)
@@ -178,11 +177,12 @@ export const NotesOptions = observer(
}} }}
> >
<span <span
className={ className={`whitespace-nowrap overflow-hidden overflow-ellipsis
appState.notes.isTagInSelectedNotes(tag) ${
? 'font-bold' appState.notes.isTagInSelectedNotes(tag)
: '' ? 'font-bold'
} : ''
}`}
> >
{tag.title} {tag.title}
</span> </span>

View File

@@ -171,6 +171,18 @@
align-items: flex-start; align-items: flex-start;
} }
.whitespace-nowrap {
white-space: nowrap;
}
.overflow-hidden {
overflow: hidden;
}
.overflow-ellipsis {
text-overflow: ellipsis;
}
/** /**
* A button that is just an icon. Separated from .sn-button because there * A button that is just an icon. Separated from .sn-button because there
* is almost no style overlap. * is almost no style overlap.