diff --git a/packages/app/features/home/screen.tsx b/packages/app/features/home/screen.tsx index 9d412a6..3f3a3e8 100644 --- a/packages/app/features/home/screen.tsx +++ b/packages/app/features/home/screen.tsx @@ -5,13 +5,13 @@ import { Paragraph, Separator, Sheet, - useToastController, - SwitchThemeButton, SwitchRouterButton, + SwitchThemeButton, + useToastController, XStack, YStack, } from '@my/ui' -import { ChevronDown, ChevronUp, X } from '@tamagui/lucide-icons' +import { ChevronDown, ChevronUp } from '@tamagui/lucide-icons' import { useState } from 'react' import { Platform } from 'react-native' import { useLink } from 'solito/navigation' @@ -23,22 +23,15 @@ export function HomeScreen({ pagesMode = false }: { pagesMode?: boolean }) { }) return ( - + {Platform.OS === 'web' && ( <> @@ -49,20 +42,14 @@ export function HomeScreen({ pagesMode = false }: { pagesMode?: boolean }) { -

+

Welcome to Tamagui.

- + Here's a basic starter to show navigating from one screen to another. - + This screen uses the same code on Next.js and React Native. @@ -100,28 +87,20 @@ function SheetDemo() { dismissOnSnapToBottom > - - + + - Made by - + Made by + @natebirdman, Math.round(size * 1.1), + sizeLineHeight: (size) => Math.round(size * 1.1 + (size > 20 ? 10 : 10)), + } +) diff --git a/packages/config/src/tamagui.config.ts b/packages/config/src/tamagui.config.ts index 9209588..45c5ffe 100644 --- a/packages/config/src/tamagui.config.ts +++ b/packages/config/src/tamagui.config.ts @@ -1,93 +1,13 @@ +import { defaultConfig } from '@tamagui/config/v4' import { createTamagui } from 'tamagui' -import { createInterFont } from '@tamagui/font-inter' -import { shorthands } from '@tamagui/shorthands' -import { defaultConfig, themes, tokens } from '@tamagui/config/v4' - -import { animations } from '@my/ui/src/animations' - -const headingFont = createInterFont({ - size: { - 6: 15, - }, - transform: { - 6: 'uppercase', - 7: 'none', - }, - weight: { - 6: '400', - 7: '700', - }, - color: { - 6: '$colorFocus', - 7: '$color', - }, - letterSpacing: { - 5: 2, - 6: 1, - 7: 0, - 8: -1, - 9: -2, - 10: -3, - 12: -4, - 14: -5, - 15: -6, - }, - face: { - 700: { normal: 'InterBold' }, - }, -}) - -const bodyFont = createInterFont( - { - face: { - 700: { normal: 'InterBold' }, - }, - }, - { - sizeSize: (size) => Math.round(size * 1.1), - sizeLineHeight: (size) => Math.round(size * 1.1 + (size > 20 ? 10 : 10)), - } -) +import { bodyFont, headingFont } from './fonts' +import { animations } from './animations' export const config = createTamagui({ ...defaultConfig, - defaultFont: 'body', animations, - shouldAddPrefersColorThemes: true, - themeClassNameOnRoot: true, - - // highly recommended to turn this on if you are using shorthands - // to avoid having multiple valid style keys that do the same thing - // we leave it off by default because it can be confusing as you onboard. - onlyAllowShorthands: false, - shorthands, - fonts: { body: bodyFont, heading: headingFont, }, - settings: { - allowedStyleValues: 'somewhat-strict', - }, - themes, - tokens, - media: { - xs: { maxWidth: 660 }, - sm: { maxWidth: 800 }, - md: { maxWidth: 1020 }, - lg: { maxWidth: 1280 }, - xl: { maxWidth: 1420 }, - xxl: { maxWidth: 1600 }, - gtXs: { minWidth: 660 + 1 }, - gtSm: { minWidth: 800 + 1 }, - gtMd: { minWidth: 1020 + 1 }, - gtLg: { minWidth: 1280 + 1 }, - short: { maxHeight: 820 }, - tall: { minHeight: 820 }, - hoverNone: { hover: 'none' }, - pointerCoarse: { pointer: 'coarse' }, - }, }) - -// for the compiler to find it -export default config diff --git a/packages/ui/src/MyComponent.tsx b/packages/ui/src/MyComponent.tsx index 93abc1a..274e33e 100644 --- a/packages/ui/src/MyComponent.tsx +++ b/packages/ui/src/MyComponent.tsx @@ -2,12 +2,12 @@ import { YStack, styled } from 'tamagui' export const MyComponent = styled(YStack, { name: 'MyComponent', - backgroundColor: 'red', + bg: 'red', variants: { blue: { true: { - backgroundColor: 'blue', + bg: 'blue', }, }, } as const, diff --git a/packages/ui/src/NativeToast.tsx b/packages/ui/src/NativeToast.tsx index c2dc411..65855b2 100644 --- a/packages/ui/src/NativeToast.tsx +++ b/packages/ui/src/NativeToast.tsx @@ -20,11 +20,8 @@ export const NativeToast = () => { scale={1} animation="quick" > - - {currentToast.title} + + {currentToast.title} {!!currentToast.message && {currentToast.message}} diff --git a/packages/ui/src/SwitchRouterButton.tsx b/packages/ui/src/SwitchRouterButton.tsx index 01fbf4d..cd47c68 100644 --- a/packages/ui/src/SwitchRouterButton.tsx +++ b/packages/ui/src/SwitchRouterButton.tsx @@ -2,11 +2,7 @@ import { Anchor, Button } from 'tamagui' export const SwitchRouterButton = ({ pagesMode = false }: { pagesMode?: boolean }) => { return ( - + )