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.
react-lite-dropdown
Advanced tools
Dropdown component from Talk by Teambition.
Demo http://ui.talk.ai/react-lite-dropdown/
####Dropdown
displayText
(string)
Text to display when selected. You will get is-chosen
in className
of root element when it's specified.
defaultText
(string.isRequired)
Text to display when displayText
is undefined
.
name
(string)
CSS hook for this components, defaults to default
. Suppose it's x
, the generated className
is is-for-x
.
show
(bool.isRequired)
Defines whether DropdownMenu
is shown or not.
onToggle
(func.isRequired)
Things happened when toggle dropdown.
this.props.children
Content to render in the menu opened after clicked.
This component suppose you are using it in such scenarios:
<select>
, with default text and selectedwindow
and menu is then closedIn chinese. 中文表达更明确一些, 这个组件做了一些假定, 使用需要注意:
<select>
, 有 选中/未选中 状态, 用 CSS hook 修改颜色this.props.children
传入npm i --save react-lite-dropdown
Read src/main.jsx(compiles with Babel) for details:
import {default as React} from 'react';
import './demo.css';
import {default as LiteDropdown} from 'react-lite-dropdown';
import 'react-lite-dropdown/src/style.css'; // CSS if you need
var languages = 'CoffeeScript PureScript Elm CirruScript'.split(' ');
var App = React.createClass({
displayName: 'page-app',
getInitialState: function() {
return {
lang: undefined
};
},
onItemClick: function(lang) {
return this.setState({
lang: lang
});
},
renderLanguages: function() {
console.log(languages);
var self = this;
return languages.map(function(lang) {
var onClick = function() {
return self.onItemClick(lang);
};
return <div key={lang} className={'item'} onClick={onClick}>{lang}</div>;
});
},
render: function() {
return <LiteDropdown
displayText={this.state.lang}
defaultText={'Click to select one'}
name={'css-hook-demo'}>{this.renderLanguages()}</LiteDropdown>
}
});
var PageApp = React.createFactory(App);
var demo = document.querySelector('.demo');
React.render(PageApp(), demo);
npm i
You need a static file server for the HTML files. Personally I suggest using Nginx.
Develop:
gulp html # regenerate index.html
webpack-dev-server --hot # enable live-reloading
Build (Pack and optimize js, reivision js and add entry in index.html
):
gulp build
MIT
FAQs
Dropdown menu from Talk by teambition
The npm package react-lite-dropdown receives a total of 2 weekly downloads. As such, react-lite-dropdown popularity was classified as not popular.
We found that react-lite-dropdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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.