Open History to see the last commit
1'use client'
2β
3import React, { useState } from 'react'
4import TodoListCache from './TodoListCache'
5import TodoListUI from './TodoListUI'
6β
7type Tab = 'ui-variables' | 'cache'
8β
9export default function ApproachTabs() {
10 const [activeTab, setActiveTab] = useState<Tab>('ui-variables')
11β
12 const tabStyle = (tab: Tab): React.CSSProperties => ({
13 padding: '0.5rem 1rem',
14 border: 'none',
15 borderBottom:
16 activeTab === tab ? '2px solid #0070f3' : '2px solid transparent',
17 background: 'none',
18 cursor: 'pointer',
19 fontWeight: activeTab === tab ? 600 : 400,
20 color: activeTab === tab ? '#0070f3' : '#555',
21 })
22β
23 return (
24 <div>
25 <div
26 style={{
27 display: 'flex',
28 borderBottom: '1px solid #ddd',
29 marginBottom: '1.5rem',
30 }}
31 >
32 <button
33 style={tabStyle('ui-variables')}
34 onClick={() => setActiveTab('ui-variables')}
35 >
36 Via UI Variables
37 </button>
38 <button style={tabStyle('cache')} onClick={() => setActiveTab('cache')}>
39 Via Cache Manipulation
40 </button>
41 </div>
42β
43 {activeTab === 'ui-variables' ? <TodoListUI /> : <TodoListCache />}
44 </div>
45 )
46}