Skip to content

Commit

Permalink
chore: 💅 prettier fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zheleznov163 committed Sep 13, 2022
1 parent 93b2528 commit 6850eed
Show file tree
Hide file tree
Showing 9 changed files with 480 additions and 530 deletions.
88 changes: 43 additions & 45 deletions components/atoms/ButtonBack.tsx
Original file line number Diff line number Diff line change
@@ -1,53 +1,51 @@
import {
StyleProp,
StyleSheet,
Text,
TextStyle,
TouchableOpacity,
View,
ViewStyle,
} from "react-native";
import { useTheme } from "hooks";
import Icon2 from "./Icon2";
import { COLOR } from "utils";
StyleProp,
StyleSheet,
Text,
TextStyle,
TouchableOpacity,
View,
ViewStyle,
} from "react-native"
import { useTheme } from "hooks"
import Icon2 from "./Icon2"
import { COLOR } from "utils"

type ButtonProps = {
onPress?(): void;
style?: StyleProp<ViewStyle>;
text?: string;
stroke?: string;
textStyle?: StyleProp<TextStyle>;
};
onPress?(): void
style?: StyleProp<ViewStyle>
text?: string
stroke?: string
textStyle?: StyleProp<TextStyle>
}

export default ({ onPress, style, text, textStyle, stroke }: ButtonProps) => {
const theme = useTheme();
const theme = useTheme()

return (
<View style={[styles.container, style]}>
<TouchableOpacity onPress={onPress}>
<View style={styles.inner}>
<Icon2 name="chevron_left" size={18} stroke={stroke || COLOR.White} />
<Text style={[styles.text, theme.text.primary, textStyle]}>
{text || "Back"}
</Text>
</View>
</TouchableOpacity>
</View>
);
};
return (
<View style={[styles.container, style]}>
<TouchableOpacity onPress={onPress}>
<View style={styles.inner}>
<Icon2 name="chevron_left" size={18} stroke={stroke || COLOR.White} />
<Text style={[styles.text, theme.text.primary, textStyle]}>{text || "Back"}</Text>
</View>
</TouchableOpacity>
</View>
)
}

const styles = StyleSheet.create({
container: {},
inner: {
flexDirection: "row",
alignItems: "center",
},
text: {
fontFamily: "CircularStd",
fontStyle: "normal",
fontWeight: "500",
fontSize: 16,
lineHeight: 20,
marginLeft: 4,
},
});
container: {},
inner: {
flexDirection: "row",
alignItems: "center",
},
text: {
fontFamily: "CircularStd",
fontStyle: "normal",
fontWeight: "500",
fontSize: 16,
lineHeight: 20,
marginLeft: 4,
},
})
208 changes: 98 additions & 110 deletions components/organisms/ToolbarAction.tsx
Original file line number Diff line number Diff line change
@@ -1,123 +1,111 @@
import { memo, ReactNode } from "react";
import {
StyleProp,
StyleSheet,
Text,
TouchableOpacity,
View,
ViewStyle,
} from "react-native";
import ThemedGradient from "components/atoms/ThemedGradient";
import { COLOR, hexAlpha } from "utils";
import { memo, ReactNode } from "react"
import { StyleProp, StyleSheet, Text, TouchableOpacity, View, ViewStyle } from "react-native"
import ThemedGradient from "components/atoms/ThemedGradient"
import { COLOR, hexAlpha } from "utils"

type Mode = "gradient" | "fill";
type Mode = "gradient" | "fill"

type Props = {
onPress?(): void;
Icon?: JSX.Element;
title?: string;
size?: number;
mode?: Mode;
onPress?(): void
Icon?: JSX.Element
title?: string
size?: number
mode?: Mode

nullContent?: boolean;
nullContent?: boolean

style?: StyleProp<ViewStyle>;
buttonStyle?: StyleProp<ViewStyle>;
iconContainerStyle?: StyleProp<ViewStyle>;
textStyle?: StyleProp<ViewStyle>;
backgroundStyle?: StyleProp<ViewStyle>;
};
style?: StyleProp<ViewStyle>
buttonStyle?: StyleProp<ViewStyle>
iconContainerStyle?: StyleProp<ViewStyle>
textStyle?: StyleProp<ViewStyle>
backgroundStyle?: StyleProp<ViewStyle>
}

