0
我有一種我正在應用於ActionSearch圖標的樣式,但不幸的是它不會通過。樣式不適用於MaterialUI中的SVGIcon React
不知道我可以寫更多的問題,我認爲這很簡單,但紙張獲取樣式時,圖標組件不。
任何想法爲什麼會這樣?
import React from 'react';
import Paper from 'material-ui/Paper';
import TextField from 'material-ui/TextField';
import IconButton from 'material-ui/IconButton';
import ActionSearch from 'material-ui/svg-icons/action/search';
const stylePaper = {
width: 400,
margin: '40px auto',
paddingBottom: 10,
textAlign: 'center',
display: 'inline-block'
};
const styleIcon = {
position: 'absolute',
top: 20
};
export default class Home extends React.Component {
constructor(props) {
super(props);
this.state = {value: ''};
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleChange(event) {
this.setState({value: event.target.value});
}
handleSubmit(event) {
alert('A name was submitted: ' + this.state.value);
event.preventDefault();
}
render() {
return (
<form onSubmit={this.handleSubmit}>
<Paper zDepth={2} style={stylePaper} >
<TextField
hintText="Type in brand, position or industry"
/>
<IconButton>
<ActionSearch style={styleIcon} />
</IconButton>
</Paper>
</form>
);
}
}
這裏是檢查圖像
我認爲你是對的,只要我確認我會編輯答案(加入react-router):) – AlexGvozden
就是這樣,謝謝你! – AlexGvozden