【发布时间】:2021-09-28 00:33:17
【问题描述】:
在我的 React 应用程序中悬停时,我在使按钮变暗时遇到问题。问题是我使用linear-gradient 作为它的背景颜色。如果我没有将背景声明为linear-gradient,则来自polished (https://www.npmjs.com/package/polished) npm 包的darken 可以工作
请在此处查看我的代码
const AddButton= styled.button`
width: 100%;
background: linear-gradient(
${(props) => props.theme.colors.secondary},
${(props) => props.theme.colors.primary}
);
:hover, :active {
background-color: ${(props) => props.theme.colors && darken(0.1, props.theme.colors.primary)};
}
`;
【问题讨论】:
标签: javascript reactjs ecmascript-6 react-hooks styled-components