mirror of
https://github.com/zadam/trilium.git
synced 2025-11-30 04:24:24 +01:00
feat(quick_edit): seamless transition between color changes
This commit is contained in:
parent
81a9e06b23
commit
453349be26
@ -38,7 +38,7 @@ function createClassForColor(colorString: string | null) {
|
|||||||
registeredClasses.add(className);
|
registeredClasses.add(className);
|
||||||
}
|
}
|
||||||
|
|
||||||
return className;
|
return `color ${className}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseColor(color: string) {
|
function parseColor(color: string) {
|
||||||
|
|||||||
@ -300,7 +300,7 @@ body .todo-list input[type="checkbox"]:not(:checked):before {
|
|||||||
border-color: var(--muted-text-color) !important;
|
border-color: var(--muted-text-color) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tinted-quick-edit-dialog {
|
.quick-edit-dialog-wrapper.color {
|
||||||
--modal-background-color: hsl(var(--custom-color-hue), 8.8%, 11.2%);
|
--modal-background-color: hsl(var(--custom-color-hue), 8.8%, 11.2%);
|
||||||
--modal-border-color: hsl(var(--custom-color-hue), 9.4%, 25.1%);
|
--modal-border-color: hsl(var(--custom-color-hue), 9.4%, 25.1%);
|
||||||
--promoted-attribute-card-background-color: hsl(var(--custom-color-hue), 13.2%, 20.8%);
|
--promoted-attribute-card-background-color: hsl(var(--custom-color-hue), 13.2%, 20.8%);
|
||||||
|
|||||||
@ -276,7 +276,7 @@
|
|||||||
--custom-bg-color: hsl(var(--custom-color-hue), 37%, 89%, 1);
|
--custom-bg-color: hsl(var(--custom-color-hue), 37%, 89%, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tinted-quick-edit-dialog {
|
.quick-edit-dialog-wrapper.color {
|
||||||
--modal-background-color: hsl(var(--custom-color-hue), 56%, 96%);
|
--modal-background-color: hsl(var(--custom-color-hue), 56%, 96%);
|
||||||
--modal-border-color: hsl(var(--custom-color-hue), 33%, 41%);
|
--modal-border-color: hsl(var(--custom-color-hue), 33%, 41%);
|
||||||
--promoted-attribute-card-background-color: hsl(var(--custom-color-hue), 40%, 88%);
|
--promoted-attribute-card-background-color: hsl(var(--custom-color-hue), 40%, 88%);
|
||||||
|
|||||||
@ -89,18 +89,10 @@ export default function PopupEditor() {
|
|||||||
export function DialogWrapper({ children }: { children: ComponentChildren }) {
|
export function DialogWrapper({ children }: { children: ComponentChildren }) {
|
||||||
const { note } = useNoteContext();
|
const { note } = useNoteContext();
|
||||||
const wrapperRef = useRef<HTMLDivElement>(null);
|
const wrapperRef = useRef<HTMLDivElement>(null);
|
||||||
const [ hasTint, setHasTint ] = useState(false);
|
useNoteLabel(note, "color"); // to update color class
|
||||||
const [ color ] = useNoteLabel(note, "color");
|
|
||||||
|
|
||||||
// Apply the tinted-dialog class only if the custom color CSS class specifies a hue
|
|
||||||
useEffect(() => {
|
|
||||||
if (!wrapperRef.current) return;
|
|
||||||
const customHue = getComputedStyle(wrapperRef.current).getPropertyValue("--custom-color-hue");
|
|
||||||
setHasTint(!!customHue);
|
|
||||||
}, [ note, color ]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={wrapperRef} class={`quick-edit-dialog-wrapper ${note?.getColorClass() ?? ""} ${hasTint ? "tinted-quick-edit-dialog" : ""}`}>
|
<div ref={wrapperRef} class={`quick-edit-dialog-wrapper ${note?.getColorClass() ?? ""}`}>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user