parent
53a8e1b0f2
commit
edf3ec383d
@ -1,29 +1,67 @@
|
|||||||
import React, {Component} from "react";
|
import React, {Component} from "react";
|
||||||
import {View, Text, TouchableOpacity, Image} from "react-native";
|
import {View, Text, TouchableOpacity, Image} from "react-native";
|
||||||
import {AntDesign, FontAwesome6} from "@expo/vector-icons";
|
import {
|
||||||
import {AntDesignIconNames} from "./Icons";
|
AntDesign,
|
||||||
|
Entypo,
|
||||||
|
FontAwesome6,
|
||||||
|
MaterialCommunityIcons,
|
||||||
|
} from "@expo/vector-icons";
|
||||||
|
import {
|
||||||
|
AntDesignIconNames,
|
||||||
|
CommunityIconNames,
|
||||||
|
EntypoIconNames,
|
||||||
|
FontAwesomeIconNames,
|
||||||
|
} from "./Icons";
|
||||||
|
|
||||||
interface CheckButtonProps {
|
interface CheckButtonProps {
|
||||||
label: string;
|
label: string;
|
||||||
value: boolean;
|
value: boolean;
|
||||||
onChange: () => void;
|
onChange: () => void;
|
||||||
icon: AntDesignIconNames | string;
|
antIcon?: AntDesignIconNames;
|
||||||
|
entypoIcon?: EntypoIconNames;
|
||||||
|
fontAwesomeIcon?: FontAwesomeIconNames;
|
||||||
|
communityIcon?: CommunityIconNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CheckButton: React.FC<CheckButtonProps> = ({ label, value, onChange, icon }) => {
|
const CheckButton: React.FC<CheckButtonProps> = ({ label, value, onChange, antIcon,
|
||||||
let AwesomIconList = ["weight-scale", "beer"];
|
entypoIcon,
|
||||||
|
fontAwesomeIcon,
|
||||||
|
communityIcon, }) => {
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity onPress={onChange} className={`p-5 m-1 rounded-3xl ${value ? 'bg-orange-600 border-4 border-orange-300' : 'bg-gray-300 border-4 border-gray-300'} flex-basis-1/3 items-center`}>
|
<View style={{ flexBasis: "33.33%"}}>
|
||||||
<View className="mr-2.5">
|
<TouchableOpacity onPress={onChange} className={`p-5 m-1 rounded-3xl ${value ? 'bg-orange-600 border-4 border-orange-300' : 'bg-gray-300 border-4 border-gray-300'} items-center`}>
|
||||||
{AwesomIconList.includes(icon) ? (
|
{antIcon ? (
|
||||||
<FontAwesome6 name={icon} size={30} color={value ? "white" : "black"}/>
|
<AntDesign
|
||||||
) : (
|
name={antIcon}
|
||||||
<AntDesign name={icon ?? "arrowleft"} size={30} color={value ? "white" : "black"}/>
|
size={30}
|
||||||
)}
|
color={value ? "white" : "black"}
|
||||||
</View>
|
/>
|
||||||
|
) : null}
|
||||||
|
{entypoIcon ? (
|
||||||
|
<Entypo
|
||||||
|
name={entypoIcon}
|
||||||
|
size={30}
|
||||||
|
color={value ? "white" : "black"}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
{communityIcon ? (
|
||||||
|
<MaterialCommunityIcons
|
||||||
|
name={communityIcon}
|
||||||
|
size={30}
|
||||||
|
color={value ? "white" : "black"}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
{fontAwesomeIcon ? (
|
||||||
|
<FontAwesome6
|
||||||
|
name={fontAwesomeIcon}
|
||||||
|
size={30}
|
||||||
|
color={value ? "white" : "black"}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
<Text className={`${value ? 'text-white' : 'text-black'} flex-1`}>{label}</Text>
|
<Text className={`${value ? 'text-white' : 'text-black'}`}>{label}</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in new issue