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:
@@ -24,7 +24,7 @@ export type ScrollWrapperProps = {
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export function ScrollWrapper({ children, className }: ScrollWrapperProps) {
|
||||
export const ScrollWrapper = ({ children, className }: ScrollWrapperProps) => {
|
||||
const scrollableRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useListenScroll({
|
||||
@@ -38,4 +38,4 @@ export function ScrollWrapper({ children, className }: ScrollWrapperProps) {
|
||||
</StyledScrollWrapper>
|
||||
</ScrollWrapperContext.Provider>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,11 +4,11 @@ import { useRecoilCallback } from 'recoil';
|
||||
|
||||
import { isScrollingState } from '../states/isScrollingState';
|
||||
|
||||
export function useListenScroll<T extends Element>({
|
||||
export const useListenScroll = <T extends Element>({
|
||||
scrollableRef,
|
||||
}: {
|
||||
scrollableRef: React.RefObject<T>;
|
||||
}) {
|
||||
}) => {
|
||||
const hideScrollBarsCallback = useRecoilCallback(({ snapshot }) => () => {
|
||||
const isScrolling = snapshot.getLoadable(isScrollingState).getValue();
|
||||
if (!isScrolling) {
|
||||
@@ -42,4 +42,4 @@ export function useListenScroll<T extends Element>({
|
||||
handleScrollEnd,
|
||||
scrollableRef,
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useContext } from 'react';
|
||||
|
||||
import { ScrollWrapperContext } from '../components/ScrollWrapper';
|
||||
|
||||
export function useScrollWrapperScopedRef() {
|
||||
export const useScrollWrapperScopedRef = () => {
|
||||
const scrollWrapperRef = useContext(ScrollWrapperContext);
|
||||
|
||||
if (!scrollWrapperRef)
|
||||
@@ -11,4 +11,4 @@ export function useScrollWrapperScopedRef() {
|
||||
);
|
||||
|
||||
return scrollWrapperRef;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user