-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28abf73
commit 9a15f76
Showing
40 changed files
with
708 additions
and
401 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Box, Flex } from '@radix-ui/themes' | ||
import { PropsWithChildren, ReactNode } from 'react' | ||
import { PageHeading } from './PageHeading' | ||
|
||
interface ViewProps { | ||
title: string | ||
actions: ReactNode | ||
loading?: boolean | ||
} | ||
|
||
export function View({ | ||
title, | ||
actions, | ||
loading = false, | ||
children, | ||
}: PropsWithChildren<ViewProps>) { | ||
return ( | ||
<Flex direction="column" overflow="hidden" width="100%" height="100%"> | ||
<PageHeading text={title}>{actions}</PageHeading> | ||
{loading ? <Box p="2">Loading...</Box> : children} | ||
</Flex> | ||
) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { useEffect, useRef } from 'react' | ||
|
||
export function useAutoScroll(items: unknown) { | ||
export function useAutoScroll(items: unknown, enabled = true) { | ||
const bottomRef = useRef<HTMLDivElement>(null) | ||
|
||
useEffect(() => { | ||
if (!bottomRef.current) return | ||
if (!bottomRef.current || !enabled) return | ||
|
||
bottomRef.current.scrollIntoView({ behavior: 'smooth', block: 'end' }) | ||
}, [items]) | ||
}, [items, enabled]) | ||
|
||
return bottomRef | ||
} |
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
Oops, something went wrong.