Skip to content
This repository was archived by the owner on Aug 3, 2020. It is now read-only.

Commit dd1bfba

Browse files
committed
initial commit
0 parents  commit dd1bfba

File tree

8 files changed

+4512
-0
lines changed

8 files changed

+4512
-0
lines changed

.babelrc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"presets": [
3+
["env", {
4+
"targets": {
5+
"node": "6.9.0"
6+
}
7+
}]
8+
],
9+
"plugins": [
10+
["transform-object-rest-spread", { "useBuiltIns": true }],
11+
"add-module-exports"
12+
]
13+
}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lib/

LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright 2018 Josh Manders <josh@joshmanders.com>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

package.json

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "tailwindcss-spinner",
3+
"version": "0.1.0",
4+
"description": "Spinner utility for Tailwind CSS",
5+
"main": "index.js",
6+
"repository": "git@github.com:aniftyco/tailwindcss-spinner.git",
7+
"author": "Josh Manders <josh@joshmanders.com>",
8+
"license": "MIT",
9+
"files": [
10+
"lib/",
11+
"index.js"
12+
],
13+
"keywords": [
14+
"tailwindcss",
15+
"tailwind"
16+
],
17+
"scripts": {
18+
"prebuild": "rimraf lib/",
19+
"build": "babel src/ --out-dir lib/",
20+
"test": "jest",
21+
"prepublish": "yarn build"
22+
},
23+
"devDependencies": {
24+
"babel-cli": "^6.26.0",
25+
"babel-plugin-add-module-exports": "^0.2.1",
26+
"babel-plugin-transform-object-rest-spread": "^6.26.0",
27+
"babel-preset-env": "^1.6.1",
28+
"eslint": "^4.19.1",
29+
"eslint-config-nifty": "^0.4.1",
30+
"eslint-plugin-jest": "^21.15.0",
31+
"jest": "^22.4.3",
32+
"rimraf": "^2.6.2"
33+
},
34+
"jest": {
35+
"testEnvironment": "node",
36+
"collectCoverageFrom": [
37+
"!node_modules/**",
38+
"!tests/**",
39+
"src/**"
40+
],
41+
"coverageThreshold": {
42+
"global": {
43+
"statements": 0
44+
}
45+
}
46+
}
47+
}

readme.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Tailwind CSS Spinner
2+
> Spinner utility for Tailwind CSS
3+
4+
## Installation
5+
6+
You can install it with yarn
7+
8+
```bash
9+
yarn add tailwindcss-spinner
10+
```
11+
12+
## Usage
13+
14+
To get started using the plugin, you can require it into your Tailwind CSS config file
15+
16+
```js
17+
plugins: [
18+
// Other plugins...
19+
20+
require('tailwindcss-spinner')(),
21+
],
22+
```
23+
24+
Now you will have a `.spinner` class available in your CSS.
25+
26+
If you want to customize the spinner, you can pass any combination of the following options (shown with default values).
27+
28+
```js
29+
plugins: [
30+
// Other plugins...
31+
32+
require('tailwindcss-spinner')({
33+
name: 'spinner', // change class name
34+
color: 'grey-light', // color from config to make it
35+
}),
36+
],
37+
```
38+
39+
## Example
40+
41+
![](https://i.imgur.com/UbwGglQ.gif)

src/index.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
export default ({name = 'spinner', color = 'grey-light'}) => ({addUtilities, config}) => addUtilities({
2+
[`.${name}`]: {
3+
'color': 'transparent !important',
4+
'pointer-events': 'none',
5+
'position': 'relative',
6+
'&:after': {
7+
'animation': 'spinAround 500ms infinite linear',
8+
'border': `2px solid ${config(`colors.${color}`)}`,
9+
'border-radius': '290486px',
10+
'border-right-color': 'transparent',
11+
'border-top-color': 'transparent',
12+
'content': '""',
13+
'display': 'block',
14+
'width': '1em',
15+
'height': '1em',
16+
'left': 'calc(50% - (1em / 2))',
17+
'top': 'calc(50% - (1em / 2))',
18+
'position': 'absolute !important',
19+
},
20+
},
21+
'@keyframes spinAround': {
22+
'from': {
23+
'transform': 'rotate(0deg)',
24+
},
25+
'to': {
26+
'transform': 'rotate(359deg)',
27+
},
28+
},
29+
});

tests/index.spec.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test('example', () => {
2+
expect(true).toBe(true);
3+
});

0 commit comments

Comments
 (0)