export default memo(
({
Icon,
onPress,
title,
size = 52,
mode = "fill",
({
Icon,
onPress,
title,
size = 52,
mode = "fill",

nullContent,
nullContent,

style,
buttonStyle,
textStyle,
iconContainerStyle,
backgroundStyle,
}: Props) => {
const sizeStyle: ViewStyle = {
width: size,
height: size,
};
style,
buttonStyle,
textStyle,
iconContainerStyle,
backgroundStyle,
}: Props) => {
const sizeStyle: ViewStyle = {
width: size,
height: size,
}

const Background = mode === "gradient" ? ThemedGradient : View;
const itemStyles = [styles.container, style]
if(onPress == undefined) itemStyles.push(styles.disabled)
return (
<View style={itemStyles}>
{nullContent ? (
<>
<View style={[styles.button, sizeStyle]} />
<View style={{ height: styles.text.lineHeight }} />
</>
) : (
<>
<TouchableOpacity onPress={onPress} disabled={onPress == undefined}>
<View style={[styles.button, sizeStyle, buttonStyle]}>
<Background
style={[
styles.gradient,
mode === "fill" && styles.fill_color,
backgroundStyle,
]}
>
<View style={[styles.gradient_inner, iconContainerStyle]}>
{Icon}
</View>
</Background>
</View>
</TouchableOpacity>
<Text style={[styles.text, textStyle]}>{title}</Text>
</>
)}
</View>
);
}
);
const Background = mode === "gradient" ? ThemedGradient : View
const itemStyles = [styles.container, style]
if (onPress == undefined) itemStyles.push(styles.disabled)
return (
<View style={itemStyles}>
{nullContent ? (
<>
<View style={[styles.button, sizeStyle]} />
<View style={{ height: styles.text.lineHeight }} />
</>
) : (
<>
<TouchableOpacity onPress={onPress} disabled={onPress == undefined}>
<View style={[styles.button, sizeStyle, buttonStyle]}>
<Background
style={[styles.gradient, mode === "fill" && styles.fill_color, backgroundStyle]}
>
<View style={[styles.gradient_inner, iconContainerStyle]}>{Icon}</View>
</Background>
</View>
</TouchableOpacity>
<Text style={[styles.text, textStyle]}>{title}</Text>
</>
)}
</View>
)
},
)

const styles = StyleSheet.create({
container: {
justifyContent: "center",
alignItems: "center",
},
disabled: {
opacity:0.2,
},
button: {
marginBottom: 16,
borderRadius: 50,
overflow: "hidden",
},
container: {
justifyContent: "center",
alignItems: "center",
backgroundColor: "red",
},
disabled: {
opacity: 0.2,
},
button: {
marginBottom: 16,
borderRadius: 50,
overflow: "hidden",
},

fill_color: {
backgroundColor: hexAlpha(COLOR.White, 10),
},
gradient: {
width: "100%",
height: "100%",
padding: 2,
},
gradient_inner: {
flex: 1,
justifyContent: "center",
alignItems: "center",
borderRadius: 50,
},
text: {
fontFamily: "CircularStd",
fontStyle: "normal",
fontWeight: "500",
fontSize: 13,
lineHeight: 16,
color: COLOR.White,
},
});
fill_color: {
backgroundColor: hexAlpha(COLOR.White, 10),
},
gradient: {
width: "100%",
height: "100%",
padding: 2,
},
gradient_inner: {
flex: 1,
justifyContent: "center",
alignItems: "center",
borderRadius: 50,
},
text: {
fontFamily: "CircularStd",
fontStyle: "normal",
fontWeight: "500",
fontSize: 13,
lineHeight: 16,
color: COLOR.White,
},
})
Loading

0 comments on commit 6850eed

Please sign in to comment.