Change to using arrow functions (#1603)
* Change to using arrow functions Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add lint rule --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -8,7 +8,7 @@ import {
|
||||
useUpdateUserMutation,
|
||||
} from '~/generated/graphql';
|
||||
|
||||
export function useColorScheme() {
|
||||
export const useColorScheme = () => {
|
||||
const [currentUser, setCurrentUser] = useRecoilState(currentUserState);
|
||||
|
||||
const [updateUser] = useUpdateUserMutation();
|
||||
@ -106,4 +106,4 @@ export function useColorScheme() {
|
||||
colorScheme,
|
||||
setColorScheme,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@ -4,7 +4,7 @@ import { ColorScheme } from '~/generated/graphql';
|
||||
|
||||
type SystemColorScheme = ColorScheme.Light | ColorScheme.Dark;
|
||||
|
||||
export function useSystemColorScheme(): SystemColorScheme {
|
||||
export const useSystemColorScheme = (): SystemColorScheme => {
|
||||
const mediaQuery = useMemo(
|
||||
() => window.matchMedia('(prefers-color-scheme: dark)'),
|
||||
[],
|
||||
@ -22,11 +22,11 @@ export function useSystemColorScheme(): SystemColorScheme {
|
||||
return;
|
||||
}
|
||||
|
||||
function handleChange(event: MediaQueryListEvent): void {
|
||||
const handleChange = (event: MediaQueryListEvent): void => {
|
||||
setPreferredColorScheme(
|
||||
event.matches ? ColorScheme.Dark : ColorScheme.Light,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
mediaQuery.addEventListener('change', handleChange);
|
||||
|
||||
@ -36,4 +36,4 @@ export function useSystemColorScheme(): SystemColorScheme {
|
||||
}, [mediaQuery]);
|
||||
|
||||
return preferredColorScheme;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user