1
1
import React from 'react' ;
2
- import { Layout , Typography } from 'antd' ;
3
- import { StepBackwardFilled , StepForwardFilled } from '@ant-design/icons' ;
2
+ import { Layout , Typography , Button } from 'antd' ;
3
+ import { StepBackwardFilled , StepForwardFilled , ShareAltOutlined } from '@ant-design/icons' ;
4
4
import Input from '../Input' ;
5
+ import { downloadPreviewImage } from '../../utils/download' ;
5
6
6
7
const { Header : AntHeader } = Layout ;
7
8
const { Title } = Typography ;
@@ -33,26 +34,24 @@ const Header: React.FC<HeaderProps> = ({ isDarkMode, onSubmit, leftSiderCollapse
33
34
borderBottom : `1px solid ${ isDarkMode ? '#303030' : '#f0f0f0' } `
34
35
} }
35
36
>
36
- < div style = { { display : 'flex' , alignItems : 'center' , gap : '16px' } } >
37
- { leftSiderCollapsed ? (
38
- < StepForwardFilled
39
- style = { {
40
- fontSize : '18px' ,
41
- color : isDarkMode ? '#ffffff' : '#000000' ,
42
- cursor : 'pointer'
43
- } }
44
- onClick = { onLeftSiderCollapse }
45
- />
46
- ) : (
47
- < StepBackwardFilled
48
- style = { {
49
- fontSize : '18px' ,
50
- color : isDarkMode ? '#ffffff' : '#000000' ,
51
- cursor : 'pointer'
52
- } }
53
- onClick = { onLeftSiderCollapse }
54
- />
55
- ) }
37
+ < div style = { { display : 'flex' , alignItems : 'center' , gap : '16px' } } >
38
+ < Button
39
+ type = "default"
40
+ icon = { leftSiderCollapsed ? (
41
+ < StepForwardFilled style = { { color : '#fa8c16' } } />
42
+ ) : (
43
+ < StepBackwardFilled style = { { color : isDarkMode ? '#ffffff' : '#000000' } } />
44
+ ) }
45
+ onClick = { onLeftSiderCollapse }
46
+ style = { {
47
+ padding : 0 ,
48
+ width : '32px' ,
49
+ height : '32px' ,
50
+ display : 'flex' ,
51
+ alignItems : 'center' ,
52
+ justifyContent : 'center'
53
+ } }
54
+ />
56
55
< Title
57
56
level = { 4 }
58
57
style = { {
@@ -76,27 +75,42 @@ const Header: React.FC<HeaderProps> = ({ isDarkMode, onSubmit, leftSiderCollapse
76
75
</ a >
77
76
</ Title >
78
77
</ div >
79
- < div style = { { marginLeft : 'auto' , flex : '0 1 420px' , display : 'flex' , alignItems : 'center' , gap : '16px' } } >
80
- < Input onSubmit = { onSubmit } />
81
- { rightSiderCollapsed ? (
82
- < StepBackwardFilled
78
+ < div style = { { flex : '1 1 auto' , display : 'flex' , alignItems : 'center' , position : 'relative' } } >
79
+ < div style = { { position : 'absolute' , left : '50%' , transform : 'translateX(-50%)' , width : '420px' } } >
80
+ < Input onSubmit = { onSubmit } />
81
+ </ div >
82
+ < div style = { { marginLeft : 'auto' , display : 'flex' , alignItems : 'center' , gap : '16px' } } >
83
+ < Button
84
+ type = "default"
85
+ icon = { < ShareAltOutlined style = { { color : isDarkMode ? '#ffffff' : '#000000' } } /> }
86
+ onClick = { ( ) => downloadPreviewImage ( ) }
83
87
style = { {
84
- fontSize : '18px' ,
85
- color : isDarkMode ? '#ffffff' : '#000000' ,
86
- cursor : 'pointer'
88
+ padding : 0 ,
89
+ width : '32px' ,
90
+ height : '32px' ,
91
+ display : 'flex' ,
92
+ alignItems : 'center' ,
93
+ justifyContent : 'center'
87
94
} }
88
- onClick = { onRightSiderCollapse }
89
95
/>
90
- ) : (
91
- < StepForwardFilled
96
+ < Button
97
+ type = "default"
98
+ icon = { rightSiderCollapsed ? (
99
+ < StepBackwardFilled style = { { color : '#fa8c16' } } />
100
+ ) : (
101
+ < StepForwardFilled style = { { color : isDarkMode ? '#ffffff' : '#000000' } } />
102
+ ) }
103
+ onClick = { onRightSiderCollapse }
92
104
style = { {
93
- fontSize : '18px' ,
94
- color : isDarkMode ? '#ffffff' : '#000000' ,
95
- cursor : 'pointer'
105
+ padding : 0 ,
106
+ width : '32px' ,
107
+ height : '32px' ,
108
+ display : 'flex' ,
109
+ alignItems : 'center' ,
110
+ justifyContent : 'center'
96
111
} }
97
- onClick = { onRightSiderCollapse }
98
112
/>
99
- ) }
113
+ </ div >
100
114
</ div >
101
115
</ AntHeader >
102
116
) ;
0 commit comments