Skip to content

Commit 988b8b8

Browse files
author
yan1
committed
feat: change toolbar UI
1 parent 6c8b94d commit 988b8b8

File tree

4 files changed

+35
-18
lines changed

4 files changed

+35
-18
lines changed

public/icons/goback.png

2.51 KB
Loading

src/App.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,6 @@ class App extends React.Component<Props, State> {
2626
// url: 'icons/comb.png',
2727
// subTools: []
2828
// },
29-
{
30-
name: 'Repel',
31-
type: 'png',
32-
url: 'icons/repel.png',
33-
subTools: []
34-
},
35-
{
36-
name: 'Attract',
37-
type: 'png',
38-
url: 'icons/attract.png',
39-
subTools: []
40-
},
4129
{
4230
name: 'Transform',
4331
type: 'png',
@@ -48,7 +36,20 @@ class App extends React.Component<Props, State> {
4836
name: 'Drag',
4937
type: 'png',
5038
url: 'icons/drag.png',
51-
subTools: []
39+
subTools: [
40+
{
41+
name: 'Repel',
42+
type: 'png',
43+
url: 'icons/repel.png',
44+
subTools: []
45+
},
46+
{
47+
name: 'Attract',
48+
type: 'png',
49+
url: 'icons/attract.png',
50+
subTools: []
51+
}
52+
]
5253
},
5354
{
5455
name: 'Bend',
@@ -131,7 +132,7 @@ class App extends React.Component<Props, State> {
131132
]
132133
},
133134
{
134-
name: 'Text',
135+
name: 'Adjust',
135136
type: 'png',
136137
url: 'icons/label.png',
137138
subTools: []

src/components/menubar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class MenuBar extends Component<Props, State> {
123123
this.state = {
124124
option: 0,
125125
toolIconUrl: '',
126-
goBackIconUrl: 'icons/terminate_active.png'
126+
goBackIconUrl: 'icons/goback.png'
127127
};
128128
}
129129

src/components/statebar/FontBar/index.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React, { Component } from 'react';
22
import styled from 'styled-components';
33
import { connect } from 'react-redux';
4-
import { StateType } from '../../../types';
4+
import { StateType, DispatchType } from '../../../types';
5+
import { setTool } from '../../../store/actions';
56
import { getSelectedVisualObjects } from '../../../store/selectors';
67
import { Input, Slider, Popover, Menu, Dropdown, Button } from 'antd';
78
import { PointText } from 'paper';
@@ -13,9 +14,16 @@ const mapStateToProps = (state: StateType) => {
1314
};
1415
};
1516

17+
const mapDispatchToProps = (dispatch: DispatchType) => {
18+
return {
19+
activateTool: (name: string, use: boolean) => dispatch(setTool(name, use))
20+
};
21+
};
22+
1623
type Props = {
1724
xOffSet?: number;
18-
} & ReturnType<typeof mapStateToProps>;
25+
} & ReturnType<typeof mapStateToProps> &
26+
ReturnType<typeof mapDispatchToProps>;
1927

2028
type State = {
2129
fontFamily: string;
@@ -97,6 +105,14 @@ class FontBar extends Component<Props, State> {
97105
);
98106
return (
99107
<FontBar>
108+
<Button
109+
shape="circle"
110+
onClick={() => {
111+
this.props.activateTool('Text', true);
112+
}}
113+
>
114+
115+
</Button>
100116
<Dropdown overlay={menu} trigger={['click']}>
101117
<Button
102118
style={{
@@ -127,4 +143,4 @@ class FontBar extends Component<Props, State> {
127143
}
128144
}
129145

130-
export default connect(mapStateToProps, null)(FontBar);
146+
export default connect(mapStateToProps, mapDispatchToProps)(FontBar);

0 commit comments

Comments
 (0)