Skip to content

Commit

Permalink
chore: Launchpad Create: factorize ResetAllButton
Browse files Browse the repository at this point in the history
  • Loading branch information
WaDadidou committed Oct 8, 2024
1 parent 19ff13c commit 5ce691f
Showing 1 changed file with 33 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { parse } from "papaparse";
import React, { useEffect, useRef, useState } from "react";
import React, { FC, useEffect, useRef, useState } from "react";
import { useFieldArray, useFormContext } from "react-hook-form";
import { SafeAreaView, TouchableOpacity, View } from "react-native";

Expand Down Expand Up @@ -667,30 +667,7 @@ export const AssetsTab: React.FC = () => {
<SpacerColumn size={2} />
<Separator />
<SpacerColumn size={2} />
<TouchableOpacity
style={{
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
height: 32,
paddingHorizontal: layout.spacing_x2,
borderRadius: 999,
borderWidth: 1,
borderColor: errorColor,
}}
onPress={resetAll}
>
<SVG source={trashSVG} width={16} height={16} />
<SpacerRow size={1} />
<BrandText
style={[
fontSemibold14,
{ color: errorColor, lineHeight: layout.spacing_x2 },
]}
>
Remove all files
</BrandText>
</TouchableOpacity>
<ResetAllButton onPress={resetAll} />
</>
)}
</View>
Expand Down Expand Up @@ -740,3 +717,34 @@ export const AssetsTab: React.FC = () => {
</SafeAreaView>
);
};

const ResetAllButton: FC<{
onPress: () => void;
}> = ({ onPress }) => {
return (
<TouchableOpacity
style={{
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
height: 32,
paddingHorizontal: layout.spacing_x2,
borderRadius: 999,
borderWidth: 1,
borderColor: errorColor,
}}
onPress={onPress}
>
<SVG source={trashSVG} width={16} height={16} />
<SpacerRow size={1} />
<BrandText
style={[
fontSemibold14,
{ color: errorColor, lineHeight: layout.spacing_x2 },
]}
>
Remove all files
</BrandText>
</TouchableOpacity>
);
};

0 comments on commit 5ce691f

Please sign in to comment.