Skip to content

Commit 7361358

Browse files
feat: add z-index scale
1 parent 253dc13 commit 7361358

File tree

12 files changed

+34
-19
lines changed

12 files changed

+34
-19
lines changed

apps/mobile/src/app/(home)/generating-wallet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function GeneratingWalletScreen() {
1515
bottom={height / 2}
1616
left={0}
1717
right={0}
18-
zIndex={10}
18+
zIndex="10"
1919
justifyContent="center"
2020
alignItems="center"
2121
>

apps/mobile/src/app/(home)/recover-wallet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export default function RecoverWallet() {
126126
{!hidePasteButton && (
127127
<Button
128128
onPress={pasteFromClipboard}
129-
style={{ position: 'absolute', bottom: 12, right: 12, zIndex: 100 }}
129+
style={{ position: 'absolute', bottom: 12, right: 12, zIndex: 20 }}
130130
buttonState="default"
131131
title={t({
132132
id: 'recover_wallet.paste_button',

apps/mobile/src/components/draggable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function Draggable({
4848
const animatedStyles = useAnimatedStyle(() => ({
4949
transform: [{ translateY: translationY.value }, { scale: zoom.value }],
5050
position: isAnimatedShared.value ? 'absolute' : 'relative',
51-
zIndex: isAnimatedShared.value ? 100 : 1,
51+
zIndex: isAnimatedShared.value ? 20 : 1,
5252
width: '100%',
5353
top: isAnimatedShared.value ? thisItemPosition.value.y : 0,
5454
left: isAnimatedShared.value ? thisItemPosition.value.x : 0,

apps/mobile/src/components/headers/header.layout.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,7 @@ export function HeaderLayout({
3636
py="3"
3737
px="3"
3838
>
39-
<Box
40-
alignItems="flex-start"
41-
flexGrow={1}
42-
height="100%"
43-
justifyContent="center"
44-
zIndex={100}
45-
>
39+
<Box alignItems="flex-start" flexGrow={1} height="100%" justifyContent="center" zIndex="20">
4640
{leftElement}
4741
</Box>
4842
<Box
@@ -56,7 +50,7 @@ export function HeaderLayout({
5650
>
5751
{centerElement}
5852
</Box>
59-
<Box alignItems="flex-end" flexGrow={1} height="100%" justifyContent="center" zIndex={100}>
53+
<Box alignItems="flex-end" flexGrow={1} height="100%" justifyContent="center" zIndex="20">
6054
{rightElement}
6155
</Box>
6256
</Box>

apps/mobile/src/components/toast/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export function Toast({ toastRef }: ToastProps) {
9999
alignSelf="center"
100100
gap="3"
101101
flexDirection="row"
102-
zIndex={9999}
102+
zIndex="100"
103103
justifyContent="center"
104104
alignItems="center"
105105
testID={TestId.toastContainer}

packages/panda-preset/src/preset.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { tokens } from './tokens';
99
import { textStyles } from './typography';
1010

1111
export default definePreset({
12+
name: 'leather',
1213
theme: {
1314
extend: {
1415
semanticTokens,

packages/panda-preset/src/tokens.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import { defineTokens } from '@pandacss/dev';
22

3-
import { tokens as leatherTokens } from '@leather.io/tokens';
3+
import { tokens as leatherTokens, zIndices } from '@leather.io/tokens';
44

55
import { colors } from './colors';
66

7+
function transformZIndices(zIndices: Record<string, number>) {
8+
return Object.fromEntries(Object.entries(zIndices).map(([key, value]) => [key, { value }]));
9+
}
10+
711
export const tokens = defineTokens({
812
...leatherTokens,
913
colors,
14+
zIndex: transformZIndices(zIndices),
1015
});

packages/tokens/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ export type { AllThemePalette } from './colors';
44
export { keyframes } from './keyframes';
55
export { semanticTokens } from './semantic-tokens';
66
export { getWebTextVariants, getMobileTextVariants } from './typography';
7+
export { zIndices } from './z-indices';
78
export { tokens } from './tokens';

packages/tokens/src/z-indices.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export const zIndices = {
2+
'-1': -1,
3+
'0': 0,
4+
'10': 10,
5+
'20': 20,
6+
'30': 30,
7+
'40': 40,
8+
'50': 50,
9+
'60': 60,
10+
'70': 70,
11+
'80': 80,
12+
'90': 90,
13+
'100': 100,
14+
max: 9999,
15+
};

packages/tokens/tsup.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { defineConfig } from 'tsup';
1+
import { type Options, defineConfig } from 'tsup';
22

3-
export default defineConfig({
3+
export default defineConfig(<Options>{
44
entry: ['src/index.ts'],
55
sourcemap: true,
66
clean: false,

packages/ui/src/components/sheet/components/sheet-header.native.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function SheetHeader({ title, icon, onPressSupport }: SheetHeaderProps) {
2020
</Box>
2121
</Box>
2222
<Box alignItems="flex-end" flex={1}>
23-
<TouchableOpacity onPress={onPressSupport} zIndex={10}>
23+
<TouchableOpacity onPress={onPressSupport} zIndex="10">
2424
<QuestionCircleIcon variant="small" />
2525
</TouchableOpacity>
2626
</Box>

packages/ui/src/theme-native/theme.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ColorSchemeName } from 'react-native';
22

33
import { ThemeProvider as ThemeProviderRestyle, createTheme } from '@shopify/restyle';
44

5-
import { colorThemes, getMobileTextVariants } from '@leather.io/tokens';
5+
import { colorThemes, getMobileTextVariants, zIndices } from '@leather.io/tokens';
66

77
const textVariants = getMobileTextVariants();
88

@@ -27,8 +27,7 @@ export function generateTheme(colorScheme: ColorSchemeName) {
2727
round: 9999,
2828
},
2929
textVariants,
30-
// Temporary workaround for type errors. TODO: Add a zIndex scale.
31-
zIndices: undefined,
30+
zIndices: zIndices,
3231
breakpoints: {},
3332
});
3433
}

0 commit comments

Comments
 (0)