Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fea: implement skeleton ui #51

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions src/app/(main)/ticker/_components/ticker-drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export const TickerDrawer = React.memo(
handleDeleteClick,
handleConfirmClick,
}: TickerDrawerProps) => {
const debouncedTickerName = useDebounce(tickerName, 1000); // 디바운스 적용
const { data } = useFilteredStocksQuery(debouncedTickerName);
const debouncedTickerName = useDebounce(tickerName, 400); // 디바운스 적용
const { data, isLoading } = useFilteredStocksQuery(debouncedTickerName);
const isSubmittable = React.useMemo(() => {
return drawerType === "count" && tickerCount > 0;
}, [drawerType, tickerCount]);
Expand Down Expand Up @@ -88,8 +88,21 @@ export const TickerDrawer = React.memo(
)}
</DrawerHeader>

{drawerType === "name" && !!data && (
<TickerList data={data} tickerName={tickerName} onClick={handleTickerClick} />
{isLoading ? (
<div className="flex h-full w-full flex-1 flex-col items-start gap-5 overflow-scroll px-5 pt-8">
{Array.from({ length: 10 }, (_, idx) => (
<div className="flex " key={idx}>
<div className="mr-4 h-10 w-10 rounded-full bg-grey-50" />
<div className="flex flex-col">
<div className="mb-1 rounded-sm bg-grey-50" style={{ width: 54, height: 19 }} />
<div className=" rounded-sm bg-grey-50" style={{ width: 220, height: 17 }} />
</div>
</div>
))}
</div>
) : (
drawerType === "name" &&
!!data && <TickerList data={data} tickerName={tickerName} onClick={handleTickerClick} />
)}

{drawerType === "count" && (
Expand Down
3 changes: 3 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,7 @@ body,
input:disabled {
background-color: white;
}
input::placeholder {
color: #b0b8c1;
}
}