@origin-digital/helper 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/es/consts/media/breakPoints.js +30 -0
- package/dist/es/consts/metrics/font.js +21 -0
- package/dist/es/consts/metrics/lineHeight.js +15 -0
- package/dist/es/consts/palette/colors.js +21 -0
- package/dist/es/utils/colorStyle.js +19 -0
- package/dist/es/utils/media.js +36 -0
- package/package.json +22 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @origin-digital/helper
|
|
2
|
+
|
|
3
|
+
A utility package.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- ES6 syntax, managed with Prettier + Eslint and Stylelint
|
|
8
|
+
- Unit testing via Jest
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
yarn add @origin-digital/helper
|
|
14
|
+
// or
|
|
15
|
+
npm install @origin-digital/helper
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Requirements
|
|
19
|
+
|
|
20
|
+
- Node.js v 12.x or later
|
|
21
|
+
- VS Code, Atom, or SublimeText have packages / plugins that will work with the configurations
|
|
22
|
+
|
|
23
|
+
### Required IDE Packages / Tools
|
|
24
|
+
|
|
25
|
+
- Babel (apply to JS / JSX syntax)
|
|
26
|
+
- Eslint
|
|
27
|
+
- Styled components
|
|
28
|
+
- Prettier
|
|
29
|
+
- In VS Code and Atom, enable the integration between Prettier and Eslint / Stylelint in your Editor
|
|
30
|
+
- In SublimeText, set the `"auto_format_on_save": true,` flag in JsPrettier settings
|
|
31
|
+
- Editorconfig
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Extra small devices (portrait phones, less than 544px)
|
|
3
|
+
No media query since this is the default at Origin because we are "mobile first"
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/* Small devices (landscape phones, 544px and up) */
|
|
7
|
+
export var BREAK_POINTS = {
|
|
8
|
+
SM: {
|
|
9
|
+
Min: '576px',
|
|
10
|
+
Max: '575px'
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
/* Medium devices (tablets, 768px and up) The navbar toggle appears at this breakpoint */
|
|
14
|
+
MD: {
|
|
15
|
+
Min: '768px',
|
|
16
|
+
Max: '767px'
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
/* Large devices (desktops, 992px and up) */
|
|
20
|
+
LG: {
|
|
21
|
+
Min: '992px',
|
|
22
|
+
Max: '991px'
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
/* Extra large devices (large desktops, 1200px and up) */
|
|
26
|
+
XL: {
|
|
27
|
+
Min: '1200px',
|
|
28
|
+
Max: '1199px'
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export var FontSizes = {
|
|
2
|
+
H1: 36,
|
|
3
|
+
H2: 24,
|
|
4
|
+
H3: 18,
|
|
5
|
+
H4: 16,
|
|
6
|
+
H5: 16,
|
|
7
|
+
H6: 16,
|
|
8
|
+
BODY: 14,
|
|
9
|
+
SMALL: 12,
|
|
10
|
+
Large: {
|
|
11
|
+
H1: 56,
|
|
12
|
+
H2: 32,
|
|
13
|
+
H3: 20
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export var FontWeights = {
|
|
17
|
+
REGULAR: 400,
|
|
18
|
+
MEDIUM: 600,
|
|
19
|
+
BOLD: 700
|
|
20
|
+
};
|
|
21
|
+
export var fontFamilySansSerif = "\nfont-family: 'gordita', sans-serif, -apple-system, BlinkMacSystemFont;\n";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export var RED_PINK = '#ff373c';
|
|
2
|
+
export var RED = '#ec0000';
|
|
3
|
+
export var ORANGE = '#ff8228';
|
|
4
|
+
export var LIGHT_ORANGE = '#ffb432';
|
|
5
|
+
export var LIGHT_BLUE = '#d2f0ff';
|
|
6
|
+
export var GREY = '#505050';
|
|
7
|
+
export var LIGHT_GREY = '#535353';
|
|
8
|
+
export var BLUE = '#3f75c6';
|
|
9
|
+
export var GREEN = '#008906';
|
|
10
|
+
export var LIGHT_GREEN = '#a5bb48';
|
|
11
|
+
export var PURPLE = '#c34789';
|
|
12
|
+
export var GREY4 = '#f8f8f8';
|
|
13
|
+
export var GREY8 = '#f1f1f1';
|
|
14
|
+
export var GREY16 = '#e3e3e3';
|
|
15
|
+
export var GREY24 = '#d5d5d5';
|
|
16
|
+
export var GREY48 = '#ababab';
|
|
17
|
+
export var GREY80 = '#737373';
|
|
18
|
+
export var GREY56 = '#232323';
|
|
19
|
+
export var WHITE = 'white';
|
|
20
|
+
export var BLACK = 'black';
|
|
21
|
+
export var TRANSPARENT = 'transparent';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import _Map from "@babel/runtime-corejs2/core-js/map";
|
|
2
|
+
import { css } from 'styled-components';
|
|
3
|
+
import * as Colors from '../consts/palette/colors';
|
|
4
|
+
var colorLabelMap = new _Map([['redPink', Colors.RED_PINK], ['red', Colors.RED], ['orange', Colors.ORANGE], ['lightOrange', Colors.LIGHT_ORANGE], ['lightBlue', Colors.LIGHT_BLUE], ['grey', Colors.GREY], ['lightGrey', Colors.LIGHT_GREY], ['blue', Colors.BLUE], ['green', Colors.GREEN], ['lightGreen', Colors.LIGHT_GREEN], ['purple', Colors.PURPLE], ['grey4', Colors.GREY4], ['grey8', Colors.GREY8], ['grey16', Colors.GREY16], ['grey24', Colors.GREY24], ['grey48', Colors.GREY48], ['grey80', Colors.GREY80], ['grey56', Colors.GREY56], ['white', Colors.WHITE], ['black', Colors.BLACK], ['transparent', Colors.TRANSPARENT]]);
|
|
5
|
+
export var mapColorLabelToHex = function mapColorLabelToHex(colorLabel) {
|
|
6
|
+
// If no color is provided, use the default.
|
|
7
|
+
var hex = colorLabelMap.get(colorLabel);
|
|
8
|
+
return hex;
|
|
9
|
+
};
|
|
10
|
+
export var backgroundColor = function backgroundColor() {
|
|
11
|
+
return css(["", ";"], function (_ref) {
|
|
12
|
+
var color = _ref.color;
|
|
13
|
+
return "background-color: ".concat(mapColorLabelToHex(color), ";");
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export var color = css(["", ";"], function (_ref2) {
|
|
17
|
+
var color = _ref2.color;
|
|
18
|
+
return "color: ".concat(mapColorLabelToHex(color), ";");
|
|
19
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
import { BREAK_POINTS } from '../consts/media';
|
|
3
|
+
var styledCss = css;
|
|
4
|
+
export var breakPoint = function breakPoint(label, BREAK_POINT) {
|
|
5
|
+
return function () {
|
|
6
|
+
return css(["@media only screen and (min-width:", "){", ";}"], BREAK_POINT, styledCss.apply(void 0, arguments));
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export var SM = function SM() {
|
|
10
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11
|
+
args[_key] = arguments[_key];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return breakPoint('SM', BREAK_POINTS.SM.Min)(args);
|
|
15
|
+
};
|
|
16
|
+
export var MD = function MD() {
|
|
17
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
18
|
+
args[_key2] = arguments[_key2];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return breakPoint('MD', BREAK_POINTS.MD.Min)(args);
|
|
22
|
+
};
|
|
23
|
+
export var LG = function LG() {
|
|
24
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
25
|
+
args[_key3] = arguments[_key3];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return breakPoint('LG', BREAK_POINTS.LG.Min)(args);
|
|
29
|
+
};
|
|
30
|
+
export var XL = function XL() {
|
|
31
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
32
|
+
args[_key4] = arguments[_key4];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return breakPoint('XL', BREAK_POINTS.XL.Min)(args);
|
|
36
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@origin-digital/helper",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "misc utilities for common tasks",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "horgn-dig",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "npm run mkdir",
|
|
11
|
+
"mkdir": "node build.js",
|
|
12
|
+
"prepublishOnly": "npm run build",
|
|
13
|
+
"test": "exit 0"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@babel/runtime-corejs2": "^7.18.3",
|
|
17
|
+
"styled-components": "^5.3.5"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
}
|
|
22
|
+
}
|