Skip to content

Commit cb08dd6

Browse files
ci: apply automated fixes
1 parent 269625a commit cb08dd6

File tree

5 files changed

+137
-72
lines changed

5 files changed

+137
-72
lines changed

docs/router/framework/react/how-to/integrate-chakra-ui.md

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ interface ChakraNavProps {
166166
brandTo?: string
167167
}
168168

169-
export function ChakraNav({ items, brand = 'Logo', brandTo = '/' }: ChakraNavProps) {
169+
export function ChakraNav({
170+
items,
171+
brand = 'Logo',
172+
brandTo = '/',
173+
}: ChakraNavProps) {
170174
const { isOpen, onToggle } = useDisclosure()
171175
const matchRoute = useMatchRoute()
172176

@@ -190,7 +194,9 @@ export function ChakraNav({ items, brand = 'Logo', brandTo = '/' }: ChakraNavPro
190194
>
191195
<IconButton
192196
onClick={onToggle}
193-
icon={isOpen ? <CloseIcon w={3} h={3} /> : <HamburgerIcon w={5} h={5} />}
197+
icon={
198+
isOpen ? <CloseIcon w={3} h={3} /> : <HamburgerIcon w={5} h={5} />
199+
}
194200
variant="ghost"
195201
aria-label="Toggle Navigation"
196202
/>
@@ -255,7 +261,11 @@ function MobileNav({ items }: { items: NavItem[] }) {
255261
const matchRoute = useMatchRoute()
256262

257263
return (
258-
<Stack bg={useColorModeValue('white', 'gray.800')} p={4} display={{ md: 'none' }}>
264+
<Stack
265+
bg={useColorModeValue('white', 'gray.800')}
266+
p={4}
267+
display={{ md: 'none' }}
268+
>
259269
{items.map((item) => {
260270
const isActive = matchRoute({ to: item.to, fuzzy: !item.exact })
261271

@@ -265,7 +275,9 @@ function MobileNav({ items }: { items: NavItem[] }) {
265275
to={item.to}
266276
py={2}
267277
fontWeight={isActive ? 'bold' : 'medium'}
268-
color={isActive ? 'brand.500' : useColorModeValue('gray.600', 'gray.200')}
278+
color={
279+
isActive ? 'brand.500' : useColorModeValue('gray.600', 'gray.200')
280+
}
269281
_hover={{
270282
textDecoration: 'none',
271283
}}
@@ -313,7 +325,8 @@ export function ChakraBreadcrumb({
313325

314326
const breadcrumbItems = pathSegments.map((segment, index) => {
315327
const path = '/' + pathSegments.slice(0, index + 1).join('/')
316-
const label = config[segment] || segment.charAt(0).toUpperCase() + segment.slice(1)
328+
const label =
329+
config[segment] || segment.charAt(0).toUpperCase() + segment.slice(1)
317330
const isLast = index === pathSegments.length - 1
318331

319332
return {
@@ -431,7 +444,11 @@ export function ChakraCardGrid({
431444
})
432445

433446
return (
434-
<SimpleGrid columns={columns} spacing={spacing} minChildWidth={minChildWidth}>
447+
<SimpleGrid
448+
columns={columns}
449+
spacing={spacing}
450+
minChildWidth={minChildWidth}
451+
>
435452
{children}
436453
</SimpleGrid>
437454
)
@@ -602,7 +619,11 @@ function PostPage() {
602619
<VStack spacing={8} align="stretch">
603620
{/* Back Navigation */}
604621
<Box>
605-
<RouterLink to="/posts" color="brand.500" _hover={{ textDecoration: 'none' }}>
622+
<RouterLink
623+
to="/posts"
624+
color="brand.500"
625+
_hover={{ textDecoration: 'none' }}
626+
>
606627
<HStack spacing={2}>
607628
<ArrowBackIcon />
608629
<Text>Back to Posts</Text>
@@ -613,7 +634,7 @@ function PostPage() {
613634
{/* Post Header */}
614635
<VStack spacing={4} align="start">
615636
<Heading size="2xl">Understanding TanStack Router</Heading>
616-
637+
617638
<HStack spacing={3}>
618639
<Tag colorScheme="brand">
619640
<TagLabel>Tutorial</TagLabel>
@@ -630,15 +651,16 @@ function PostPage() {
630651
<Box>
631652
<VStack spacing={4} align="start">
632653
<Text color={textColor} lineHeight="tall">
633-
This is the detailed content of post {postId}. In this comprehensive guide,
634-
we'll explore how to integrate TanStack Router with Chakra UI to create
635-
beautiful, accessible, and responsive web applications.
654+
This is the detailed content of post {postId}. In this
655+
comprehensive guide, we'll explore how to integrate TanStack
656+
Router with Chakra UI to create beautiful, accessible, and
657+
responsive web applications.
636658
</Text>
637659

638660
<Text color={textColor} lineHeight="tall">
639-
Chakra UI provides a simple, modular, and accessible component library
640-
that gives you the building blocks you need to build React applications
641-
with speed.
661+
Chakra UI provides a simple, modular, and accessible component
662+
library that gives you the building blocks you need to build React
663+
applications with speed.
642664
</Text>
643665
</VStack>
644666
</Box>
@@ -724,12 +746,12 @@ export const RouterButton = createLink(
724746
import { ColorModeScript } from '@chakra-ui/react'
725747

726748
// Add to your index.html head
727-
<ColorModeScript initialColorMode={theme.config.initialColorMode} />
749+
;<ColorModeScript initialColorMode={theme.config.initialColorMode} />
728750

729751
// Or use localStorage manager
730752
import { localStorageManager } from '@chakra-ui/react'
731753

732-
<ChakraProvider theme={theme} colorModeManager={localStorageManager}>
754+
;<ChakraProvider theme={theme} colorModeManager={localStorageManager}>
733755
{children}
734756
</ChakraProvider>
735757
```
@@ -763,24 +785,28 @@ const columns = useBreakpointValue({
763785
Before deploying your Chakra UI + TanStack Router app:
764786

765787
### Functionality
788+
766789
- [ ] All router-compatible components work correctly
767790
- [ ] Navigation states properly reflected
768791
- [ ] Theme persists across route changes
769792
- [ ] TypeScript compilation successful
770793

771794
### Accessibility
795+
772796
- [ ] Keyboard navigation working
773797
- [ ] Screen reader compatibility tested
774798
- [ ] Color contrast meets WCAG standards
775799
- [ ] Focus management working properly
776800

777801
### Performance
802+
778803
- [ ] Bundle size optimized
779804
- [ ] Color mode switching performant
780805
- [ ] No unnecessary re-renders
781806
- [ ] Images and icons optimized
782807

783808
### Responsiveness
809+
784810
- [ ] Works on mobile devices
785811
- [ ] Tablet layouts functional
786812
- [ ] Desktop experience optimal
@@ -793,4 +819,4 @@ Before deploying your Chakra UI + TanStack Router app:
793819
- [Chakra UI Documentation](https://chakra-ui.com/getting-started) - Complete component library guide
794820
- [Chakra UI Recipes](https://chakra-ui.com/community/recipes) - Common patterns and recipes
795821
- [TanStack Router createLink API](../api/router#createlink) - API documentation for component integration
796-
- [Emotion CSS-in-JS](https://emotion.sh/docs/introduction) - Styling library used by Chakra UI
822+
- [Emotion CSS-in-JS](https://emotion.sh/docs/introduction) - Styling library used by Chakra UI

docs/router/framework/react/how-to/integrate-framer-motion.md

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ interface RouteAnimationContainerProps {
117117
children: ReactNode
118118
}
119119

120-
export function RouteAnimationContainer({ children }: RouteAnimationContainerProps) {
120+
export function RouteAnimationContainer({
121+
children,
122+
}: RouteAnimationContainerProps) {
121123
const router = useRouter()
122-
124+
123125
return (
124126
<AnimatePresence mode="wait" initial={false}>
125-
<div key={router.state.location.pathname}>
126-
{children}
127-
</div>
127+
<div key={router.state.location.pathname}>{children}</div>
128128
</AnimatePresence>
129129
)
130130
}
@@ -236,9 +236,7 @@ export function AnimatedTabs({ items, className }: AnimatedTabsProps) {
236236
key={item.to}
237237
to={item.to}
238238
className={`relative px-3 py-2 rounded-md text-sm font-medium transition-colors ${
239-
isActive
240-
? 'text-blue-600'
241-
: 'text-gray-600 hover:text-gray-900'
239+
isActive ? 'text-blue-600' : 'text-gray-600 hover:text-gray-900'
242240
}`}
243241
>
244242
{isActive && (
@@ -281,7 +279,10 @@ interface AnimatedMobileMenuProps {
281279
trigger: React.ReactNode
282280
}
283281

284-
export function AnimatedMobileMenu({ items, trigger }: AnimatedMobileMenuProps) {
282+
export function AnimatedMobileMenu({
283+
items,
284+
trigger,
285+
}: AnimatedMobileMenuProps) {
285286
const [isOpen, setIsOpen] = useState(false)
286287

287288
const menuVariants = {
@@ -313,9 +314,7 @@ export function AnimatedMobileMenu({ items, trigger }: AnimatedMobileMenuProps)
313314
return (
314315
<>
315316
{/* Trigger */}
316-
<button onClick={() => setIsOpen(!isOpen)}>
317-
{trigger}
318-
</button>
317+
<button onClick={() => setIsOpen(!isOpen)}>{trigger}</button>
319318

320319
{/* Overlay */}
321320
<AnimatePresence>
@@ -379,11 +378,11 @@ interface AnimatedFabProps {
379378
className?: string
380379
}
381380

382-
export function AnimatedFab({
383-
to,
384-
label = 'Add',
381+
export function AnimatedFab({
382+
to,
383+
label = 'Add',
385384
icon = <Plus className="w-6 h-6" />,
386-
className = ''
385+
className = '',
387386
}: AnimatedFabProps) {
388387
return (
389388
<motion.div
@@ -426,7 +425,11 @@ interface SharedElementProps {
426425
className?: string
427426
}
428427

429-
export function SharedElement({ layoutId, children, className }: SharedElementProps) {
428+
export function SharedElement({
429+
layoutId,
430+
children,
431+
className,
432+
}: SharedElementProps) {
430433
return (
431434
<motion.div
432435
layoutId={layoutId}
@@ -488,7 +491,7 @@ export function RouteVariants({ children }: RouteVariantsProps) {
488491
// Different animations based on route depth
489492
const getVariants = (path: string) => {
490493
const depth = path.split('/').length - 1
491-
494+
492495
if (depth === 1) {
493496
// Top-level routes slide from right
494497
return {
@@ -664,6 +667,7 @@ function PostsPage() {
664667
**Solutions:**
665668

666669
1. **Ensure proper key for AnimatePresence:**
670+
667671
```tsx
668672
<AnimatePresence mode="wait">
669673
<motion.div key={router.state.location.pathname}>
@@ -673,10 +677,11 @@ function PostsPage() {
673677
```
674678

675679
2. **Use layout animations correctly:**
680+
676681
```tsx
677682
// ❌ This might cause layout shifts
678683
<motion.div animate={{ x: 100 }}>
679-
684+
680685
// ✅ Use layout for changing layouts
681686
<motion.div layout>
682687
```
@@ -688,13 +693,14 @@ function PostsPage() {
688693
**Solutions:**
689694

690695
1. **Prefer transform and opacity animations:**
696+
691697
```tsx
692698
// ✅ GPU-accelerated properties
693699
const variants = {
694700
initial: { opacity: 0, scale: 0.95 },
695701
in: { opacity: 1, scale: 1 },
696702
}
697-
703+
698704
// ❌ Avoid animating layout properties
699705
const badVariants = {
700706
initial: { width: 0, height: 0 },
@@ -704,10 +710,7 @@ function PostsPage() {
704710

705711
2. **Use will-change CSS property sparingly:**
706712
```tsx
707-
<motion.div
708-
style={{ willChange: 'transform' }}
709-
animate={{ x: 100 }}
710-
/>
713+
<motion.div style={{ willChange: 'transform' }} animate={{ x: 100 }} />
711714
```
712715

713716
### Layout Shift Issues
@@ -722,7 +725,7 @@ function PostsPage() {
722725
layoutId="shared-element"
723726
style={{ position: 'relative' }}
724727
transition={{
725-
layout: { duration: 0.3 }
728+
layout: { duration: 0.3 },
726729
}}
727730
>
728731
{children}
@@ -736,24 +739,28 @@ function PostsPage() {
736739
Before deploying your animated TanStack Router app:
737740

738741
### Performance
742+
739743
- [ ] Animations use GPU-accelerated properties (transform, opacity)
740744
- [ ] No unnecessary will-change CSS properties
741745
- [ ] Complex animations are conditional on user preferences
742746
- [ ] Frame rate stays above 60fps on target devices
743747

744748
### User Experience
749+
745750
- [ ] Animations respect user's motion preferences
746751
- [ ] Loading states have appropriate animations
747752
- [ ] Navigation feels responsive and smooth
748753
- [ ] Animations enhance rather than distract from content
749754

750755
### Accessibility
756+
751757
- [ ] Respect prefers-reduced-motion media query
752758
- [ ] Animations don't interfere with screen readers
753759
- [ ] Focus management works during transitions
754760
- [ ] Essential content isn't hidden behind animations
755761

756762
### Technical
763+
757764
- [ ] Bundle size impact acceptable
758765
- [ ] No animation-related console errors
759766
- [ ] Smooth transitions on slower devices
@@ -766,4 +773,4 @@ Before deploying your animated TanStack Router app:
766773
- [Framer Motion Documentation](https://www.framer.com/motion/) - Complete animation library guide
767774
- [React Transition Group Migration](https://www.framer.com/motion/migrate-from-react-transition-group/) - Migration guide from other animation libraries
768775
- [Animation Performance](https://web.dev/animations-guide/) - Web performance guide for animations
769-
- [TanStack Router Route Transitions](../guide/route-transitions) - Official guide for route animations
776+
- [TanStack Router Route Transitions](../guide/route-transitions) - Official guide for route animations

0 commit comments

Comments
 (0)