Skip to content

Commit 37092d1

Browse files
committed
1 parent f975443 commit 37092d1

File tree

626 files changed

+56691
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

626 files changed

+56691
-0
lines changed

.babelrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env",
4+
"@babel/preset-react",
5+
],
6+
"plugins": [
7+
"@babel/plugin-proposal-class-properties",
8+
"@babel/plugin-syntax-dynamic-import",
9+
"universal-import",
10+
"react-hot-loader/babel"
11+
],
12+
"env": {
13+
"development": {
14+
"plugins": [
15+
"react-hot-loader/babel"
16+
]
17+
}
18+
}
19+
}

.eslintrc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"parser": "babel-eslint",
3+
"plugins": [
4+
"react"
5+
],
6+
"parserOptions": {
7+
"ecmaVersion": 6,
8+
"sourceType": "module",
9+
"ecmaFeatures": {
10+
"jsx": true,
11+
"experimentalObjectRestSpread": true
12+
}
13+
},
14+
"env": {
15+
"es6": true,
16+
"browser": true,
17+
"node": true,
18+
"mocha": true
19+
},
20+
"extends": [
21+
"eslint:recommended",
22+
"plugin:react/recommended"
23+
],
24+
"rules": {
25+
}
26+
}

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# build output
2+
dist
3+
4+
# dependencies
5+
node_modules
6+
package-lock.json
7+
yarn.lock
8+
9+
# other
10+
.DS_Store

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//registry.npmjs.org/:_authToken=57c97b55-1617-4b16-9f1b-2bffb2cdcc7e

app/colors.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import _ from 'lodash';
2+
3+
import colors from './colors.scss';
4+
5+
const colorKeys = _
6+
.chain(colors)
7+
.keys()
8+
.filter((colorKey) => (
9+
colorKey.indexOf('bg-') === -1 &&
10+
colorKey.indexOf('fg-') === -1
11+
))
12+
.value();
13+
14+
export default _.pick(colors, colorKeys);

app/colors.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@import "./styles/variables";
2+
3+
@each $name, $color in $dashboard-colors {
4+
.fg-color--#{ $name } {
5+
color: $color;
6+
}
7+
.bg-color--#{ $name } {
8+
background-color: $color;
9+
}
10+
}
11+
12+
:export {
13+
@each $name, $color in $dashboard-colors {
14+
#{$name}: $color
15+
}
16+
}

app/common.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import * as CommonDashboardFuncs from '@owczar/dashboard-style--airframe';
2+
3+
export default CommonDashboardFuncs;
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
4+
import Card from './../Card';
5+
6+
import { Provider } from './context';
7+
8+
export class Accordion extends React.Component {
9+
static propTypes = {
10+
initialOpen: PropTypes.bool,
11+
onToggle: PropTypes.func,
12+
open: PropTypes.bool,
13+
children: PropTypes.node,
14+
className: PropTypes.string
15+
};
16+
17+
constructor(props) {
18+
super(props);
19+
20+
this.state = {
21+
isOpen: props.initialOpen
22+
}
23+
24+
if (props.open !== 'undefined' && props.onToggle === 'undefined') {
25+
throw "Accordion: props.open has to be used combined with props.onToggle " +
26+
"use props.initialOpen to create an uncontrolled Accordion."
27+
}
28+
}
29+
30+
toggleHandler() {
31+
const { onToggle } = this.props;
32+
33+
if (!onToggle) {
34+
this.setState({ isOpen: !this.state.isOpen });
35+
} else {
36+
this.onToggle(!this.props.open);
37+
}
38+
}
39+
40+
isOpen() {
41+
return !this.props.onToggle ?
42+
this.state.isOpen : this.props.open;
43+
}
44+
45+
render() {
46+
/* eslint-disable-next-line no-unused-vars */
47+
const { className, children, initialOpen, ...otherProps } = this.props;
48+
49+
return (
50+
<Provider
51+
value={{
52+
onToggle: this.toggleHandler.bind(this),
53+
isOpen: this.isOpen()
54+
}}
55+
>
56+
<Card className={ className } { ...otherProps }>
57+
{ children }
58+
</Card>
59+
</Provider>
60+
);
61+
}
62+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import classNames from 'classnames';
4+
import { Collapse, CardBody } from 'reactstrap';
5+
6+
import { Consumer } from './context';
7+
8+
export const AccordionBody = (props) => (
9+
<Consumer>
10+
{
11+
({ isOpen }) => (
12+
<Collapse isOpen={ isOpen }>
13+
<CardBody className={ classNames(props.className, 'pt-0') }>
14+
{ props.children }
15+
</CardBody>
16+
</Collapse>
17+
)
18+
}
19+
</Consumer>
20+
);
21+
AccordionBody.propTypes = {
22+
children: PropTypes.node,
23+
className: PropTypes.string
24+
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import classNames from 'classnames';
4+
5+
import CardHeader from './../CardHeader';
6+
7+
import { Consumer } from './context';
8+
import classes from './AccordionHeader.scss';
9+
10+
export const AccordionHeader = (props) => (
11+
<Consumer>
12+
{
13+
({ onToggle }) => (
14+
<CardHeader
15+
className={
16+
classNames(
17+
props.className,
18+
classes.header
19+
)
20+
}
21+
onClick={ onToggle}
22+
>
23+
{ props.children }
24+
</CardHeader>
25+
)
26+
}
27+
</Consumer>
28+
);
29+
AccordionHeader.propTypes = {
30+
children: PropTypes.node,
31+
onClick: PropTypes.func,
32+
className: PropTypes.string
33+
};

0 commit comments

Comments
 (0)