gpt4 book ai didi

CSS没有反射(reflect)在react js中

转载 作者:行者123 更新时间:2023-11-28 00:01:52 25 4
gpt4 key购买 nike

我正在尝试覆盖 reacstrap 组件以及一些 html 元素。但是 CSS 没有反射(reflect)在那些上。这是组件。

const DeleteKpiModal = ({isOpen, kpiToDelete, toggle, handleDeleteKpi}) => (
<Modal isOpen={isOpen} toggle={() => toggle(null)}>
<ModalBody>
<h2 className="heading-style">Delete KPI?</h2>
<p className="delete-content">
Are you sure you want to delete this?
Once deleted, the data will be lost and will not be able to be recovered.
</p>
</ModalBody>
<ModalFooter className="display-button">
<Button className="delete-button" size="md" block onClick={() => handleDeleteKpi(kpiToDelete)}>Delete</Button>
<Button className="cancel-button" color="secondary" size="md" block onClick={() => toggle(null)}>Cancel</Button>
</ModalFooter>
<style jsx>{styles}</style>
</Modal>
)

这是 Css。忘记这里的导入我正在使用 sass/scss 这样做。

const styles = scss`

@import "bootstrap-extended/jsx-import";
$bg-red: #e04c33;

.delete-button{
background-color: $bg-red;
color:#fff;
}
.delete-content{
borderBottom:1px dashed #dce1e5;
paddingBottom:3rem;
}
.heading-style{
color: $bg-red;
}
.cancel-button{
backgroundColor:#fff;
color:#047adc;
border:2px solid #047adc;
marginLeft:0;
}
.display-button{
display:initial;
padding-top:0;
}
`

请帮助我哪里做错了。

最佳答案

我是这样申请的。我为上层组件创建了一个类并像那样使用它。

<style jsx global>{`
$bg-red: #e04c33;

.delete-kpi-modal{
.delete-button{
background-color: $bg-red;
color:#fff;
}
.delete-content{
border-bottom:1px dashed #dce1e5;
padding-bottom:3rem;
}
.heading-style{
color: $bg-red;
text-align:center;
}
.cancel-button{
background-color:#fff;
color:#047adc;
border:2px solid #047adc;
margin-left:0;
}
.display-button{
display:initial;
padding-top:0;
}
}
`
}
</style>

这行得通

关于CSS没有反射(reflect)在react js中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55951973/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com