mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Created basic tests
This commit is contained in:
@ -83,6 +83,7 @@ const Button: React.FC<Props> = ({
|
||||
size={StyleConstants.Font.Size[size] * (size === 'M' ? 1 : 1.5)}
|
||||
color={colorContent}
|
||||
style={{ opacity: loading ? 0 : 1 }}
|
||||
testID='icon'
|
||||
/>
|
||||
{loading && loadingSpinkit}
|
||||
</>
|
||||
@ -101,6 +102,7 @@ const Button: React.FC<Props> = ({
|
||||
opacity: loading ? 0 : 1
|
||||
}}
|
||||
children={content}
|
||||
testID='text'
|
||||
/>
|
||||
{loading && loadingSpinkit}
|
||||
</>
|
||||
@ -136,8 +138,6 @@ const Button: React.FC<Props> = ({
|
||||
|
||||
return (
|
||||
<Pressable
|
||||
{...(!disabled && !loading && { onPress })}
|
||||
children={children}
|
||||
style={[
|
||||
styles.button,
|
||||
{
|
||||
@ -150,6 +150,10 @@ const Button: React.FC<Props> = ({
|
||||
},
|
||||
customStyle
|
||||
]}
|
||||
testID='base'
|
||||
onPress={onPress}
|
||||
children={children}
|
||||
disabled={disabled || loading}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
@ -20,18 +20,17 @@ export interface Props {
|
||||
onPress?: () => void
|
||||
}
|
||||
|
||||
const Core: React.FC<Props> = ({
|
||||
const MenuRow: React.FC<Props> = ({
|
||||
iconFront,
|
||||
iconFrontColor,
|
||||
iconFrontColor = 'primary',
|
||||
title,
|
||||
content,
|
||||
iconBack,
|
||||
iconBackColor,
|
||||
loading = false
|
||||
iconBackColor = 'secondary',
|
||||
loading = false,
|
||||
onPress
|
||||
}) => {
|
||||
const { theme } = useTheme()
|
||||
iconFrontColor = iconFrontColor || 'primary'
|
||||
iconBackColor = iconBackColor || 'secondary'
|
||||
|
||||
const loadingSpinkit = useMemo(
|
||||
() => (
|
||||
@ -45,64 +44,63 @@ const Core: React.FC<Props> = ({
|
||||
[theme]
|
||||
)
|
||||
|
||||
return (
|
||||
<View style={styles.core}>
|
||||
<View style={styles.front}>
|
||||
{iconFront && (
|
||||
<Feather
|
||||
name={iconFront}
|
||||
size={StyleConstants.Font.Size.M + 2}
|
||||
color={theme[iconFrontColor]}
|
||||
style={styles.iconFront}
|
||||
/>
|
||||
)}
|
||||
<Text style={[styles.text, { color: theme.primary }]} numberOfLines={1}>
|
||||
{title}
|
||||
</Text>
|
||||
</View>
|
||||
{(content || iconBack) && (
|
||||
<View style={styles.back}>
|
||||
{content && content.length ? (
|
||||
<>
|
||||
<Text
|
||||
style={[
|
||||
styles.content,
|
||||
{
|
||||
color: theme.secondary,
|
||||
opacity: !iconBack && loading ? 0 : 1
|
||||
}
|
||||
]}
|
||||
numberOfLines={1}
|
||||
>
|
||||
{content}
|
||||
</Text>
|
||||
{loading && !iconBack && loadingSpinkit}
|
||||
</>
|
||||
) : null}
|
||||
{iconBack && (
|
||||
<>
|
||||
<Feather
|
||||
name={iconBack}
|
||||
size={StyleConstants.Font.Size.M + 2}
|
||||
color={theme[iconBackColor]}
|
||||
style={[styles.iconBack, { opacity: loading ? 0 : 1 }]}
|
||||
/>
|
||||
{loading && loadingSpinkit}
|
||||
</>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
const MenuRow: React.FC<Props> = ({ ...props }) => {
|
||||
return (
|
||||
<Pressable
|
||||
style={styles.base}
|
||||
{...(!props.loading && props.onPress && { onPress: props.onPress })}
|
||||
onPress={onPress}
|
||||
disabled={loading}
|
||||
testID='base'
|
||||
>
|
||||
<Core {...props} />
|
||||
<View style={styles.core}>
|
||||
<View style={styles.front}>
|
||||
{iconFront && (
|
||||
<Feather
|
||||
name={iconFront}
|
||||
size={StyleConstants.Font.Size.M + 2}
|
||||
color={theme[iconFrontColor]}
|
||||
style={styles.iconFront}
|
||||
/>
|
||||
)}
|
||||
<Text
|
||||
style={[styles.text, { color: theme.primary }]}
|
||||
numberOfLines={1}
|
||||
>
|
||||
{title}
|
||||
</Text>
|
||||
</View>
|
||||
{(content || iconBack) && (
|
||||
<View style={styles.back}>
|
||||
{content && content.length ? (
|
||||
<>
|
||||
<Text
|
||||
style={[
|
||||
styles.content,
|
||||
{
|
||||
color: theme.secondary,
|
||||
opacity: !iconBack && loading ? 0 : 1
|
||||
}
|
||||
]}
|
||||
numberOfLines={1}
|
||||
>
|
||||
{content}
|
||||
</Text>
|
||||
{loading && !iconBack && loadingSpinkit}
|
||||
</>
|
||||
) : null}
|
||||
{iconBack && (
|
||||
<>
|
||||
<Feather
|
||||
name={iconBack}
|
||||
size={StyleConstants.Font.Size.M + 2}
|
||||
color={theme[iconBackColor]}
|
||||
style={[styles.iconBack, { opacity: loading ? 0 : 1 }]}
|
||||
/>
|
||||
{loading && loadingSpinkit}
|
||||
</>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ const renderNode = ({
|
||||
|
||||
export interface Props {
|
||||
content: string
|
||||
size: 'M' | 'L'
|
||||
size?: 'M' | 'L'
|
||||
emojis?: Mastodon.Emoji[]
|
||||
mentions?: Mastodon.Mention[]
|
||||
showFullLink?: boolean
|
||||
@ -114,7 +114,7 @@ export interface Props {
|
||||
|
||||
const ParseContent: React.FC<Props> = ({
|
||||
content,
|
||||
size,
|
||||
size = 'M',
|
||||
emojis,
|
||||
mentions,
|
||||
showFullLink = false,
|
||||
|
@ -54,7 +54,7 @@ const TimelineDefault: React.FC<Props> = ({
|
||||
[]
|
||||
)
|
||||
return (
|
||||
<Pressable style={styles.statusView} onPress={onPress}>
|
||||
<Pressable style={styles.statusView} onPress={onPress} disabled={true}>
|
||||
{item.reblog ? (
|
||||
<TimelineActioned action='reblog' account={item.account} />
|
||||
) : pinnedLength && index < pinnedLength ? (
|
||||
|
Reference in New Issue
Block a user