DevTools Mobile: Scroll-Fades abgerundet, links-Fade dynamisch bei Scroll-Position
This commit is contained in:
@@ -3092,6 +3092,17 @@ const TOOL_DEFS = [
|
|||||||
export default function DevTools({ toast, mobile }) {
|
export default function DevTools({ toast, mobile }) {
|
||||||
const [activeTool, setActiveTool] = useState('cron');
|
const [activeTool, setActiveTool] = useState('cron');
|
||||||
const [activeTab, setActiveTab] = useState('explain');
|
const [activeTab, setActiveTab] = useState('explain');
|
||||||
|
const chipScrollRef = useRef(null);
|
||||||
|
const [chipScroll, setChipScroll] = useState({ left: false, right: true });
|
||||||
|
|
||||||
|
const onChipScroll = () => {
|
||||||
|
const el = chipScrollRef.current;
|
||||||
|
if (!el) return;
|
||||||
|
setChipScroll({
|
||||||
|
left: el.scrollLeft > 4,
|
||||||
|
right: el.scrollLeft < el.scrollWidth - el.clientWidth - 4,
|
||||||
|
});
|
||||||
|
};
|
||||||
const active = TOOL_DEFS.find(t=>t.id===activeTool);
|
const active = TOOL_DEFS.find(t=>t.id===activeTool);
|
||||||
const ActiveComp = active?.tabs ? active.components[activeTab] : active?.component;
|
const ActiveComp = active?.tabs ? active.components[activeTab] : active?.component;
|
||||||
|
|
||||||
@@ -3109,9 +3120,10 @@ export default function DevTools({ toast, mobile }) {
|
|||||||
{/* Tool-Auswahl: Mobile = horizontal scroll mit Fade-Hint, Desktop = 2-Spalten-Grid */}
|
{/* Tool-Auswahl: Mobile = horizontal scroll mit Fade-Hint, Desktop = 2-Spalten-Grid */}
|
||||||
{mobile ? (
|
{mobile ? (
|
||||||
<div style={{position:'relative', marginBottom:16}}>
|
<div style={{position:'relative', marginBottom:16}}>
|
||||||
<div style={{display:'flex',gap:6,overflowX:'auto',
|
<div ref={chipScrollRef} onScroll={onChipScroll}
|
||||||
padding:'3px 3px 6px 3px', /* Platz für border, kein clip */
|
style={{display:'flex',gap:6,overflowX:'auto',
|
||||||
scrollbarWidth:'none',WebkitOverflowScrolling:'touch'}}>
|
padding:'3px 3px 6px 3px',
|
||||||
|
scrollbarWidth:'none',WebkitOverflowScrolling:'touch'}}>
|
||||||
{TOOL_DEFS.map(t=>(
|
{TOOL_DEFS.map(t=>(
|
||||||
<button key={t.id}
|
<button key={t.id}
|
||||||
onClick={()=>{ if(t.ready){setActiveTool(t.id);setActiveTab(t.tabs?.[0]?.id||'');} else toast('Kommt bald 🚧'); }}
|
onClick={()=>{ if(t.ready){setActiveTool(t.id);setActiveTab(t.tabs?.[0]?.id||'');} else toast('Kommt bald 🚧'); }}
|
||||||
@@ -3128,19 +3140,24 @@ export default function DevTools({ toast, mobile }) {
|
|||||||
<span>{getText(t.label)}</span>
|
<span>{getText(t.label)}</span>
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
{/* Abstandshalter rechts damit letzter Chip nicht unter Fade liegt */}
|
<div style={{flexShrink:0, width:28}}/>
|
||||||
<div style={{flexShrink:0, width:32}}/>
|
|
||||||
</div>
|
</div>
|
||||||
{/* Fade-Overlay rechts → signalisiert weiteren Inhalt ohne Chips abzuschneiden */}
|
{/* Links-Fade — erscheint wenn nach rechts gescrollt */}
|
||||||
<div style={{
|
{chipScroll.left && (
|
||||||
position:'absolute', right:0, top:0, bottom:6, width:48, pointerEvents:'none',
|
<div style={{
|
||||||
background:'linear-gradient(to right, transparent, #0d0d0f 80%)',
|
position:'absolute', left:3, top:3, bottom:6, width:52, pointerEvents:'none',
|
||||||
}}/>
|
borderRadius:20,
|
||||||
{/* Scroll-Pfeil */}
|
background:'linear-gradient(to right, #0d0d0f 30%, transparent)',
|
||||||
<div style={{
|
}}/>
|
||||||
position:'absolute', right:6, top:'50%', transform:'translateY(-60%)',
|
)}
|
||||||
color:'rgba(255,255,255,0.35)', fontSize:14, pointerEvents:'none',
|
{/* Rechts-Fade — verschwindet wenn am Ende */}
|
||||||
}}>›</div>
|
{chipScroll.right && (
|
||||||
|
<div style={{
|
||||||
|
position:'absolute', right:3, top:3, bottom:6, width:52, pointerEvents:'none',
|
||||||
|
borderRadius:20,
|
||||||
|
background:'linear-gradient(to left, #0d0d0f 30%, transparent)',
|
||||||
|
}}/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div style={{display:'grid',gridTemplateColumns:'repeat(2,1fr)',gap:5,marginBottom:16}}>
|
<div style={{display:'grid',gridTemplateColumns:'repeat(2,1fr)',gap:5,marginBottom:16}}>
|
||||||
|
|||||||
Reference in New Issue
Block a user