Skip to content

Commit 57b1059

Browse files
author
Herman Starikov
committed
second initial commit
1 parent fab8fe5 commit 57b1059

15 files changed

+436
-325
lines changed

.eslintrc

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"extends": "airbnb",
3+
"env": {
4+
"node": true,
5+
"es6": true
6+
},
7+
"parser": "babel-eslint",
8+
"globals": {
9+
"it": true,
10+
"expect": true,
11+
"describe": true,
12+
"jest": true,
13+
"document": true,
14+
"location": true,
15+
"test": true,
16+
"window": true,
17+
"fetch": true,
18+
"WebSocket": true,
19+
"alert": true
20+
},
21+
"rules": {
22+
"react/jsx-filename-extension": 0,
23+
"react/forbid-prop-types": 0,
24+
"react/jsx-boolean-value": 0,
25+
"react/jsx-first-prop-new-line": 0,
26+
"react/jsx-closing-bracket-location": 0,
27+
"react/no-multi-comp": 0,
28+
"react/prop-types": 0,
29+
"react/no-string-refs": 0,
30+
"react/jsx-no-bind": 0,
31+
"react/prefer-stateless-function": 0,
32+
"react/jsx-indent": 0,
33+
"import/no-unresolved": 0,
34+
"import/no-extraneous-dependencies": 0,
35+
"import/extensions": 0,
36+
"import/first": 0,
37+
"import/no-dynamic-require": 0,
38+
"jsx-quotes": ["error", "prefer-double"],
39+
"jsx-a11y/label-has-for": [ 2, {
40+
"components": [ "Label" ],
41+
"required": {
42+
"every": [ "id" ]
43+
},
44+
"allowChildren": false,
45+
}],
46+
"jsx-a11y/anchor-is-valid": 0,
47+
"jsx-a11y/img-has-alt": 0,
48+
"no-alert": 0,
49+
"no-use-before-define": 0,
50+
"no-console": 0,
51+
"no-tabs": 0,
52+
"no-param-reassign": 0,
53+
"no-underscore-dangle": 0,
54+
"comma-dangle": 0,
55+
"semi": ["error", "never"],
56+
"no-return-assign": 0,
57+
"no-plusplus": 0,
58+
"no-debugger": 0,
59+
"global-require": 0,
60+
"object-property-newline": 0,
61+
"arrow-parens": 0,
62+
"no-confusing-arrow": 0,
63+
"function-paren-newline": 0,
64+
"prefer-default-export": 0,
65+
"no-mixed-operators": 0,
66+
"no-nested-ternary": 0
67+
}
68+
}

.sass-lint.yml

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
options:
2+
formatter: stylish
3+
files:
4+
include: '**/*.s+(a|c)ss'
5+
rules:
6+
# Extends
7+
extends-before-mixins: 1
8+
extends-before-declarations: 1
9+
placeholder-in-extend: 1
10+
11+
# Mixins
12+
mixins-before-declarations: 1
13+
14+
# Line Spacing
15+
one-declaration-per-line: 1
16+
empty-line-between-blocks: 1
17+
single-line-per-selector: 1
18+
19+
# Disallows
20+
no-attribute-selectors: 0
21+
no-color-hex: 0
22+
no-color-keywords: 1
23+
no-color-literals: 1
24+
no-combinators: 0
25+
no-css-comments: 1
26+
no-debug: 1
27+
no-disallowed-properties: 0
28+
no-duplicate-properties: 1
29+
no-empty-rulesets: 1
30+
no-extends: 0
31+
no-ids: 1
32+
no-important: 1
33+
no-invalid-hex: 1
34+
no-mergeable-selectors: 1
35+
no-misspelled-properties: 1
36+
no-qualifying-elements: 1
37+
no-trailing-whitespace: 1
38+
no-trailing-zero: 1
39+
no-transition-all: 1
40+
no-universal-selectors: 0
41+
no-url-domains: 1
42+
no-url-protocols: 1
43+
no-vendor-prefixes: 1
44+
no-warn: 1
45+
property-units: 0
46+
47+
# Nesting
48+
declarations-before-nesting: 1
49+
force-attribute-nesting: 1
50+
force-element-nesting: 1
51+
force-pseudo-nesting: 1
52+
53+
# Name Formats
54+
class-name-format: 1
55+
function-name-format: 1
56+
id-name-format: 0
57+
mixin-name-format: 1
58+
placeholder-name-format: 1
59+
variable-name-format: 1
60+
61+
# Style Guide
62+
attribute-quotes: 1
63+
bem-depth: 0
64+
border-zero: 1
65+
brace-style: 1
66+
clean-import-paths: 1
67+
empty-args: 1
68+
hex-length: 1
69+
hex-notation: 1
70+
indentation: 1
71+
leading-zero: 1
72+
max-line-length: 0
73+
max-file-line-count: 0
74+
nesting-depth: 1
75+
property-sort-order: 1
76+
pseudo-element: 1
77+
quotes: 1
78+
shorthand-values: 1
79+
url-quotes: 1
80+
variable-for-property: 1
81+
zero-unit: 1
82+
83+
# Inner Spacing
84+
space-after-comma: 1
85+
space-before-colon: 1
86+
space-after-colon: 1
87+
space-before-brace: 1
88+
space-before-bang: 1
89+
space-after-bang: 1
90+
space-between-parens: 1
91+
space-around-operator: 1
92+
93+
# Final Items
94+
trailing-semicolon: 1
95+
final-newline: 1

