Skip to content

Commit a4472a1

Browse files
committed
fix: fixed the close/open menu text
1 parent d3537d3 commit a4472a1

File tree

5 files changed

+26
-13
lines changed

5 files changed

+26
-13
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# package artifacts
22
node_modules/
3-
.next/
3+
**/.next/
44
dist/
55
coverage/
66
test-results/

examples/demo/src/app/(test)/ReactState.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,14 @@ function Header({ theme }: { theme: 'light' | 'dark' }) {
4747
<div
4848
ref={ref}
4949
className="space-y-2 text-center">
50-
<h1 className={`text-3xl font-bold ${theme === 'light' ? 'text-gray-900' : 'text-white'}`}>React State Management</h1>
51-
52-
<p className={`${theme === 'light' ? 'text-gray-600' : 'text-gray-400'}`}>Reactive state management with React</p>
50+
<h1 className={`text-3xl font-bold ${theme === 'light' ? 'text-gray-900' : 'text-white'}`}>
51+
React State <span className="max-[450px]:hidden">Management</span>
52+
</h1>
53+
54+
<p className={`${theme === 'light' ? 'text-gray-600' : 'text-gray-400'}`}>
55+
Reactive state management with React <br />
56+
<span className="text-xs text-gray-500">Re-renders O(n)</span>
57+
</p>
5358
</div>
5459
);
5560
}
@@ -148,7 +153,7 @@ function InteractiveCard({
148153
{/* Sliding Menu */}
149154
<div className={`overflow-hidden ${menuOpen ? 'max-h-[160px]' : 'max-h-0'} `}>
150155
<div className={`border-t border-gray-200 p-6 transition-all duration-0! ${theme === 'dark' ? 'bg-gray-700' : 'bg-white'}`}>
151-
<p className={`${theme === 'dark' ? 'text-gray-300' : 'text-gray-600'}`}>✨ This panel slides open and has to re-render!</p>
156+
<p className={`${theme === 'dark' ? 'text-gray-300' : 'text-gray-600'} text-center`}>✨ This panel slides open and has to re-render!</p>
152157
</div>
153158
</div>
154159
</div>
@@ -160,9 +165,11 @@ function StateDisplay({ theme, accent, menuOpen }: { theme: 'light' | 'dark'; ac
160165
const ref = useRenderTracker('StateDisplay');
161166

162167
return (
163-
<div ref={ref}>
168+
<div
169+
ref={ref}
170+
className="max-[450px]:hidden">
164171
<div
165-
className={`mt-5 flex justify-center gap-4 space-y-1 text-center font-mono text-sm capitalize ${accent === 'violet' ? 'text-violet-500' : accent === 'emerald' ? 'text-emerald-500' : 'text-amber-500'}`}>
172+
className={`mt-5 **:text-nowrap flex justify-center gap-4 space-y-1 text-center font-mono text-sm capitalize ${accent === 'violet' ? 'text-violet-500' : accent === 'emerald' ? 'text-emerald-500' : 'text-amber-500'}`}>
166173
<div className="flex gap-1">theme: {theme} </div>
167174
<div className="flex gap-1">accent: {accent}</div>
168175
<div className="flex gap-1">menu: {menuOpen ? 'Open' : 'Closed'}</div>

examples/demo/src/app/(test)/ZeroState.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function Header() {
3333
<h1 className="theme-light:text-gray-900 theme-dark:text-white text-3xl font-bold">Zero UI</h1>
3434

3535
<p className="theme-light:text-gray-600 theme-dark:text-gray-400">
36-
Reactive state without re-rendering OR prop drilling. <br />
36+
Reactive state without re-rendering .<br />
3737
<span className="text-sm">
3838
<span className="theme-light:text-gray-900 theme-dark:text-white font-bold">Zero</span> re-renders,{' '}
3939
<span className="theme-light:text-gray-900 theme-dark:text-white font-bold">Reactive</span> &{' '}
@@ -120,7 +120,7 @@ function InteractiveCard({ toggleMenu }: { toggleMenu: () => void }) {
120120
{/* Sliding Panel */}
121121
<div className="menu-open-true:max-h-[80px] menu-open-false:max-h-0 overflow-hidden">
122122
<div className="theme-dark:bg-gray-700 theme-light:bg-white border-t border-gray-200 p-6 transition-all duration-0!">
123-
<p className="theme-dark:text-gray-300 theme-light:text-gray-600">✨ This panel slides open without re-rendering!</p>
123+
<p className="theme-dark:text-gray-300 theme-light:text-gray-600 text-center">✨ This panel slides open without re-rendering!</p>
124124
</div>
125125
</div>
126126
</div>
@@ -132,7 +132,9 @@ function StateDisplay() {
132132
const ref = useRenderTracker('StateDisplay');
133133

134134
return (
135-
<div ref={ref}>
135+
<div
136+
ref={ref}
137+
className="max-[450px]:hidden">
136138
<div className="theme-light:text-gray-500 theme-dark:text-gray-400 **:accent-violet:text-violet-500 **:accent-emerald:text-emerald-500 **:accent-amber:text-amber-500 mt-5 flex justify-center gap-4 space-y-1 text-center font-mono text-sm capitalize">
137139
<div className="flex gap-1 text-nowrap **:text-nowrap">
138140
theme: <span className="theme-dark:hidden">Light</span>
@@ -146,8 +148,8 @@ function StateDisplay() {
146148
</div>
147149
<div className="flex gap-1 text-nowrap **:text-nowrap">
148150
menu:
149-
<span className="menu-open-false:hidden">Open</span>
150-
<span className="menu-open-true:hidden">Closed</span>
151+
<span className="menu-open-true:hidden">Open</span>
152+
<span className="menu-open-false:hidden">Closed</span>
151153
</div>
152154
</div>
153155
</div>

examples/demo/src/app/(test)/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { domAnimation, LazyMotion } from 'motion/react';
12
import { RenderTracker } from './ReactTracker';
23

34
const layout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
45
return (
56
<div className="relative py-10">
6-
{children}
7+
<LazyMotion features={domAnimation}>{children}</LazyMotion>
78
<RenderTracker />
89
<div className="fixed right-0 bottom-0 z-10 h-fit w-full rounded-lg bg-white/80 px-4 py-2 ring-1 ring-black/5 backdrop-blur-sm md:bg-white/20">
910
<div className="pb-2 text-sm text-blue-500">(Layout.tsx) Global UI State Variables</div>

examples/demo/src/app/globals.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
0px 25px 25px -3.75px rgba(0, 0, 0, 0.11), 0px -5px 5px -3.75px rgba(0, 0, 0, 0.11);
88
}
99

10+
/* * {
11+
border: 1px dotted red;
12+
} */
1013
button:not(:disabled),
1114
[role='button']:not(:disabled) {
1215
cursor: pointer;

0 commit comments

Comments
 (0)