reactjs - 带有媒体查询的样式化组件不同的继承
问题描述
我想更改桌面/移动设备的样式化组件继承。
// Typography.js
const TextXSmall = styled.p`
font-size: 10px;
// ... many more attributes
`;
export const TextXS = ({ children, className }) => {
return <TextXSmall className={className}>{children}</TextXSmall>;
};
// OtherFile.js
import { TextXS, TextXXS } from 'Framework/Styles/Typography';
const NotificationText = styled(TextXXS)`
@media only screen and (max-width: 767px) {
${TextXS} // => Overwrite css here
}
`
然而这不起作用。有什么办法可以做到这一点?我不想将媒体查询移至typography.js,因为根据站点上的位置,它可能会发生变化。
解决方案
推荐阅读
- javascript - AWS Lambda - 如何处理函数中的请求处理顺序
- vb.net - 两次打开颜色对话框?
- spring-cloud-stream - Spring Cloud Stream融合模式注册表不起作用
- python - 如何在 Tkinter 的另一个框架内添加一个框架?
- konvajs - 绘制矩形不能遮蔽我的图像
- web-services - Spring 集成 web 服务 jms
- sql - 获取表中下一行的值总和
- java - Java 8:如何转换列表
- javascript - 在提交表单时调用 Javascript 函数
- angularjs - 如何在Angularjs中动态设置方法名称