package.json

+11
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,24 @@
22
"name": "react-bootstrap-offcanvas",
33
"version": "0.1.0",
44
"private": true,
5+
"main": "src/NavbarOffcanvas.js",
56
"dependencies": {
67
"react": "^16.2.0",
78
"react-bootstrap": "^0.31.5",
89
"react-dom": "^16.2.0",
910
"react-scripts": "1.0.17"
1011
},
12+
"devDependencies": {
13+
"eslint": "^4.3.0",
14+
"eslint-config-airbnb": "^16.1.0",
15+
"eslint-parallel": "^0.3.0",
16+
"eslint-plugin-import": "^2.2.0",
17+
"eslint-plugin-jsx-a11y": "^6.0.3",
18+
"eslint-plugin-react": "^7.1.0"
19+
},
1120
"scripts": {
21+
"build-css": "node-sass-chokidar src/ -o src/",
22+
"watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive",
1223
"start": "react-scripts start",
1324
"build": "react-scripts build",
1425
"test": "react-scripts test --env=jsdom",

src/App.css

-9
This file was deleted.

src/App.js

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import React, { Component } from 'react';
2-
import {Navbar, Nav, NavItem, MenuItem, NavDropdown} from 'react-bootstrap'
1+
import React, { Component } from 'react'
2+
import { Navbar, Nav, NavItem, MenuItem, NavDropdown, FormGroup, Button, FormControl } from 'react-bootstrap'
33
import NavbarOffcanvas from './NavbarOffcanvas'
4-
import './App.css'
4+
import './offcanvas.css'
5+
56
class App extends Component {
67
render() {
78
return (
@@ -13,7 +14,7 @@ class App extends Component {
1314
</Navbar.Brand>
1415
<Navbar.Toggle />
1516
</Navbar.Header>
16-
<NavbarOffcanvas>
17+
<NavbarOffcanvas side="left">
1718
<Nav>
1819
<NavItem eventKey={1} href="#">Link</NavItem>
1920
<NavItem eventKey={2} href="#">Link</NavItem>
@@ -25,18 +26,21 @@ class App extends Component {
2526
<MenuItem eventKey={3.3}>Separated link</MenuItem>
2627
</NavDropdown>
2728
</Nav>
28-
<Nav pullRight>
29-
<NavItem eventKey={1} href="#">Link Right</NavItem>
30-
<NavItem eventKey={2} href="#">Link Right</NavItem>
31-
</Nav>
29+
<Navbar.Form pullRight>
30+
<FormGroup>
31+
<FormControl type="text" placeholder="Search" />
32+
</FormGroup>
33+
{' '}
34+
<Button type="submit" bsStyle="success">Submit</Button>
35+
</Navbar.Form>
3236
</NavbarOffcanvas>
3337
</Navbar>
3438
<p className="App-intro">
3539
To get started, edit <code>src/App.js</code> and save to reload.
3640
</p>
3741
</div>
38-
);
42+
)
3943
}
4044
}
4145

42-
export default App;
46+
export default App

src/NavbarOffcanvas.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
import React from 'react';
2-
import PropTypes from 'prop-types';
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
33

4-
import Offcanvas from './Offcanvas.js';
5-
import { prefix } from 'react-bootstrap/lib/utils/bootstrapUtils';
4+
import Offcanvas from './Offcanvas.js'
5+
import { prefix } from 'react-bootstrap/lib/utils/bootstrapUtils'
66

77
const contextTypes = {
88
$bs_navbar: PropTypes.shape({
99
bsClass: PropTypes.string,
1010
expanded: PropTypes.bool,
1111
}),
12-
};
12+
}
1313

1414
class NavbarOffcanvas extends React.Component {
1515
render() {
16-
const { children, ...props } = this.props;
17-
const navbarProps = this.context.$bs_navbar || { bsClass: 'navbar' };
16+
const { children, ...props } = this.props
17+
const navbarProps = this.context.$bs_navbar || { bsClass: 'navbar' }
1818

19-
const bsClassName = prefix(navbarProps, 'collapse');
19+
const bsClassName = prefix(navbarProps, 'offcanvas')
2020

2121
return (
2222
<Offcanvas in={navbarProps.expanded} {...props}>
2323
<div className={bsClassName}>
2424
{children}
2525
</div>
2626
</Offcanvas>
27-
);
27+
)
2828
}
2929
}
3030

31-
NavbarOffcanvas.contextTypes = contextTypes;
31+
NavbarOffcanvas.contextTypes = contextTypes
3232

33-
export default NavbarOffcanvas;
33+
export default NavbarOffcanvas

0 commit comments

Comments
 (0)