Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
chanjet-nova-theme
Advanced tools
现在,我们以一个简单的支持 theme 的组件 InputGroup
来示范。InputGroup
是一个水平布局的组件,其中可以包含 Icon
、Input
,假设我们这里的 Icon
,Input
都已经实现了 theme 化管理,现在示例 InputGroup
如何实现 theme 的支持。
InputGroup.js
import React, {createElement} from 'react';
import classnames from 'classnames';
import {connectStyle} from 'chanjet-nova-ui-theme';
const InputGroup = props => {
let {className, children, ...others} = props;
// classnames 支持将多个 className 进行合并
className = classnames[className];
return (
<div className={className} {...others}>
{children}
</div>
)
}
InputGroup.propTypes = {
}
const StyledInputGroup = connectStyle('chanjet.ui.InputGroup')(StyledInputGroup);
export {
StyledInputGroup as InputGroup
}
Theme.js
const theme = {
// 组件样式声明,key 为 InputGroup.js 中 connectStyle 声明的名称。
'chanjet.ui.InputGroup': {
'chanjet.ui.Icon': {
display:'inline-block',
marginRight: '4px',
},
'chanjet.ui.Input': {
display:'inline-block'
},
‘.small': {
height: '32px'
},
display:'inline-block',
verticalAlign: 'middle'
}
}
export default theme;
App.js
import React from 'react';
import {StyleProvider} from 'chanjet-nova-ui-theme';
import InputGroup from './InputGroup';
import Icon from './Icon';
import Input from './Input';
import theme from './Theme';
export default App extends React.Component {
render() {
return (
<StyleProvider style={theme} mountNode='stylesheet'>
<div>
<h1>It Works!</h1>
<InputGroup styleName="small">
<Icon name="ic_access_alarm" />
<Input type='number' />
</InputGroup>
</div>
</StyleProvider>
)
}
}
render(<App />, document.querySelector("#app"));
index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>React App</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="container">
<div id="app">Loading...</div>
</div>
<style id="stylesheet"></style>
</body>
</html>
FAQs
Chanjet nova ui theme provider
The npm package chanjet-nova-theme receives a total of 0 weekly downloads. As such, chanjet-nova-theme popularity was classified as not popular.
We found that chanjet-nova-theme demonstrated a healthy version release cadence and project activity because the last version was released less than 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.