Skip to content

Commit ded082e

Browse files
thomarnauldclegirar
authored andcommitted
fix: first replace of legacy boxes
1 parent 1d95498 commit ded082e

File tree

10 files changed

+79
-108
lines changed

10 files changed

+79
-108
lines changed

packages/components/Menu.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from "react";
22
import { View, TouchableOpacity } from "react-native";
33

44
import { BrandText } from "./BrandText";
5-
import { LegacyPrimaryBox } from "./boxes/LegacyPrimaryBox";
5+
import { PrimaryBox } from "./boxes/PrimaryBox";
66
import { useDropdowns } from "../hooks/useDropdowns";
77
import { neutral33 } from "../utils/style/colors";
88
import { fontSemibold13 } from "../utils/style/fonts";
@@ -34,11 +34,12 @@ export const Menu: React.FC<MenuProps> = ({
3434
</TouchableOpacity>
3535
{isDropdownOpen && (
3636
<View ref={dropdownRef} collapsable={false}>
37-
<LegacyPrimaryBox
38-
width={width}
39-
style={{ position: "absolute", right: 0, bottom: -20 }}
40-
mainContainerStyle={{
37+
<PrimaryBox
38+
style={{
4139
position: "absolute",
40+
right: 0,
41+
bottom: -20,
42+
width,
4243
paddingHorizontal: layout.spacing_x1_5,
4344
}}
4445
>
@@ -66,7 +67,7 @@ export const Menu: React.FC<MenuProps> = ({
6667
</BrandText>
6768
</TouchableOpacity>
6869
))}
69-
</LegacyPrimaryBox>
70+
</PrimaryBox>
7071
</View>
7172
)}
7273
</View>

packages/components/Pagination.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { StyleSheet, TouchableOpacity, View } from "react-native";
33

44
import { BrandText } from "./BrandText";
55
import { SVG } from "./SVG";
6-
import { LegacySecondaryBox } from "./boxes/LegacySecondaryBox";
76
import { LegacyTertiaryBox } from "./boxes/LegacyTertiaryBox";
7+
import { SecondaryBox } from "./boxes/SecondaryBox";
88
import { SpacerRow } from "./spacer";
99
import chevronDownSVG from "../../assets/icons/chevron-down.svg";
1010
import chevronLeftDoubleSVG from "../../assets/icons/chevron-left-double.svg";
@@ -114,11 +114,12 @@ export const Pagination = ({
114114
</LegacyTertiaryBox>
115115

116116
{isDropdownOpen && (
117-
<LegacySecondaryBox
118-
noBrokenCorners
119-
width={80}
120-
style={{ position: "absolute", top: 46, right: 0 }}
121-
mainContainerStyle={{
117+
<SecondaryBox
118+
style={{
119+
position: "absolute",
120+
top: 46,
121+
right: 0,
122+
width: 80,
122123
paddingHorizontal: layout.spacing_x1_5,
123124
paddingTop: layout.spacing_x1_5,
124125
backgroundColor: neutral33,
@@ -147,7 +148,7 @@ export const Pagination = ({
147148
</BrandText>
148149
</TouchableOpacity>
149150
))}
150-
</LegacySecondaryBox>
151+
</SecondaryBox>
151152
)}
152153
</View>
153154
</View>

packages/components/boxes/Box.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export type BoxStyle = Pick<
5353
| "top"
5454
| "bottom"
5555
| "flex"
56+
| "zIndex"
5657
> & { borderRadius?: number; backgroundColor?: string; borderColor?: string };
5758

5859
export type GradientParams = Omit<LinearGradientProps, keyof ViewProps>;

packages/components/buttons/IconButton.tsx

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ import {
99
} from "../../utils/style/buttons";
1010
import { primaryColor } from "../../utils/style/colors";
1111
import { SVG } from "../SVG";
12-
import { LegacySecondaryBox } from "../boxes/LegacySecondaryBox";
12+
import { BoxStyle } from "../boxes/Box";
13+
import { SecondaryBox } from "../boxes/SecondaryBox";
1314

1415
export const IconButton: React.FC<{
1516
width?: number;
1617
size: ButtonsSize;
1718
onPress?: (() => Promise<void>) | (() => void);
1819
squaresBackgroundColor?: string;
19-
style?: StyleProp<ViewStyle>;
20+
style?: StyleProp<BoxStyle>;
2021
iconSVG: React.FC<SvgProps>;
2122
disabled?: boolean;
2223
fullWidth?: boolean;
2324
iconSize?: number;
2425
iconColor?: string;
2526
backgroundColor?: string;
2627
borderColor?: string;
27-
squaresBorderColor?: string;
2828
noBrokenCorners?: boolean;
2929
}> = ({
3030
// If no width, the buttons will fit the content including paddingHorizontal 20
@@ -33,49 +33,37 @@ export const IconButton: React.FC<{
3333
onPress,
3434
style,
3535
iconSVG,
36-
disabled = false,
3736
fullWidth = false,
3837
iconSize = 16,
3938
iconColor = "black",
4039
backgroundColor = primaryColor,
4140
borderColor,
42-
squaresBorderColor,
43-
noBrokenCorners,
4441
}) => {
45-
const boxProps = {
46-
style,
47-
disabled,
48-
width,
49-
fullWidth,
50-
noBrokenCorners,
51-
};
52-
5342
return (
5443
<TouchableOpacity
5544
onPress={onPress}
5645
style={{ width: fullWidth ? "100%" : width }}
5746
>
58-
<LegacySecondaryBox
59-
height={heightButton(size)}
60-
mainContainerStyle={[
47+
<SecondaryBox
48+
style={[
49+
style,
50+
borderColor ? { borderWidth: 1, borderColor } : {},
6151
{
52+
height: heightButton(size),
6253
flexDirection: "row",
6354
borderRadius: borderRadiusButton(size),
6455
backgroundColor,
6556
paddingHorizontal: 20,
6657
},
67-
borderColor ? { borderWidth: 1, borderColor } : {},
6858
]}
69-
squaresBorderColor={squaresBorderColor}
70-
{...boxProps}
7159
>
7260
<SVG
7361
source={iconSVG}
7462
width={iconSize}
7563
height={iconSize}
7664
color={iconColor}
7765
/>
78-
</LegacySecondaryBox>
66+
</SecondaryBox>
7967
</TouchableOpacity>
8068
);
8169
};

packages/components/buttons/SocialButton.tsx

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,36 @@ import { neutral22, neutral33, withAlpha } from "../../utils/style/colors";
66
import { fontMedium14 } from "../../utils/style/fonts";
77
import { BrandText } from "../BrandText";
88
import { SVG } from "../SVG";
9-
import { LegacySecondaryBox } from "../boxes/LegacySecondaryBox";
9+
import { SecondaryBox } from "../boxes/SecondaryBox";
1010

1111
export const SocialButton: React.FC<{
1212
text: string;
1313
iconSvg: React.FC<SvgProps>;
1414
onPress?: () => void;
1515
style?: StyleProp<ViewStyle>;
16-
noBrokenCorners?: boolean;
17-
}> = ({ text, onPress, iconSvg, style, noBrokenCorners = true }) => {
16+
}> = ({ text, onPress, iconSvg, style }) => {
1817
return (
1918
<TouchableOpacity onPress={onPress} style={style}>
20-
<LegacySecondaryBox
21-
// We don't handle broken corners for now, because this button can be used on an image
22-
noBrokenCorners={noBrokenCorners}
23-
mainContainerStyle={{ backgroundColor: withAlpha(neutral22, 0.64) }}
24-
height={44}
19+
<SecondaryBox
20+
style={{ height: 44, backgroundColor: withAlpha(neutral22, 0.64) }}
2521
>
2622
<View style={{ flexDirection: "row", alignItems: "center" }}>
27-
<LegacySecondaryBox
28-
noBrokenCorners={noBrokenCorners}
29-
style={{ marginLeft: 6 }}
30-
mainContainerStyle={{ backgroundColor: neutral33, borderRadius: 6 }}
31-
width={32}
32-
height={32}
33-
squaresBackgroundColor={withAlpha(neutral22, 0.64)}
34-
cornerWidth={5.5}
23+
<SecondaryBox
24+
style={{
25+
marginLeft: 6,
26+
backgroundColor: neutral33,
27+
borderRadius: 6,
28+
width: 32,
29+
height: 32,
30+
}}
3531
>
3632
<SVG source={iconSvg} height={20} width={20} />
37-
</LegacySecondaryBox>
33+
</SecondaryBox>
3834
<BrandText style={[fontMedium14, { marginLeft: 8, marginRight: 16 }]}>
3935
{text}
4036
</BrandText>
4137
</View>
42-
</LegacySecondaryBox>
38+
</SecondaryBox>
4339
</TouchableOpacity>
4440
);
4541
};

packages/components/buttons/SocialButtonSecondary.tsx

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import { fontMedium14 } from "../../utils/style/fonts";
1212
import { BrandText } from "../BrandText";
1313
import { SVG } from "../SVG";
14-
import { LegacySecondaryBox } from "../boxes/LegacySecondaryBox";
14+
import { SecondaryBox } from "../boxes/SecondaryBox";
1515

1616
export const SocialButtonSecondary: React.FC<{
1717
text: string;
@@ -21,31 +21,26 @@ export const SocialButtonSecondary: React.FC<{
2121
}> = ({ text, onPress, iconSvg, style }) => {
2222
return (
2323
<TouchableOpacity onPress={onPress} style={style}>
24-
<LegacySecondaryBox
25-
noBrokenCorners
26-
mainContainerStyle={{ backgroundColor: withAlpha(neutral1A, 0.64) }}
27-
height={44}
24+
<SecondaryBox
25+
style={{ height: 44, backgroundColor: withAlpha(neutral1A, 0.64) }}
2826
>
2927
<View style={{ flexDirection: "row", alignItems: "center" }}>
30-
<LegacySecondaryBox
31-
noBrokenCorners
32-
style={{ marginLeft: 6 }}
33-
mainContainerStyle={{
28+
<SecondaryBox
29+
style={{
30+
marginLeft: 6,
3431
backgroundColor: primaryColor,
3532
borderRadius: 6,
33+
width: 32,
34+
height: 32,
3635
}}
37-
width={32}
38-
height={32}
39-
squaresBackgroundColor={withAlpha(neutral1A, 0.64)}
40-
cornerWidth={5.5}
4136
>
4237
<SVG
4338
source={iconSvg}
4439
width={20}
4540
height={20}
4641
color={primaryTextColor}
4742
/>
48-
</LegacySecondaryBox>
43+
</SecondaryBox>
4944
<BrandText
5045
style={[
5146
fontMedium14,
@@ -55,7 +50,7 @@ export const SocialButtonSecondary: React.FC<{
5550
{text}
5651
</BrandText>
5752
</View>
58-
</LegacySecondaryBox>
53+
</SecondaryBox>
5954
</TouchableOpacity>
6055
);
6156
};
Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { StyleProp, TouchableOpacity, ViewStyle } from "react-native";
2+
import { StyleProp, TouchableOpacity } from "react-native";
33

44
import chevronDownSVG from "../../../assets/icons/chevron-down.svg";
55
import chevronUpSVG from "../../../assets/icons/chevron-up.svg";
@@ -12,49 +12,43 @@ import { neutral33, secondaryColor } from "../../utils/style/colors";
1212
import { fontSemibold12 } from "../../utils/style/fonts";
1313
import { BrandText } from "../BrandText";
1414
import { SVG } from "../SVG";
15-
import { LegacySecondaryBox } from "../boxes/LegacySecondaryBox";
15+
import { BoxStyle } from "../boxes/Box";
16+
import { SecondaryBox } from "../boxes/SecondaryBox";
1617

1718
// Same as _PrimaryButtonTest but with customizable color and backgroundColor
1819
export const ToggleableButton: React.FC<{
19-
size?: ButtonsSize;
2020
textExpanded: string;
2121
textCompressed: string;
22+
size?: ButtonsSize;
2223
width?: number;
2324
onPress?: () => void;
2425
squaresBackgroundColor?: string;
2526
isExpanded?: boolean;
2627
color?: string;
27-
style?: StyleProp<ViewStyle>;
28+
style?: StyleProp<BoxStyle>;
2829
}> = ({
29-
// If no width, the buttons will fit the content including paddingHorizontal 20
30-
width,
31-
size = "XS",
3230
textExpanded,
3331
textCompressed,
32+
// If no width, the buttons will fit the content including paddingHorizontal 20
33+
width,
3434
onPress,
35-
squaresBackgroundColor,
3635
isExpanded = false,
3736
style,
3837
}) => {
39-
const boxProps = {
40-
style,
41-
squaresBackgroundColor,
42-
width,
43-
};
44-
4538
return (
4639
<TouchableOpacity onPress={onPress}>
47-
<LegacySecondaryBox
48-
cornerWidth={cornerWidthDropdownButton(size)}
49-
height={heightDropdownButton(size)}
50-
mainContainerStyle={{
51-
flexDirection: "row",
52-
borderRadius: 6,
53-
backgroundColor: neutral33,
54-
paddingRight: 6,
55-
paddingLeft: 8,
56-
}}
57-
{...boxProps}
40+
<SecondaryBox
41+
style={[
42+
style,
43+
{
44+
flexDirection: "row",
45+
borderRadius: 6,
46+
backgroundColor: neutral33,
47+
paddingRight: 6,
48+
paddingLeft: 8,
49+
width,
50+
},
51+
]}
5852
>
5953
<BrandText
6054
style={[
@@ -71,7 +65,7 @@ export const ToggleableButton: React.FC<{
7165
height={16}
7266
color={secondaryColor}
7367
/>
74-
</LegacySecondaryBox>
68+
</SecondaryBox>
7569
</TouchableOpacity>
7670
);
7771
};

packages/components/riotersFooter/NftAdjustments.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ const NftAdjustments: React.FC<{
146146
backgroundColor="#F46F761A"
147147
style={{ borderWidth: 1, borderRadius: 6 }}
148148
borderColor={errorColor}
149-
squaresBorderColor={errorColor}
150149
/>
151150
<PrimaryButton
152151
width={128}

0 commit comments

Comments
 (0)