-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(package): merging core and enriched: copied all js files into src/
- Loading branch information
Showing
65 changed files
with
6,528 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
presets: ['es2015', 'stage-2', 'react'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Node.js dependencies, files, & directories | ||
.npm | ||
.npmrc | ||
node_modules | ||
npm-debug.log* | ||
*.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
{ | ||
"extends": [ | ||
"airbnb", | ||
"plugin:import/errors" | ||
], | ||
"plugins": [ | ||
"react", | ||
"import" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true, | ||
"experimentalObjectRestSpread": true | ||
} | ||
}, | ||
"env": { | ||
"es6": true, | ||
"browser": true, | ||
"node": true, | ||
"jquery": true, | ||
"mocha": true | ||
}, | ||
"settings": { | ||
"import/resolver": { | ||
"node": { | ||
"extensions": [".js", ".jsx"] | ||
} | ||
} | ||
}, | ||
"globals": { | ||
"expect": true, | ||
"jest": true | ||
}, | ||
"rules": { | ||
"quotes": 0, | ||
"no-console": 1, | ||
"no-debugger": 1, | ||
"no-var": 1, | ||
"semi": [1, "always"], | ||
"no-trailing-spaces": 0, | ||
"eol-last": 0, | ||
"no-unused-vars": 0, | ||
"no-underscore-dangle": 0, | ||
"no-alert": 0, | ||
"no-lone-blocks": 0, | ||
"jsx-quotes": 1, | ||
"global-require": 0, | ||
"comma-dangle": ["error", "never"], | ||
"no-confusing-arrow": ["error", {"allowParens": true}], | ||
"arrow-body-style": 0, | ||
"class-methods-use-this": 0, | ||
"jsx-a11y/no-static-element-interactions": 0, | ||
"jsx-a11y/no-noninteractive-element-to-interactive-role": 1, | ||
"react/display-name": [ 1, {"ignoreTranspilerName": false }], | ||
"react/forbid-prop-types": [1, {"forbid": ["any"]}], | ||
"react/jsx-boolean-value": 1, | ||
"react/jsx-closing-bracket-location": 0, | ||
"react/jsx-curly-spacing": 1, | ||
"react/jsx-indent-props": 0, | ||
"react/jsx-key": 1, | ||
"react/jsx-max-props-per-line": 0, | ||
"react/jsx-no-bind": 1, | ||
"react/jsx-no-duplicate-props": 1, | ||
"react/jsx-no-literals": 0, | ||
"react/jsx-no-undef": 1, | ||
"react/jsx-pascal-case": 1, | ||
"react/jsx-sort-prop-types": 0, | ||
"react/jsx-sort-props": 0, | ||
"react/jsx-uses-react": 1, | ||
"react/jsx-uses-vars": 1, | ||
"react/no-array-index-key": 1, | ||
"react/no-danger": 0, | ||
"react/no-string-refs": 0, | ||
"react/no-did-mount-set-state": 1, | ||
"react/no-did-update-set-state": 1, | ||
"react/no-direct-mutation-state": 1, | ||
"react/no-multi-comp": 1, | ||
"react/no-set-state": 0, | ||
"react/no-unknown-property": 1, | ||
"react/prefer-es6-class": 1, | ||
"react/prefer-stateless-function": 0, | ||
"react/prop-types": 1, | ||
"react/react-in-jsx-scope": 1, | ||
"react/require-default-props": 1, | ||
"react/self-closing-comp": 1, | ||
"react/sort-comp": 1, | ||
"react/jsx-wrap-multilines": 1, | ||
"import/no-extraneous-dependencies": 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"rootDir": "../", | ||
"moduleNameMapper": { | ||
"^.+\\.(css|scss)$": "<rootDir>/src/__mocks__/styleMock.js" | ||
}, | ||
"setupTestFrameworkScriptFile": "<rootDir>/node_modules/jest-enzyme/lib/index.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import path from 'path'; | ||
|
||
import resolve from 'rollup-plugin-node-resolve'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
|
||
import babel from 'rollup-plugin-babel'; | ||
|
||
import sass from 'rollup-plugin-sass'; | ||
import postcss from 'postcss'; | ||
import autoprefixer from 'autoprefixer'; | ||
|
||
export default { | ||
entry: path.resolve('./src/index.js'), | ||
targets: [ | ||
{ format: 'cjs', dest: path.resolve('./dist/tds.cjs.js') }, | ||
{ format: 'es', dest: path.resolve('./dist/tds.es.js') } | ||
], | ||
sourceMap: true, | ||
|
||
external: ['react', 'prop-types', '@telusdigital/redux-contentful'], | ||
|
||
plugins: [ | ||
resolve({ | ||
extensions: ['.js', '.jsx'] | ||
}), | ||
commonjs({ | ||
include: 'node_modules/**' | ||
}), | ||
sass({ | ||
output: path.resolve('./dist/tds.css'), | ||
processor(css) { | ||
return postcss([autoprefixer]) | ||
.process(css) | ||
.then(result => result.css); | ||
} | ||
}), | ||
babel({ | ||
babelrc: false, | ||
presets: [ | ||
['es2015', { modules: false }], | ||
'react', | ||
'stage-2' | ||
], | ||
plugins: ['external-helpers'], | ||
exclude: 'node_modules/**' | ||
}) | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
mkdir -p dist/scss | ||
|
||
cp src/scss/settings/_variables.scss dist/scss/ | ||
cp src/scss/utility/{_helpers,_mixins}.scss dist/scss/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import classNames from 'classnames'; | ||
|
||
import { warn } from '../../deprecate'; | ||
|
||
import './Card.scss'; | ||
|
||
const Card = ({ className, children, ...rest }) => { | ||
if (className) { | ||
warn('Card', 'Custom CSS classes are deprecated. This component does not support custom styling.'); | ||
} | ||
|
||
if (rest.style) { | ||
warn('Card', 'Inline styles are deprecated. This component does not support custom styling.'); | ||
} | ||
|
||
return ( | ||
<div {...rest} className={classNames('card', className)}> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
Card.propTypes = { | ||
className: PropTypes.string, | ||
children: PropTypes.node.isRequired | ||
}; | ||
|
||
export default Card; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@import '../../scss/settings/variables'; | ||
|
||
.card { | ||
border: 0; | ||
box-sizing: border-box; | ||
border-radius: 4px; | ||
box-shadow: 0 0 16px 0 rgba(213, 213, 213, .5); | ||
background-color: $color-white; | ||
padding: 30px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import toJson from 'enzyme-to-json'; | ||
|
||
import sinon from 'sinon'; | ||
|
||
import * as deprecate from '../../../deprecate'; | ||
import Card from '../Card'; | ||
|
||
describe('<Card />', () => { | ||
beforeEach(() => { | ||
sinon.spy(deprecate, "warn"); | ||
}); | ||
|
||
afterEach(() => { | ||
deprecate.warn.restore(); | ||
}); | ||
|
||
it('renders correctly', () => { | ||
const card = shallow(<Card>Some content</Card>); | ||
|
||
expect(toJson(card)).toMatchSnapshot(); | ||
}); | ||
|
||
it('passes attributes to DOM node', () => { | ||
const card = shallow(<Card id="hello" title="my title">Some content</Card>); | ||
|
||
expect(card).toHaveProp('id', 'hello'); | ||
expect(card).toHaveProp('title', 'my title'); | ||
}); | ||
|
||
it('accepts but deprecates custom classes', () => { | ||
const card = shallow(<Card className="some-class">Some content</Card>); | ||
|
||
expect(card).toHaveClassName('some-class'); | ||
expect(deprecate.warn.called).toBeTruthy(); | ||
}); | ||
|
||
it('accepts but deprecates inline styles', () => { | ||
const styles = { color: 'blue' }; | ||
const card = shallow(<Card style={styles}>Some content</Card>); | ||
|
||
expect(card).toHaveProp('style', styles); | ||
expect(deprecate.warn.called).toBeTruthy(); | ||
}); | ||
}); |
9 changes: 9 additions & 0 deletions
9
src/components/Card/__tests__/__snapshots__/Card.spec.jsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<Card /> renders correctly 1`] = ` | ||
<div | ||
className="card" | ||
> | ||
Some content | ||
</div> | ||
`; |
Oops, something went wrong.