generated from nim-od/softeer-mono-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from softeerbootcamp4th/TASK-158
[Feature][Task-158] UX 개선 & 빌드 용량 축소
- Loading branch information
Showing
36 changed files
with
291 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,8 @@ | |
|
||
#!.yarn/cache | ||
.pnp.* | ||
.env | ||
.env | ||
|
||
|
||
# build 결과 시각화 | ||
**/*/stats.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
import { PropsWithChildren } from 'react'; | ||
|
||
export default function ChatList({ children }: PropsWithChildren) { | ||
return ( | ||
<div className="flex flex-col-reverse justify-end gap-8 px-[26px]"> | ||
{children} | ||
</div> | ||
); | ||
return <div className="flex flex-col-reverse justify-end gap-8 px-[26px]">{children}</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { cn } from '@softeer/common/utils'; | ||
import React, { FunctionComponent, Suspense } from 'react'; | ||
import useIntersectionObserver from 'src/hooks/useIntersectionObserver.ts'; | ||
|
||
interface InViewLoadSectionProps { | ||
component: FunctionComponent | React.LazyExoticComponent<FunctionComponent>; | ||
className?: string; | ||
} | ||
|
||
function InViewLoadSection<T extends HTMLElement>({ | ||
component: Component, | ||
className = '', | ||
}: InViewLoadSectionProps) { | ||
const [ref, isIntersecting] = useIntersectionObserver<T>(); | ||
|
||
return ( | ||
<div ref={ref as React.RefObject<HTMLDivElement>} className={cn('min-h-[500px]', className)}> | ||
{isIntersecting && ( | ||
<Suspense fallback={null}> | ||
<Component /> | ||
</Suspense> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
export default InViewLoadSection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,5 +86,5 @@ export { | |
ToastProvider, | ||
ToastViewport, | ||
type ToastActionElement, | ||
type ToastProps | ||
type ToastProps, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
import { BlockedChat, ChatProps, Message, Notice } from '@softeer/common/components'; | ||
import { FunctionComponent, useCallback } from 'react'; | ||
import InViewLoadSection from 'src/components/common/InViewLoadSection.tsx'; | ||
import useAuth from 'src/hooks/useAuth.tsx'; | ||
|
||
export default function Chat({ type, user, message }: ChatProps) { | ||
const { user: me } = useAuth(); | ||
|
||
switch (type) { | ||
case 'notice': | ||
return <Notice>{message}</Notice>; | ||
case 'blocked': | ||
return <BlockedChat />; | ||
case 'message': | ||
return ( | ||
<Message user={user} isMyMessage={me?.id === user.id}> | ||
{message} | ||
</Message> | ||
); | ||
default: | ||
return null; | ||
} | ||
const render: FunctionComponent = useCallback(() => { | ||
switch (type) { | ||
case 'notice': | ||
return <Notice>{message}</Notice>; | ||
case 'blocked': | ||
return <BlockedChat />; | ||
case 'message': | ||
default: | ||
return ( | ||
<Message user={user} isMyMessage={me?.id === user.id}> | ||
{message} | ||
</Message> | ||
); | ||
} | ||
}, [type, user, message]); | ||
|
||
return <InViewLoadSection className="min-h-[30px]" component={render} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
packages/user/src/components/layout/banner/ScrollToQuizButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const SECTION_ID = { | ||
QUIZ: 'quiz-section', | ||
HERO: 'hero-section', | ||
} as const; | ||
|
||
export default SECTION_ID; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { MutableRefObject, useEffect, useRef, useState } from 'react'; | ||
|
||
interface IntersectionObserverOptions { | ||
root?: Element | null; | ||
rootMargin?: string; | ||
threshold?: number | number[]; | ||
} | ||
|
||
const useIntersectionObserver = <T extends Element>( | ||
options?: IntersectionObserverOptions, | ||
): [MutableRefObject<T | null>, boolean] => { | ||
const targetRef = useRef<T | null>(null); | ||
const [isIntersecting, setIsIntersecting] = useState(false); | ||
|
||
useEffect(() => { | ||
const observer = new IntersectionObserver((entries, thisObserver) => { | ||
entries.forEach((entry) => { | ||
if (entry.isIntersecting) { | ||
setIsIntersecting(true); | ||
thisObserver.disconnect(); | ||
} | ||
}); | ||
}, options); | ||
|
||
if (targetRef.current) { | ||
observer.observe(targetRef.current); | ||
} | ||
|
||
return () => { | ||
if (targetRef.current) { | ||
observer.unobserve(targetRef.current); | ||
} | ||
}; | ||
}, [options]); | ||
|
||
return [targetRef, isIntersecting]; | ||
}; | ||
|
||
export default useIntersectionObserver; |
Oops, something went wrong.