Skip to content

Commit

Permalink
chore(ffe-spinner-react): Reimplement ffe-spinner-react
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This commit reimplements and simplifies the
ffe-spinner-react implementation. It no longer includes layout, which
requires the consumer to place it correctly.

The `<InlineSpinner />` and `<LargeSpinner />` are now available as
`<Spinner large={true|false} />`.

The previous `<Spinner />` implementation, which wrapped a large
spinner in a `ffe-content-container` class is now removed. To keep this
behavior, the consumer can create its own implementation of a
`<SpinnerWithLayout />` or something similar.
  • Loading branch information
Kristofer Selbekk committed Jan 19, 2018
1 parent 341fb45 commit f3f8795
Show file tree
Hide file tree
Showing 28 changed files with 101 additions and 451 deletions.
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = {
'ffe-radio-button-react',
'ffe-searchable-dropdown-react',
'ffe-spinner',
'ffe-spinner-react',
'ffe-tables',
'ffe-tables-react',
],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"react": "^16.1.1",
"react-dom": "^16.1.1",
"react-styleguidist": "^6.0.32",
"style-loader": "^0.19.1",
"stylelint-config-prettier": "^2.0.0",
"webpack": "^3.8.1"
},
Expand Down
8 changes: 2 additions & 6 deletions packages/ffe-searchable-dropdown-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"test:nsp": "nsp check"
},
"jest": {
"setupTestFrameworkScriptFile": "<rootDir>/testSetup.js"
"setupTestFrameworkScriptFile": "./testSetup.js"
},
"peerDependencies": {
"ffe-core": "^10.2.4",
Expand All @@ -38,11 +38,7 @@
"react": "^16.1.1",
"react-dom": "^16.1.1"
},
"files": [
"less/searchable-dropdown.less",
"lib",
"*.js"
],
"files": ["less/searchable-dropdown.less", "lib", "*.js"],
"dependencies": {
"classnames": "^2.2.5",
"ffe-icons-react": "^4.0.5",
Expand Down
9 changes: 0 additions & 9 deletions packages/ffe-spinner-react/.babelrc

This file was deleted.

15 changes: 0 additions & 15 deletions packages/ffe-spinner-react/.editorconfig

This file was deleted.

3 changes: 0 additions & 3 deletions packages/ffe-spinner-react/.eslintrc

This file was deleted.

2 changes: 0 additions & 2 deletions packages/ffe-spinner-react/.gitattributes

This file was deleted.

Empty file.
1 change: 0 additions & 1 deletion packages/ffe-spinner-react/.npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
git-tag-version=false
package-lock=false
84 changes: 5 additions & 79 deletions packages/ffe-spinner-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,84 +6,10 @@
$ npm install --save ffe-spinner-react
```

>`ffe-spinner-react` depends on `ffe-core` and `ffe-spinner` being present and imported in your project.
>More specifically, the CSS classes related to spinner in ffe-spinner should be in your CSS Object Model when using this component.
```css
@import "node_modules/ffe-spinner/less/spinner.less";
```

## Usage

The default usage exposes a centered block-level spinner:

```javascript
import Spinner from 'ffe-spinner-react';

<Spinner />
```

If you want to have a loading text you can supply that as well:

```javascript
<Spinner text="Loading..." />
```

>The text can either be a string, or a some other renderable node.
In case you prefer to use children you can also do that:

```javascript

<Spinner>
Loading...
</Spinner>
```

>The two examples above are functionally equivalent.
If you want a left-aligned spinner, you can disable the centering:

```javascript
<Spinner center={ false } />
```
> `ffe-spinner-react` depends on `ffe-core` and `ffe-spinner` being present and imported in your project.
> More specifically, the CSS classes related to spinner in ffe-spinner should be in your CSS Object Model when using
> this component.
If you want a large spinner you can get that as well:

```javascript
<Spinner large={ true }/>
```

Using all of the settings:

```javascript
import Spinner from 'ffe-spinner-react';

<Spinner center={ false } large={ true } text="Loading..." />
```

### LargeSpinner

In case you want to be a bit more explicit when you use a large spinner, you can also use the `<LargeSpinner>` component:

```javascript
import { LargeSpinner } from 'ffe-spinner-react';

<LargeSpinner center={ false } text="Loading..." />
```

It works exactly like `<Spinner>`, but without the `large` property.

### InlineSpinner

In case you need a non-block level spinner you can use `<InlineSpinner>`:

```javascript
import { InlineSpinner } from 'ffe-spinner-react';

<div>
<InlineSpinner large={ true } /> Loading...
</div>
```css
@import 'node_modules/ffe-spinner/less/spinner.less';
```

The only property available here is `large`, which is defaulted to `false`. As it's an inline component, any loading text or
suchlike has to be supplied outside of the component itself.
5 changes: 0 additions & 5 deletions packages/ffe-spinner-react/build.sh

This file was deleted.

8 changes: 0 additions & 8 deletions packages/ffe-spinner-react/examples/example.less

This file was deleted.

24 changes: 0 additions & 24 deletions packages/ffe-spinner-react/examples/spinner.js

This file was deleted.

41 changes: 0 additions & 41 deletions packages/ffe-spinner-react/flow.sh

This file was deleted.

92 changes: 31 additions & 61 deletions packages/ffe-spinner-react/package.json
Original file line number Diff line number Diff line change
@@ -1,63 +1,33 @@
{
"name": "ffe-spinner-react",
"version": "2.0.4",
"author": "SpareBank 1",
"main": "lib/index.js",
"scripts": {
"build": "babel -d lib/. --ignore=*.test.js src/.",
"lint": "eslint src/.",
"start": "budo examples/spinner.js --open --live --title \"FFE Spinner React\" -- -t [ babelify --presets [ es2015 react ] ] -t node-lessify",
"test:nsp": "nsp check",
"test:spec": "mocha --require babel-register --reporter mocha-tap13 src/**/*.test.js",
"test": "npm run test:spec && npm run test:nsp",
"prepublish": "npm run build",
"has-published": "npm show . versions -s | grep -q ${npm_package_version}",
"postpublish": "git tag ${npm_package_version} && git push --tags"
},
"dependencies": {
"prop-types": "*"
},
"devDependencies": {
"babel-cli": "^6.4.5",
"babel-core": "^6.5.2",
"babel-plugin-transform-object-rest-spread": "^6.5.0",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.5.0",
"babel-register": "^6.4.3",
"babelify": "^7.3.0",
"budo": "^8.3.0",
"chai": "^3.5.0",
"enzyme": "^2.0.0",
"eslint": "^3.12.2",
"eslint-config-ffe": "^6.0.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^3.0.2",
"eslint-plugin-react": "^6.8.0",
"ffe-core": "^9.2.0",
"ffe-spinner": "^2.0.0",
"mocha": "^2.4.5",
"mocha-tap13": "0.0.3",
"node-lessify": "^0.1.4",
"nsp": "^2.2.0",
"prop-types": "^15.5.10",
"react": "^15.2.0",
"react-addons-test-utils": "^15.0.0",
"react-dom": "^15.0.0"
},
"peerDependencies": {
"ffe-spinner": "1.x - 2.x"
},
"publishConfig": {
"registry": "***REMOVED***"
},
"files": [
"lib",
"*.js"
],
"babel": {
"presets": [
"react",
"es2015"
]
}
"name": "ffe-spinner-react",
"version": "2.0.4",
"author": "SpareBank 1",
"main": "lib/index.js",
"scripts": {
"build": "babel -d lib/. --ignore=*.spec.js src/.",
"lint": "eslint src/.",
"test:nsp": "nsp check",
"test:spec": "jest",
"test": "npm run test:spec && npm run test:nsp"
},
"dependencies": {
"prop-types": "*"
},
"devDependencies": {
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"ffe-core": "^9.2.0",
"ffe-spinner": "^2.0.0",
"jest": "^22.1.3",
"nsp": "^2.2.0",
"react": "^16.2.0",
"react-dom": "^16.2.0"
},
"peerDependencies": {
"ffe-spinner": "1.x - 2.x"
},
"files": ["lib", "*.js"],
"jest": {
"setupTestFrameworkScriptFile": "./test-setup.js"
}
}
22 changes: 0 additions & 22 deletions packages/ffe-spinner-react/src/InlineSpinner.js

This file was deleted.

8 changes: 0 additions & 8 deletions packages/ffe-spinner-react/src/InlineSpinner.md

This file was deleted.

21 changes: 0 additions & 21 deletions packages/ffe-spinner-react/src/InlineSpinner.test.js

This file was deleted.

0 comments on commit f3f8795

Please sign in to comment.