mirror of
https://github.com/mue/mue.git
synced 2026-07-19 15:04:11 +02:00
feat: enhance click handling for color inputs and update event bus cleanup
This commit is contained in:
@@ -141,7 +141,7 @@ const Greeting = () => {
|
||||
|
||||
EventBus.on('refresh', handleRefresh);
|
||||
return () => {
|
||||
EventBus.off('refresh');
|
||||
EventBus.off('refresh', handleRefresh);
|
||||
if (timerRef.current) {
|
||||
clearTimeout(timerRef.current);
|
||||
}
|
||||
|
||||
@@ -273,12 +273,12 @@ const GreetingOptions = ({ currentSubSection, onSubSectionChange, sectionName })
|
||||
name="greetingFontWeight"
|
||||
category="greeting"
|
||||
items={[
|
||||
{ value: '400', text: t(fontWeight + '.normal') },
|
||||
{ value: '600', text: t(fontWeight + '.semi_bold') },
|
||||
{ value: '100', text: t(fontWeight + '.thin') },
|
||||
{ value: '200', text: t(fontWeight + '.extra_light') },
|
||||
{ value: '300', text: t(fontWeight + '.light') },
|
||||
{ value: '400', text: t(fontWeight + '.normal') },
|
||||
{ value: '500', text: t(fontWeight + '.medium') },
|
||||
{ value: '600', text: t(fontWeight + '.semi_bold') },
|
||||
{ value: '700', text: t(fontWeight + '.bold') },
|
||||
{ value: '800', text: t(fontWeight + '.extra_bold') },
|
||||
]}
|
||||
|
||||
@@ -26,7 +26,7 @@ const Message = () => {
|
||||
|
||||
EventBus.on('refresh', handleRefresh);
|
||||
return () => {
|
||||
EventBus.off('refresh');
|
||||
EventBus.off('refresh', handleRefresh);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ const Widgets = () => {
|
||||
|
||||
EventBus.on('refresh', handleRefresh);
|
||||
return () => {
|
||||
EventBus.off('refresh');
|
||||
EventBus.off('refresh', handleRefresh);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ const Navbar = ({ openModal }) => {
|
||||
|
||||
EventBus.on('refresh', handleRefresh);
|
||||
return () => {
|
||||
EventBus.off('refresh');
|
||||
EventBus.off('refresh', handleRefresh);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ const Notes = ({ notesRef, floatRef, position, xPosition, yPosition }) => {
|
||||
|
||||
EventBus.on('refresh', handleRefresh);
|
||||
return () => {
|
||||
EventBus.off('refresh');
|
||||
EventBus.off('refresh', handleRefresh);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -232,12 +232,12 @@ const QuoteOptions = ({ currentSubSection, onSubSectionChange, sectionName }) =>
|
||||
name="quoteFontWeight"
|
||||
category="quote"
|
||||
items={[
|
||||
{ value: '400', text: t(fontWeight + '.normal') },
|
||||
{ value: '600', text: t(fontWeight + '.semi_bold') },
|
||||
{ value: '100', text: t(fontWeight + '.thin') },
|
||||
{ value: '200', text: t(fontWeight + '.extra_light') },
|
||||
{ value: '300', text: t(fontWeight + '.light') },
|
||||
{ value: '400', text: t(fontWeight + '.normal') },
|
||||
{ value: '500', text: t(fontWeight + '.medium') },
|
||||
{ value: '600', text: t(fontWeight + '.semi_bold') },
|
||||
{ value: '700', text: t(fontWeight + '.bold') },
|
||||
{ value: '800', text: t(fontWeight + '.extra_bold') },
|
||||
]}
|
||||
|
||||
@@ -81,11 +81,16 @@ function Search() {
|
||||
}
|
||||
}
|
||||
|
||||
EventBus.on('refresh', (data) => {
|
||||
const handleRefresh = (data) => {
|
||||
if (data === 'search') {
|
||||
init();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
EventBus.on('refresh', handleRefresh);
|
||||
return () => {
|
||||
EventBus.off('refresh', handleRefresh);
|
||||
};
|
||||
}, [init]);
|
||||
|
||||
function searchButton(e) {
|
||||
|
||||
@@ -54,7 +54,7 @@ const Autocomplete = ({
|
||||
|
||||
EventBus.on('refresh', handleRefresh);
|
||||
return () => {
|
||||
EventBus.off('refresh');
|
||||
EventBus.off('refresh', handleRefresh);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ const Clock = () => {
|
||||
|
||||
EventBus.on('refresh', handleRefresh);
|
||||
return () => {
|
||||
EventBus.off('refresh');
|
||||
EventBus.off('refresh', handleRefresh);
|
||||
if (timerRef.current) {
|
||||
clearTimeout(timerRef.current);
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ const DateWidget = () => {
|
||||
|
||||
EventBus.on('refresh', handleRefresh);
|
||||
return () => {
|
||||
EventBus.off('refresh');
|
||||
EventBus.off('refresh', handleRefresh);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -253,12 +253,12 @@ const TimeOptions = ({ currentSubSection, onSubSectionChange, sectionName }) =>
|
||||
name="clockFontWeight"
|
||||
category="clock"
|
||||
items={[
|
||||
{ value: '400', text: t(fontWeight + '.normal') },
|
||||
{ value: '600', text: t(fontWeight + '.semi_bold') },
|
||||
{ value: '100', text: t(fontWeight + '.thin') },
|
||||
{ value: '200', text: t(fontWeight + '.extra_light') },
|
||||
{ value: '300', text: t(fontWeight + '.light') },
|
||||
{ value: '400', text: t(fontWeight + '.normal') },
|
||||
{ value: '500', text: t(fontWeight + '.medium') },
|
||||
{ value: '600', text: t(fontWeight + '.semi_bold') },
|
||||
{ value: '700', text: t(fontWeight + '.bold') },
|
||||
{ value: '800', text: t(fontWeight + '.extra_bold') },
|
||||
]}
|
||||
|
||||
Reference in New Issue
Block a user