-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Gavin Kasdorf <[email protected]> Co-authored-by: Gavin Kasdorf <[email protected]>
- Loading branch information
1 parent
56d20a7
commit 8396051
Showing
8 changed files
with
353 additions
and
19 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from "react"; | ||
import { useThemeOptions } from "@src/stores/settings/settingsStore"; | ||
import { Fab } from "@src/components/common/Gluestack"; | ||
import { ICON_MAP } from "@src/constants/IconMap"; | ||
import { SFIcon } from "@src/components/common/icons/SFIcon"; | ||
|
||
interface IProps { | ||
onPress: () => void; | ||
onLongPress: () => void; | ||
} | ||
|
||
function NextCommentFAB({ onPress, onLongPress }: IProps) { | ||
const theme = useThemeOptions(); | ||
|
||
return ( | ||
<Fab | ||
backgroundColor={theme.colors.accent} | ||
p="$2" | ||
onPress={onPress} | ||
onLongPress={onLongPress} | ||
placement="bottom right" | ||
> | ||
<SFIcon icon={ICON_MAP.CHEVRON.DOWN} color="#fff" size={14} /> | ||
</Fab> | ||
); | ||
} | ||
|
||
export default NextCommentFAB; |
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,86 @@ | ||
import React, { useCallback } from "react"; | ||
import { | ||
Divider, | ||
HStack, | ||
Text, | ||
View, | ||
VStack, | ||
} from "@src/components/common/Gluestack"; | ||
import { useThemeOptions } from "@src/stores/settings/settingsStore"; | ||
import { SFIcon } from "@src/components/common/icons/SFIcon"; | ||
import { ICON_MAP } from "@src/constants/IconMap"; | ||
import { Pressable } from "react-native"; | ||
import showAllInChain from "@src/stores/posts/actions/showAllInChain"; | ||
import { useRoute } from "@react-navigation/core"; | ||
|
||
interface IProps { | ||
type: "top" | "children"; | ||
commentId: number; | ||
depth: number; | ||
} | ||
|
||
function ShowMoreButton({ type, commentId, depth }: IProps) { | ||
const theme = useThemeOptions(); | ||
const { postKey } = useRoute<any>().params; | ||
|
||
const onShowMorePress = useCallback(() => { | ||
showAllInChain(postKey, commentId, type); | ||
}, [commentId]); | ||
|
||
return ( | ||
<> | ||
<Pressable onPress={onShowMorePress}> | ||
<VStack | ||
flex={1} | ||
pr="$2" | ||
space="sm" | ||
backgroundColor={theme.colors.fg} | ||
style={{ | ||
paddingLeft: depth * 8, | ||
}} | ||
py="$1" | ||
> | ||
<VStack | ||
borderLeftWidth={depth > 2 ? 2 : 0} | ||
borderLeftColor={ | ||
theme.colors.comments[depth - 2] ?? theme.colors.comments[5] | ||
} | ||
borderTopLeftRadius={1} | ||
borderBottomLeftRadius={1} | ||
pl={depth > 2 ? "$2" : "$0"} | ||
mt="$0" | ||
> | ||
<HStack | ||
space="sm" | ||
justifyContent="space-between" | ||
alignItems="center" | ||
mb={-3} | ||
pb="$2" | ||
> | ||
<Text fontStyle="italic"> | ||
{type === "top" | ||
? "Show more comments..." | ||
: "Show more replies..."} | ||
</Text> | ||
<SFIcon | ||
icon={ICON_MAP.CHEVRON.DOWN} | ||
color={theme.colors.textSecondary} | ||
size={12} | ||
/> | ||
</HStack> | ||
</VStack> | ||
</VStack> | ||
</Pressable> | ||
<View | ||
style={{ | ||
paddingLeft: depth * 12, | ||
}} | ||
backgroundColor={theme.colors.fg} | ||
> | ||
<Divider bg={theme.colors.border} /> | ||
</View> | ||
</> | ||
); | ||
} | ||
|
||
export default ShowMoreButton; |
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.