|
1 |
| -import { useEffect, useState } from 'react' |
2 |
| -import Select from './Select' |
| 1 | +import { siteConfigMap } from '@/lib/config' |
3 | 2 | import { useGlobal } from '@/lib/global'
|
| 3 | +import { getQueryParam } from '@/lib/utils' |
4 | 4 | import { THEMES } from '@/themes/theme'
|
5 | 5 | import { useRouter } from 'next/router'
|
6 |
| -import { siteConfigMap } from '@/lib/config' |
7 |
| -import { getQueryParam } from '@/lib/utils' |
| 6 | +import { useEffect, useState } from 'react' |
| 7 | +import Select from './Select' |
8 | 8 |
|
9 | 9 | /**
|
10 | 10 | *
|
@@ -50,79 +50,83 @@ const DebugPanel = () => {
|
50 | 50 | }
|
51 | 51 |
|
52 | 52 | return (
|
53 |
| - <> |
54 |
| - {/* 调试按钮 */} |
55 |
| - <div> |
56 |
| - <div |
57 |
| - style={{ writingMode: 'vertical-lr' }} |
58 |
| - className={`bg-black text-xs text-white shadow-2xl p-1.5 rounded-l-xl cursor-pointer ${show ? 'right-96' : 'right-0'} fixed bottom-72 duration-200 z-50`} |
59 |
| - onClick={toggleShow} |
60 |
| - > |
61 |
| - {show |
62 |
| - ? <i className="fas fa-times"> {locale.COMMON.DEBUG_CLOSE}</i> |
63 |
| - : <i className="fas fa-tools"> {locale.COMMON.DEBUG_OPEN}</i>} |
64 |
| - </div> |
65 |
| - </div> |
| 53 | + <> |
| 54 | + {/* 调试按钮 */} |
| 55 | + <div> |
| 56 | + <div |
| 57 | + style={{ writingMode: 'vertical-lr' }} |
| 58 | + className={`bg-black text-xs text-white shadow-2xl p-1.5 rounded-l-xl cursor-pointer ${show ? 'right-96' : 'right-0'} fixed bottom-72 duration-200 z-50`} |
| 59 | + onClick={toggleShow}> |
| 60 | + {show ? ( |
| 61 | + <i className='fas fa-times'> {locale.COMMON.DEBUG_CLOSE}</i> |
| 62 | + ) : ( |
| 63 | + <i className='fas fa-tools'> {locale.COMMON.DEBUG_OPEN}</i> |
| 64 | + )} |
| 65 | + </div> |
| 66 | + </div> |
66 | 67 |
|
67 |
| - {/* 调试侧拉抽屉 */} |
| 68 | + {/* 调试侧拉抽屉 */} |
| 69 | + <div |
| 70 | + className={` ${show ? 'shadow-card w-96 right-0 ' : '-right-96 invisible w-0'} overflow-y-scroll h-full p-5 bg-white fixed bottom-0 z-50 duration-200`}> |
| 71 | + <div className='flex justify-between space-x-1 my-5'> |
| 72 | + <div className='flex-col px-5'> |
| 73 | + <Select |
| 74 | + label={locale.COMMON.THEME_SWITCH} |
| 75 | + value={currentTheme} |
| 76 | + options={themeOptions} |
| 77 | + onChange={handleUpdateDebugTheme} |
| 78 | + /> |
68 | 79 | <div
|
69 |
| - className={` ${show ? 'shadow-card w-96 right-0 ' : '-right-96 invisible w-0'} overflow-y-scroll h-full p-5 bg-white fixed bottom-0 z-50 duration-200`} |
70 |
| - > |
71 |
| - <div className="flex justify-between space-x-1 my-5"> |
72 |
| - <div className='flex'> |
73 |
| - <Select |
74 |
| - label={locale.COMMON.THEME_SWITCH} |
75 |
| - value={currentTheme} |
76 |
| - options={themeOptions} |
77 |
| - onChange={handleUpdateDebugTheme} |
78 |
| - /> |
79 |
| - <div className="p-2 cursor-pointer" onClick={handleChangeDebugTheme}> |
80 |
| - <i className="fas fa-sync" /> |
81 |
| - </div> |
82 |
| - </div> |
| 80 | + className='p-2 cursor-pointer' |
| 81 | + onClick={handleChangeDebugTheme}> |
| 82 | + <i className='fas fa-sync' /> |
| 83 | + </div> |
| 84 | + </div> |
83 | 85 |
|
84 |
| - <div className='p-2'> |
85 |
| - <i className='fas fa-times' onClick={toggleShow}/> |
86 |
| - </div> |
87 |
| - </div> |
| 86 | + <div className='p-2'> |
| 87 | + <i className='fas fa-times' onClick={toggleShow} /> |
| 88 | + </div> |
| 89 | + </div> |
88 | 90 |
|
89 |
| - <div> |
90 |
| - {/* <div> |
91 |
| - <div className="font-bold w-18 border-b my-2"> |
92 |
| - 主题配置{`config_${debugTheme}.js`}: |
93 |
| - </div> |
94 |
| - <div className="text-xs"> |
95 |
| - {Object.keys(themeConfig).map(k => ( |
96 |
| - <div key={k} className="justify-between flex py-1"> |
97 |
| - <span className="bg-indigo-500 p-0.5 rounded text-white mr-2"> |
98 |
| - {k} |
99 |
| - </span> |
100 |
| - <span className="whitespace-nowrap"> |
101 |
| - {filterResult(themeConfig[k] + '')} |
102 |
| - </span> |
103 |
| - </div> |
104 |
| - ))} |
| 91 | + <div className='flex-col px-5'> |
| 92 | + {/* |
| 93 | + <div> |
| 94 | + <div className="font-bold w-18 border-b my-2"> |
| 95 | + 主题配置{`config_${debugTheme}.js`}: |
| 96 | + </div> |
| 97 | + <div className="text-xs"> |
| 98 | + {Object.keys(themeConfig).map(k => ( |
| 99 | + <div key={k} className="justify-between flex py-1"> |
| 100 | + <span className="bg-indigo-500 p-0.5 rounded text-white mr-2"> |
| 101 | + {k} |
| 102 | + </span> |
| 103 | + <span className="whitespace-nowrap"> |
| 104 | + {filterResult(themeConfig[k] + '')} |
| 105 | + </span> |
105 | 106 | </div>
|
106 |
| - </div> */} |
107 |
| - <div className="font-bold w-18 border-b my-2"> |
108 |
| - 站点配置[blog.config.js] |
109 |
| - </div> |
110 |
| - <div className="text-xs"> |
111 |
| - {siteConfig && Object.keys(siteConfig).map(k => ( |
112 |
| - <div key={k} className="justify-between flex py-1"> |
113 |
| - <span className="bg-blue-500 p-0.5 rounded text-white mr-2"> |
114 |
| - {k} |
115 |
| - </span> |
116 |
| - <span className="whitespace-nowrap"> |
117 |
| - {filterResult(siteConfig[k] + '')} |
118 |
| - </span> |
119 |
| - </div> |
120 |
| - ))} |
121 |
| - </div> |
| 107 | + ))} |
122 | 108 | </div>
|
123 |
| - |
124 |
| - </div> |
125 |
| - </> |
| 109 | + </div> |
| 110 | + */} |
| 111 | + <div className='font-bold w-18 border-b my-2'> |
| 112 | + 站点配置[blog.config.js] |
| 113 | + </div> |
| 114 | + <div className='text-xs'> |
| 115 | + {siteConfig && |
| 116 | + Object.keys(siteConfig).map(k => ( |
| 117 | + <div key={k} className='justify-between flex py-1'> |
| 118 | + <span className='bg-blue-500 p-0.5 rounded text-white mr-2'> |
| 119 | + {k} |
| 120 | + </span> |
| 121 | + <span className='whitespace-nowrap'> |
| 122 | + {filterResult(siteConfig[k] + '')} |
| 123 | + </span> |
| 124 | + </div> |
| 125 | + ))} |
| 126 | + </div> |
| 127 | + </div> |
| 128 | + </div> |
| 129 | + </> |
126 | 130 | )
|
127 | 131 | }
|
128 | 132 | export default DebugPanel
|
0 commit comments