我正在使用this boilerplate来创建一个基于反应的应用程序。我有这样的基本代码:如何在react-bootstrap中编辑样式?
App.js:
render() {
const styles = require('./App.scss');
return (
<div className="styles.app">
<Helmet {...config.app.head}/>
<Navbar fixedTop className={styles.navbar}>
<Navbar.Header>
<Navbar.Brand>
<IndexLink to="/" activeStyle={{color: '#33e0ff'}}>
<div className={styles.brand}/>
</IndexLink>
</Navbar.Brand>
<Navbar.Toggle/>
</Navbar.Header>
</Navbar>
</div>
);
}
App.scss:
.app {
.navbar{
background: #1b6d85;
}
.brand {
position: absolute;
$size: 40px;
top: 5px;
left: 5px;
display: inline-block;
background: #2d2d2d;
width: $size;
height: $size;
background-size: 80%;
margin: 0 10px 0 0;
border-radius: $size/2;
}
nav :global(.fa) {
font-size: 2em;
line-height: 20px;
}
}
.appContent {
margin: 50px 0; // for fixed navbar
}
对于Navbar
标签,我尝试使用既className
作为在模板和bsStyle
完成正如我在网上看到的一些问题。我还没有能够成功地编辑react-bootstrap的任何组件。 如果我在react-bootstrap网站上错过了这个文档,请将它指向我。谢谢。
你有没有在您的index.html添加bootstrap.min.css和bootstrap.min.js作为依赖 –
不,我没有,如果有人需要知道将风格添加到react-bootstrap中。你能否提供一些参考? –