Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
react-cqtoolbox
Advanced tools
[![Travis][build-badge]][build] [![npm package][npm-badge]][npm] [![Coveralls][coveralls-badge]][coveralls]
react-cqtoolbox
是针对于cqaso产品场景开发的一系列的pc端react组件集。
包括的场景有:后台管理系统,CQASO,TOPASM操作复杂的PC网站。
npm install react-cqtoolbox --save
CSS Modules
的样式开发环境例如:
{
test: /\.css$/,
include: [
/node_modules/
],
loaders: ['style', 'css?modules&localIdentName=[name]__[local]___[hash:base64:5]', 'postcss'],
}
postcss: function (webpack) {
return [
require('postcss-smart-import')({
addDependencyTo: webpack
}),
require('postcss-mixins')({mixins}),
require('postcss-cssnext')({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9',
]
}),
require('postcss-nested')(),
];
},
webpack配置请参考这里
下面是简单的例子,以按钮为例:
import React from 'react';
import Button from 'react-cqtoolbox/lib/button';
ReactDOM.render(
<Button label="Hello World!" />,
document.getElementById('app')
);
每个组件接受一个主题theme
属性,旨在提供一个CSS模块导入对象,组件将使用该对象将本地类名分配给其DOM节点。所以如果你想自定义组件,你只需要提供一个主题theme
对象与适当的类名映射,从而修改默认样式。
如果组件已经注入了一个主题,那么您传递的属性将与注入的属性合并。
这样,您可以向特定组件的节点添加类名,并使用它们来添加或覆盖样式。例如,如果要自定义Input背景为红色:
/* customInput.css */
.input {
background: red;
}
import React from 'react';
import Input from 'react-cqtoolbox/lib/input';
import theme from './customInput.css';
const CustomInput = (props) => (
<Input {...props} theme={theme} />
);
export default CustomInput;
优点:通过类覆盖的方式修改样式更加灵活自如。
CSS Modules 对CSS中的class名都做了处理,使用对象来保存原class和混淆后的class的对应关系。
FAQs
[![Travis][build-badge]][build] [![npm package][npm-badge]][npm] [![Coveralls][coveralls-badge]][coveralls]
We found that react-cqtoolbox demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.