From 03cb34fc08b89278cedb6f5697a1e8c26bbdd05c Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Tue, 12 Apr 2022 18:41:03 +0430 Subject: [PATCH] reza fixed compo colors before ShoppingCart --- src/screens/QRContent/Tab/index.js | 83 +++++++++++++++--------------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/src/screens/QRContent/Tab/index.js b/src/screens/QRContent/Tab/index.js index c42b45d..1014f50 100644 --- a/src/screens/QRContent/Tab/index.js +++ b/src/screens/QRContent/Tab/index.js @@ -1,25 +1,29 @@ import React, { useState } from "react"; import { View, Text, TouchableOpacity, Dimensions } from "react-native"; -import tw from "tailwind-rn"; -import Colors from "../../../constants/Colors"; +import { connect } from "react-redux"; + +//components import Voice from "../Content/Voice"; import Video from "../Content/Video"; import PPT from "../Content/PPT"; import PDF from "../Content/PDF"; import Links from "../Content/Links"; -const { width} = Dimensions.get("window"); - //assets +import tw from "tailwind-rn"; +import Colors from "../../../constants/Colors"; + +const { width } = Dimensions.get("window"); + -export default function Tab({ data }) { +function Tab({ data, theme }) { const [dataType, setDataType] = useState("all"); return ( @@ -31,24 +35,19 @@ export default function Tab({ data }) { borderBottomWidth: 1, borderColor: dataType === "all" - ? Colors.theme1.light.blue3 - : Colors.theme1.light.blue5, + ? Colors.theme1[theme].blue3 + : Colors.theme1[theme].blue5, backgroundColor: - dataType === "all" ? Colors.theme1.light.blue3 : "white", + dataType === "all" ? Colors.theme1[theme].blue3 : "white", }, ]} > تمامی محتوا @@ -62,10 +61,10 @@ export default function Tab({ data }) { borderBottomWidth: 1, borderColor: dataType === "voice" - ? Colors.theme1.light.blue3 - : Colors.theme1.light.blue5, + ? Colors.theme1[theme].blue3 + : Colors.theme1[theme].blue5, backgroundColor: - dataType === "voice" ? Colors.theme1.light.blue3 : "white", + dataType === "voice" ? Colors.theme1[theme].blue3 : "white", }, ]} > @@ -74,7 +73,7 @@ export default function Tab({ data }) { fontSize: width / 38, fontFamily: dataType === "voice" ? "bold" : "light", textAlign: "center", - color: Colors.theme1.light.blue5, + color: Colors.theme1[theme].blue5, }} > صوت @@ -88,10 +87,10 @@ export default function Tab({ data }) { borderBottomWidth: 1, borderColor: dataType === "video" - ? Colors.theme1.light.blue3 - : Colors.theme1.light.blue5, + ? Colors.theme1[theme].blue3 + : Colors.theme1[theme].blue5, backgroundColor: - dataType === "video" ? Colors.theme1.light.blue3 : "white", + dataType === "video" ? Colors.theme1[theme].blue3 : "white", }, ]} > @@ -100,7 +99,7 @@ export default function Tab({ data }) { fontSize: width / 38, fontFamily: dataType === "video" ? "bold" : "light", textAlign: "center", - color: Colors.theme1.light.blue5, + color: Colors.theme1[theme].blue5, }} > ویدئو @@ -114,10 +113,10 @@ export default function Tab({ data }) { borderBottomWidth: 1, borderColor: dataType === "pdf" - ? Colors.theme1.light.blue3 - : Colors.theme1.light.blue5, + ? Colors.theme1[theme].blue3 + : Colors.theme1[theme].blue5, backgroundColor: - dataType === "pdf" ? Colors.theme1.light.blue3 : "white", + dataType === "pdf" ? Colors.theme1[theme].blue3 : "white", }, ]} > @@ -126,7 +125,7 @@ export default function Tab({ data }) { fontSize: width / 38, fontFamily: dataType === "pdf" ? "bold" : "light", textAlign: "center", - color: Colors.theme1.light.blue5, + color: Colors.theme1[theme].blue5, }} > پی دی اف @@ -140,10 +139,10 @@ export default function Tab({ data }) { borderBottomWidth: 1, borderColor: dataType === "ppt" - ? Colors.theme1.light.blue3 - : Colors.theme1.light.blue5, + ? Colors.theme1[theme].blue3 + : Colors.theme1[theme].blue5, backgroundColor: - dataType === "ppt" ? Colors.theme1.light.blue3 : "white", + dataType === "ppt" ? Colors.theme1[theme].blue3 : "white", }, ]} > @@ -152,7 +151,7 @@ export default function Tab({ data }) { fontSize: width / 38, fontFamily: dataType === "ppt" ? "bold" : "light", textAlign: "center", - color: Colors.theme1.light.blue5, + color: Colors.theme1[theme].blue5, }} > پاور پوینت @@ -166,10 +165,10 @@ export default function Tab({ data }) { borderBottomWidth: 1, borderColor: dataType === "links" - ? Colors.theme1.light.blue3 - : Colors.theme1.light.blue5, + ? Colors.theme1[theme].blue3 + : Colors.theme1[theme].blue5, backgroundColor: - dataType === "links" ? Colors.theme1.light.blue3 : "white", + dataType === "links" ? Colors.theme1[theme].blue3 : "white", }, ]} > @@ -178,7 +177,7 @@ export default function Tab({ data }) { fontSize: width / 38, fontFamily: dataType === "links" ? "bold" : "light", textAlign: "center", - color: Colors.theme1.light.blue5, + color: Colors.theme1[theme].blue5, }} > لینک ها @@ -188,12 +187,8 @@ export default function Tab({ data }) { {dataType === "all" && ( <> - {data.voice && ( - - )} - {data.video && ( - ); } + +const mapStateToProps = (state) => ({ + theme: state.publicApi.theme, +}); + +export default connect(mapStateToProps)(Tab);