Skip to content

Commit

Permalink
Update: Created a compiled version, props are now passed, and the com…
Browse files Browse the repository at this point in the history
…ponent is now claimable.
  • Loading branch information
javierbyte committed May 3, 2015
1 parent 2935f9c commit 273961d
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 46 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,2 +1,3 @@
**/node_modules
*.log
*.log
dist
10 changes: 10 additions & 0 deletions README.md
Expand Up @@ -25,3 +25,13 @@ Simple component to put an invisible `Select` dropdown over a text.
Dont forget to add styles.

<link rel="stylesheet" href="/node_modules/react-textselect/textselect.css">

# Build

If you want to build this from source, you will need babel and less.

npm install -g babel less

And run the pre publish script

npm run prepublish
20 changes: 4 additions & 16 deletions package.json
@@ -1,9 +1,10 @@
{
"name": "react-textselect",
"version": "0.0.5",
"version": "0.1.0",
"description": "Select dropdown over text in React.",
"main": "textselect.jsx",
"main": "dist/textselect.js",
"scripts": {
"prepublish": "mkdir -p dist && babel src/textselect.jsx -u -o dist/textselect.js --stage 1 && lessc src/textselect.less dist/textselect.css",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
Expand All @@ -13,19 +14,6 @@
"text",
"select"
],
"peerDependencies": {
"react": "^0.12.x"
},
"author": "javierbyte",
"license": "ISC",
"browserify": {
"transform": [
[
"reactify",
{
"es6": true
}
]
]
}
"license": "ISC"
}
12 changes: 9 additions & 3 deletions textselect.jsx → src/textselect.jsx
Expand Up @@ -13,12 +13,18 @@ var TextSelect = React.createClass({
},

render() {
var {options, active, onChange, className, ...other} = this.props;

var classes = 'react-textselect';

if(className) classes += ' ' + className;

return (
<span className='react-textselect'>
{this.props.options[this.props.active]}
<span className={classes}>
{options[active]}

<select className='react-textselect-input' onChange={this.handleChange}>
{this.props.options.map(function(value, index) {
{options.map(function(value, index) {
return (
<option key={index}>{value}</option>
)
Expand Down
28 changes: 28 additions & 0 deletions src/textselect.less
@@ -0,0 +1,28 @@
.react-textselect {
border-bottom: 1px solid rgba(0, 0, 0, .33);
overflow: hidden;
padding-right: 1em;
margin-right: .17em;
cursor: pointer;

&::after {
position: absolute;
top: .45em;
right: 0;
display: block;
content: '';
height: 0;
width: 0;
border: .33em solid transparent;
border-top: .33em solid rgba(0, 0, 0, .33);
}

&-input {
position: absolute;
top: 0;
left: 0;
right: 0;
width: 100%;
opacity: 0;
}
}
26 changes: 0 additions & 26 deletions textselect.css

This file was deleted.

0 comments on commit 273961d

Please sign in to comment.