├── examples ├── .babelrc ├── src │ ├── .babelrc │ ├── popup_text.js │ ├── index.js │ └── popup_table.js ├── index.html ├── popup_text.html ├── popup_table.html ├── package.json ├── webpack.config.babel.js └── css │ └── style.css ├── .DS_Store ├── assets └── record.gif ├── src ├── index.js ├── .babelrc ├── PopupText.js ├── PopupTable.scss ├── PopupMenu.scss ├── PopupMenu.js └── PopupTable.js ├── test ├── .babelrc ├── PopupText.test.js ├── PopupTable.test.js ├── PopupMenu.test.js └── __snapshots__ │ ├── PopupText.test.js.snap │ ├── PopupTable.test.js.snap │ └── PopupMenu.test.js.snap ├── .babelrc ├── .travis.yml ├── LICENSE ├── .gitignore ├── rollup.config.babel.js ├── package.json └── README.md /examples/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["es2015"] 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sasha240100/react-rectangle-popup-menu/HEAD/.DS_Store -------------------------------------------------------------------------------- /assets/record.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sasha240100/react-rectangle-popup-menu/HEAD/assets/record.gif -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | export * from './PopupMenu'; 2 | export * from './PopupTable'; 3 | export * from './PopupText'; 4 | -------------------------------------------------------------------------------- /test/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "react"], 3 | "plugins": [ 4 | "transform-class-properties", 5 | "transform-object-rest-spread" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["es2015", {"modules": false}] 4 | ], 5 | "env": { 6 | "test": { 7 | "presets": ["es2015", "react"] 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/src/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["es2015", {"modules": false}], 4 | "react" 5 | ], 6 | "plugins": [ 7 | "transform-class-properties", 8 | "transform-object-rest-spread" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /src/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["es2015", {"modules": false}], 4 | "react" 5 | ], 6 | "plugins": [ 7 | "transform-class-properties", 8 | "transform-object-rest-spread", 9 | "external-helpers" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /src/PopupText.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | 3 | export class PopupText extends Component { 4 | render() { 5 | return ( 6 |
7 | {this.props.children} 8 |
9 | ) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | 5 | install: 6 | - npm install 7 | 8 | script: 9 | - npm run build 10 | 11 | deploy: 12 | provider: pages 13 | skip-cleanup: true 14 | github-token: $GITHUB_TOKEN # Set in travis-ci.org dashboard, marked secure 15 | keep-history: true 16 | on: 17 | branch: master 18 | -------------------------------------------------------------------------------- /test/PopupText.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {PopupMenu, PopupText} from '../build/rrpm.module'; 3 | import renderer from 'react-test-renderer'; 4 | 5 | test('PopupTable', () => { 6 | const component = renderer.create( 7 | 8 | Test 9 | 10 | ); 11 | 12 | let tree = component.toJSON(); 13 | expect(tree).toMatchSnapshot(); 14 | }); 15 | -------------------------------------------------------------------------------- /examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/PopupTable.scss: -------------------------------------------------------------------------------- 1 | .PopupTable { 2 | display: flex; 3 | flex-direction: row; 4 | justify-content: space-around; 5 | width: calc(200px - 10px); 6 | flex-flow: row wrap; 7 | // align-content: flex-start; 8 | } 9 | 10 | .item { 11 | padding: 5px; 12 | border-radius: 2px; 13 | transition: background 0.15s ease-in-out; 14 | 15 | &:hover { 16 | background: rgba(0,0,0,0.1); 17 | } 18 | } 19 | 20 | .placeholder { 21 | padding: 0px; 22 | height: 10px; 23 | display: block; 24 | border-radius: 2px; 25 | visibility: hidden; 26 | } 27 | -------------------------------------------------------------------------------- /examples/popup_text.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/popup_table.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/PopupTable.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {PopupMenu, PopupTable} from '../build/rrpm.module'; 3 | import renderer from 'react-test-renderer'; 4 | 5 | test('PopupTable', () => { 6 | const component = renderer.create( 7 | 8 | 9 | 1 10 | 2 11 | 3 12 | 4 13 | 14 | 15 | ); 16 | 17 | let tree = component.toJSON(); 18 | expect(tree).toMatchSnapshot(); 19 | }); 20 | -------------------------------------------------------------------------------- /examples/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examples", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "devDependencies": { 12 | "babel-loader": "^7.1.2", 13 | "babel-preset-react": "^6.24.1", 14 | "babel-register": "^6.26.0", 15 | "express": "^4.16.2", 16 | "webpack": "^3.11.0", 17 | "webpack-dev-server": "^2.11.1" 18 | }, 19 | "dependencies": { 20 | "font-awesome": "^4.7.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /examples/src/popup_text.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import FontAwesome from 'react-fontawesome'; 4 | import {PopupMenu, PopupText} from 'react-rectangle-popup-menu'; 5 | 6 | import 'font-awesome/css/font-awesome.css'; 7 | 8 | const button = (); 9 | 10 | const Application = () => ( 11 |
12 | 13 | Some text 14 | 15 |
16 | ); 17 | 18 | ReactDOM.render( 19 | , 20 | document.getElementById('app') 21 | ) 22 | -------------------------------------------------------------------------------- /test/PopupMenu.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {PopupMenu} from '../build/rrpm.module'; 3 | import renderer from 'react-test-renderer'; 4 | 5 | describe('PopupMenu', () => { 6 | const component = renderer.create( 7 | 8 | ); 9 | 10 | let tree; 11 | 12 | it('should render correctly', () => { 13 | tree = component.toJSON(); 14 | expect(tree).toMatchSnapshot(); 15 | }); 16 | 17 | // Hover button 18 | it('should respond to mouse hover', () => { 19 | tree.children[0].props.onMouseOver(); 20 | tree = component.toJSON(); 21 | expect(tree).toMatchSnapshot(); 22 | }); 23 | 24 | // Unhover button 25 | it('should respond to mouse unhover', () => { 26 | tree.children[0].props.onMouseOut(); 27 | tree = component.toJSON(); 28 | expect(tree).toMatchSnapshot(); 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /test/__snapshots__/PopupText.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`PopupTable 1`] = ` 4 |
7 |
12 |
25 |
32 | 33 | Test 34 | 35 |
36 |
37 |
38 | `; 39 | -------------------------------------------------------------------------------- /examples/src/index.js: -------------------------------------------------------------------------------- 1 | import React, {Fragment} from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import FontAwesome from 'react-fontawesome'; 4 | import {PopupMenu, PopupTable} from 'react-rectangle-popup-menu'; 5 | 6 | import 'font-awesome/css/font-awesome.css'; 7 | 8 | const button = (); 9 | 10 | const Application = () => ( 11 | 12 | 18 |