Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
multi-tools-extension
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewenhao
multi-tools-extension
Commits
ff284073
Commit
ff284073
authored
Feb 15, 2025
by
蔺超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Add dark mode support to tools components
parent
a7776a34
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
10 deletions
+11
-10
App.jsx
src/App.jsx
+2
-1
ImageTools.jsx
src/components/ImageTools.jsx
+2
-2
JsonTools.jsx
src/components/JsonTools.jsx
+3
-3
TimeTools.jsx
src/components/TimeTools.jsx
+4
-4
No files found.
src/App.jsx
View file @
ff284073
...
@@ -46,7 +46,8 @@ const App = () => {
...
@@ -46,7 +46,8 @@ const App = () => {
imageState
,
imageState
,
setImageState
,
setImageState
,
timeState
,
timeState
,
setTimeState
setTimeState
,
isDarkMode
};
};
const
menuItems
=
[
const
menuItems
=
[
...
...
src/components/ImageTools.jsx
View file @
ff284073
...
@@ -7,7 +7,7 @@ import { AppContext } from '../App';
...
@@ -7,7 +7,7 @@ import { AppContext } from '../App';
const
{
Text
}
=
Typography
;
const
{
Text
}
=
Typography
;
const
ImageTools
=
()
=>
{
const
ImageTools
=
()
=>
{
const
{
imageState
,
setImageState
}
=
useContext
(
AppContext
);
const
{
imageState
,
setImageState
,
isDarkMode
}
=
useContext
(
AppContext
);
const
{
imageUrl
,
imageFile
,
compressedImageUrl
,
quality
,
originalSize
,
compressedSize
}
=
imageState
;
const
{
imageUrl
,
imageFile
,
compressedImageUrl
,
quality
,
originalSize
,
compressedSize
}
=
imageState
;
const
handleUpload
=
(
info
)
=>
{
const
handleUpload
=
(
info
)
=>
{
...
@@ -53,7 +53,7 @@ const ImageTools = () => {
...
@@ -53,7 +53,7 @@ const ImageTools = () => {
message
.
loading
({
content
:
'正在压缩图片...'
,
key
:
'compressing'
});
message
.
loading
({
content
:
'正在压缩图片...'
,
key
:
'compressing'
});
const
options
=
{
const
options
=
{
maxSizeMB
:
1
,
maxSizeMB
:
Math
.
max
(
0.1
,
(
quality
/
100
)
*
(
imageFile
.
size
/
(
1024
*
1024
)))
,
maxWidthOrHeight
:
1920
,
maxWidthOrHeight
:
1920
,
useWebWorker
:
true
,
useWebWorker
:
true
,
maxIteration
:
10
,
maxIteration
:
10
,
...
...
src/components/JsonTools.jsx
View file @
ff284073
...
@@ -6,7 +6,7 @@ import { AppContext } from '../App';
...
@@ -6,7 +6,7 @@ import { AppContext } from '../App';
const
{
TextArea
}
=
Input
;
const
{
TextArea
}
=
Input
;
const
JsonTools
=
()
=>
{
const
JsonTools
=
()
=>
{
const
{
jsonState
,
setJsonState
}
=
useContext
(
AppContext
);
const
{
jsonState
,
setJsonState
,
isDarkMode
}
=
useContext
(
AppContext
);
const
{
inputValue
,
outputValue
}
=
jsonState
;
const
{
inputValue
,
outputValue
}
=
jsonState
;
const
formatJson
=
()
=>
{
const
formatJson
=
()
=>
{
...
@@ -46,7 +46,7 @@ const JsonTools = () => {
...
@@ -46,7 +46,7 @@ const JsonTools = () => {
value=
{
inputValue
}
value=
{
inputValue
}
onChange=
{
(
e
)
=>
setJsonState
({
...
jsonState
,
inputValue
:
e
.
target
.
value
})
}
onChange=
{
(
e
)
=>
setJsonState
({
...
jsonState
,
inputValue
:
e
.
target
.
value
})
}
placeholder=
"请输入JSON字符串"
placeholder=
"请输入JSON字符串"
style=
{
{
backgroundColor
:
'#ffffff'
,
color
:
'#000000'
}
}
style=
{
{
backgroundColor
:
isDarkMode
?
'#1f1f1f'
:
'#ffffff'
,
color
:
isDarkMode
?
'#ffffff'
:
'#000000'
}
}
/>
/>
<
Space
>
<
Space
>
<
Button
<
Button
...
@@ -75,7 +75,7 @@ const JsonTools = () => {
...
@@ -75,7 +75,7 @@ const JsonTools = () => {
value=
{
outputValue
}
value=
{
outputValue
}
readOnly
readOnly
placeholder=
"格式化/压缩后的JSON将显示在这里"
placeholder=
"格式化/压缩后的JSON将显示在这里"
style=
{
{
backgroundColor
:
'#ffffff'
,
color
:
'#000000'
}
}
style=
{
{
backgroundColor
:
isDarkMode
?
'#1f1f1f'
:
'#ffffff'
,
color
:
isDarkMode
?
'#ffffff'
:
'#000000'
}
}
/>
/>
</
Space
>
</
Space
>
</
div
>
</
div
>
...
...
src/components/TimeTools.jsx
View file @
ff284073
...
@@ -7,7 +7,7 @@ import dayjs from 'dayjs';
...
@@ -7,7 +7,7 @@ import dayjs from 'dayjs';
const
{
Text
}
=
Typography
;
const
{
Text
}
=
Typography
;
const
TimeTools
=
()
=>
{
const
TimeTools
=
()
=>
{
const
{
timeState
,
setTimeState
}
=
useContext
(
AppContext
);
const
{
timeState
,
setTimeState
,
isDarkMode
}
=
useContext
(
AppContext
);
const
[
currentTimestamp
,
setCurrentTimestamp
]
=
useState
(
''
);
const
[
currentTimestamp
,
setCurrentTimestamp
]
=
useState
(
''
);
const
[
selectedDate
,
setSelectedDate
]
=
useState
(
null
);
const
[
selectedDate
,
setSelectedDate
]
=
useState
(
null
);
const
[
selectedTime
,
setSelectedTime
]
=
useState
(
null
);
const
[
selectedTime
,
setSelectedTime
]
=
useState
(
null
);
...
@@ -86,7 +86,7 @@ const TimeTools = () => {
...
@@ -86,7 +86,7 @@ const TimeTools = () => {
placeholder=
"请选择日期"
placeholder=
"请选择日期"
value=
{
selectedDate
}
value=
{
selectedDate
}
onChange=
{
handleDateChange
}
onChange=
{
handleDateChange
}
style=
{
{
width
:
'300px'
,
backgroundColor
:
'
#ffffff
'
}
}
style=
{
{
width
:
'300px'
,
backgroundColor
:
'
inherit'
,
color
:
isDarkMode
?
'#ffffff'
:
'#000000
'
}
}
format=
"YYYY-MM-DD"
format=
"YYYY-MM-DD"
popupStyle=
{
{
maxHeight
:
'160px'
,
top
:
'100px'
}
}
popupStyle=
{
{
maxHeight
:
'160px'
,
top
:
'100px'
}
}
/>
/>
...
@@ -96,7 +96,7 @@ const TimeTools = () => {
...
@@ -96,7 +96,7 @@ const TimeTools = () => {
placeholder=
"请选择时间"
placeholder=
"请选择时间"
value=
{
selectedTime
}
value=
{
selectedTime
}
onChange=
{
handleTimeChange
}
onChange=
{
handleTimeChange
}
style=
{
{
width
:
'300px'
,
backgroundColor
:
'
#ffffff
'
}
}
style=
{
{
width
:
'300px'
,
backgroundColor
:
'
inherit'
,
color
:
isDarkMode
?
'#ffffff'
:
'#000000
'
}
}
format=
"HH:mm:ss"
format=
"HH:mm:ss"
popupStyle=
{
{
maxHeight
:
'160px'
,
top
:
'100px'
}
}
popupStyle=
{
{
maxHeight
:
'160px'
,
top
:
'100px'
}
}
/>
/>
...
@@ -124,7 +124,7 @@ const TimeTools = () => {
...
@@ -124,7 +124,7 @@ const TimeTools = () => {
placeholder=
"请输入时间戳(毫秒)"
placeholder=
"请输入时间戳(毫秒)"
value=
{
inputTimestamp
}
value=
{
inputTimestamp
}
onChange=
{
(
e
)
=>
setInputTimestamp
(
e
.
target
.
value
)
}
onChange=
{
(
e
)
=>
setInputTimestamp
(
e
.
target
.
value
)
}
style=
{
{
width
:
'300px'
,
backgroundColor
:
'
#ffffff'
,
color
:
'#000000'
}
}
style=
{
{
width
:
'300px'
,
backgroundColor
:
'
inherit'
,
color
:
isDarkMode
?
'#ffffff'
:
'#000000'
}
}
/>
/>
<
Space
>
<
Space
>
<
Button
<
Button
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment