@times-components/article-paragraph 1.7.108 → 1.8.0
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/CHANGELOG.md +11 -0
- package/README.md +3 -41
- package/babel.config.js +13 -5
- package/dist/article-paragraph.js +11 -1
- package/dist/drop-cap-prop-types.js +21 -1
- package/dist/drop-cap.js +41 -1
- package/dist/index.js +21 -1
- package/dist/styles/drop-cap-sizes.js +98 -1
- package/dist/styles/index.js +22 -1
- package/dist/styles/responsive.js +51 -1
- package/dist/styles/shared.js +67 -1
- package/package.json +15 -23
- package/rnw.js +1 -1
- package/tsconfig.jest.json +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.8.0](https://github.com/newsuk/times-components/compare/@times-components/article-paragraph@1.7.108...@times-components/article-paragraph@1.8.0) (2022-08-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **TDP-1712:** remove react-native foreverrrrr ([#3064](https://github.com/newsuk/times-components/issues/3064)) ([2a20cb5](https://github.com/newsuk/times-components/commit/2a20cb5abc10a4e7ca2d62487967f8fcf4eccb62)), closes [#3037](https://github.com/newsuk/times-components/issues/3037) [#3045](https://github.com/newsuk/times-components/issues/3045) [#3050](https://github.com/newsuk/times-components/issues/3050) [#3056](https://github.com/newsuk/times-components/issues/3056) [#3057](https://github.com/newsuk/times-components/issues/3057) [#3066](https://github.com/newsuk/times-components/issues/3066) [#3065](https://github.com/newsuk/times-components/issues/3065) [#3037](https://github.com/newsuk/times-components/issues/3037) [#3045](https://github.com/newsuk/times-components/issues/3045) [#3045](https://github.com/newsuk/times-components/issues/3045) [#3056](https://github.com/newsuk/times-components/issues/3056) [#3066](https://github.com/newsuk/times-components/issues/3066) [#3069](https://github.com/newsuk/times-components/issues/3069) [#3068](https://github.com/newsuk/times-components/issues/3068) [#3070](https://github.com/newsuk/times-components/issues/3070) [#3072](https://github.com/newsuk/times-components/issues/3072) [#3073](https://github.com/newsuk/times-components/issues/3073) [#3071](https://github.com/newsuk/times-components/issues/3071) [#3074](https://github.com/newsuk/times-components/issues/3074) [#3076](https://github.com/newsuk/times-components/issues/3076) [#3079](https://github.com/newsuk/times-components/issues/3079) [#3078](https://github.com/newsuk/times-components/issues/3078) [#3083](https://github.com/newsuk/times-components/issues/3083) [#3087](https://github.com/newsuk/times-components/issues/3087) [#3091](https://github.com/newsuk/times-components/issues/3091) [#3096](https://github.com/newsuk/times-components/issues/3096) [#3102](https://github.com/newsuk/times-components/issues/3102) [#3105](https://github.com/newsuk/times-components/issues/3105) [#3108](https://github.com/newsuk/times-components/issues/3108) [#3111](https://github.com/newsuk/times-components/issues/3111) [#3112](https://github.com/newsuk/times-components/issues/3112) [#3113](https://github.com/newsuk/times-components/issues/3113) [#3114](https://github.com/newsuk/times-components/issues/3114) [#3120](https://github.com/newsuk/times-components/issues/3120) [#3119](https://github.com/newsuk/times-components/issues/3119) [#3112](https://github.com/newsuk/times-components/issues/3112) [#3126](https://github.com/newsuk/times-components/issues/3126) [#3112](https://github.com/newsuk/times-components/issues/3112) [#3126](https://github.com/newsuk/times-components/issues/3126) [#3127](https://github.com/newsuk/times-components/issues/3127) [#3116](https://github.com/newsuk/times-components/issues/3116) [#3128](https://github.com/newsuk/times-components/issues/3128) [#3132](https://github.com/newsuk/times-components/issues/3132) [#3133](https://github.com/newsuk/times-components/issues/3133)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.7.108](https://github.com/newsuk/times-components/compare/@times-components/article-paragraph@1.7.107...@times-components/article-paragraph@1.7.108) (2022-08-15)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @times-components/article-paragraph
|
package/README.md
CHANGED
|
@@ -1,43 +1,11 @@
|
|
|
1
1
|
# Article Paragraph
|
|
2
2
|
|
|
3
|
-
This packages provides a component for displaying an article paragraph
|
|
4
|
-
|
|
5
|
-
cap" at the beginning of a paragraph.
|
|
3
|
+
This packages provides a component for displaying an article paragraph,
|
|
4
|
+
including support for displaying a "drop cap" at the beginning of a paragraph.
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
The drop cap is implemented using CSS floats, and should work with
|
|
8
7
|
any styling or markup used.
|
|
9
8
|
|
|
10
|
-
React Native does not support CSS floats. Therefore, on android,
|
|
11
|
-
the drop cap is implemented by rendering three separate text boxes to
|
|
12
|
-
mimic the expected layout, as shown below.
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
__________________________________________________________
|
|
16
|
-
| _ | Lorem ipsum dolor sit amet, consectetur |
|
|
17
|
-
| / \ | adipiscing elit. Vivamus imperdiet dapibus |
|
|
18
|
-
| / _ \ | justo, non varius turpis ornare at. Sed nec |
|
|
19
|
-
| / ___ \ | tellus sit amet sapien pretium efficitur sit |
|
|
20
|
-
| /_/ \_\ | amet et mi. Mauris vel lorem erat. Proin |
|
|
21
|
-
|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|
|
|
22
|
-
| pulvinar eros purus, nec lobortis purus mollis viverra. |
|
|
23
|
-
| Nullam tristique id ligula eget ornare. Curabitur vitae |
|
|
24
|
-
| erat quam. Vivamus rutrum arcu enim, eu cursus nunc |
|
|
25
|
-
| congue faucibus. Proin lacinia facilisis auctor. |
|
|
26
|
-
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Gotchas
|
|
30
|
-
|
|
31
|
-
To implement this on Android, we must know the number of words that can fit
|
|
32
|
-
next to the specified drop cap character, and then split the paragraph text at
|
|
33
|
-
this point. Because of this, all styling or markup must be stripped.
|
|
34
|
-
**This means on Android, you cannot have styling or markup in a paragraph containing a drop cap.**
|
|
35
|
-
|
|
36
|
-
We use a [3rd party library](https://github.com/aMarCruz/react-native-text-size)
|
|
37
|
-
to calculate the text to fit next to the drop cap. There is currently limited support for iOS
|
|
38
|
-
from this library. **Therefore, this package
|
|
39
|
-
does not currently have support for iOS.**
|
|
40
|
-
|
|
41
9
|
## Contributing
|
|
42
10
|
|
|
43
11
|
Please read [CONTRIBUTING.md](./CONTRIBUTING.md) before contributing to this
|
|
@@ -76,9 +44,3 @@ characters being displayed as a drop cap. However, the acceptance criteria for t
|
|
|
76
44
|
feature we use this package for has since changed, and this presents the opportunity for
|
|
77
45
|
simplifying the API. **In the future, this package will simply have a toggle for displaying a drop cap,
|
|
78
46
|
and will display the first character as a drop cap when it is enabled.**
|
|
79
|
-
|
|
80
|
-
We would like to support paragraph styling on Android when drop caps are enabled,
|
|
81
|
-
but this is tricky and therefore it may take some time before support is
|
|
82
|
-
implemented.
|
|
83
|
-
|
|
84
|
-
We intend to add iOS support to this package.
|
package/babel.config.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
module.exports = api => {
|
|
2
2
|
api.cache(true);
|
|
3
3
|
return {
|
|
4
|
-
plugins: [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
plugins: ["babel-plugin-styled-components"],
|
|
5
|
+
presets: [
|
|
6
|
+
[
|
|
7
|
+
"@babel/preset-env",
|
|
8
|
+
{
|
|
9
|
+
targets: {
|
|
10
|
+
esmodules: true
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"@babel/preset-react",
|
|
15
|
+
"@babel/preset-typescript"
|
|
16
|
+
]
|
|
9
17
|
};
|
|
10
18
|
};
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _responsive = require("./styles/responsive");
|
|
9
|
+
|
|
10
|
+
var _default = _responsive.Paragraph;
|
|
11
|
+
exports.default = _default;
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultProps = exports.propTypes = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const propTypes = {
|
|
13
|
+
colour: _propTypes.default.string,
|
|
14
|
+
font: _propTypes.default.string
|
|
15
|
+
};
|
|
16
|
+
exports.propTypes = propTypes;
|
|
17
|
+
const defaultProps = {
|
|
18
|
+
colour: "black",
|
|
19
|
+
font: "dropCap"
|
|
20
|
+
};
|
|
21
|
+
exports.defaultProps = defaultProps;
|
package/dist/drop-cap.js
CHANGED
|
@@ -1 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _responsive = require("./styles/responsive");
|
|
13
|
+
|
|
14
|
+
var _dropCapPropTypes = require("./drop-cap-prop-types");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
21
|
+
|
|
22
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
|
|
24
|
+
function DropCapView(_ref) {
|
|
25
|
+
let colour = _ref.colour,
|
|
26
|
+
children = _ref.children,
|
|
27
|
+
font = _ref.font;
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_responsive.DropCap, {
|
|
29
|
+
font: font,
|
|
30
|
+
style: {
|
|
31
|
+
color: colour
|
|
32
|
+
}
|
|
33
|
+
}, children);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
DropCapView.propTypes = _objectSpread(_objectSpread({}, _dropCapPropTypes.propTypes), {}, {
|
|
37
|
+
children: _propTypes.default.string.isRequired
|
|
38
|
+
});
|
|
39
|
+
DropCapView.defaultProps = _dropCapPropTypes.defaultProps;
|
|
40
|
+
var _default = DropCapView;
|
|
41
|
+
exports.default = _default;
|
package/dist/index.js
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "DropCapView", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _dropCap.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.default = void 0;
|
|
13
|
+
|
|
14
|
+
var _articleParagraph = _interopRequireDefault(require("./article-paragraph"));
|
|
15
|
+
|
|
16
|
+
var _dropCap = _interopRequireDefault(require("./drop-cap"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
var _default = _articleParagraph.default;
|
|
21
|
+
exports.default = _default;
|
|
@@ -1 +1,98 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.margins = exports.fontSize = void 0;
|
|
7
|
+
|
|
8
|
+
const fontSize = (font, scale) => {
|
|
9
|
+
const config = {
|
|
10
|
+
cultureMagazine: {
|
|
11
|
+
large: 110,
|
|
12
|
+
medium: 90,
|
|
13
|
+
xlarge: 122
|
|
14
|
+
},
|
|
15
|
+
dropCap: {
|
|
16
|
+
large: 115,
|
|
17
|
+
medium: 100,
|
|
18
|
+
xlarge: 124
|
|
19
|
+
},
|
|
20
|
+
stMagazine: {
|
|
21
|
+
large: 113,
|
|
22
|
+
medium: 90,
|
|
23
|
+
xlarge: 120
|
|
24
|
+
},
|
|
25
|
+
styleMagazine: {
|
|
26
|
+
large: 112,
|
|
27
|
+
medium: 90,
|
|
28
|
+
xlarge: 119
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return config[font][scale];
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.fontSize = fontSize;
|
|
35
|
+
|
|
36
|
+
const margins = (font, scale) => {
|
|
37
|
+
const config = {
|
|
38
|
+
cultureMagazine: {
|
|
39
|
+
large: {
|
|
40
|
+
bottom: -32,
|
|
41
|
+
top: -30
|
|
42
|
+
},
|
|
43
|
+
medium: {
|
|
44
|
+
bottom: -30,
|
|
45
|
+
top: -26
|
|
46
|
+
},
|
|
47
|
+
xlarge: {
|
|
48
|
+
bottom: -28,
|
|
49
|
+
top: -38
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
dropCap: {
|
|
53
|
+
large: {
|
|
54
|
+
bottom: -33,
|
|
55
|
+
top: -14
|
|
56
|
+
},
|
|
57
|
+
medium: {
|
|
58
|
+
bottom: -22,
|
|
59
|
+
top: -12
|
|
60
|
+
},
|
|
61
|
+
xlarge: {
|
|
62
|
+
bottom: -34,
|
|
63
|
+
top: -16
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
stMagazine: {
|
|
67
|
+
large: {
|
|
68
|
+
bottom: -26,
|
|
69
|
+
top: -17
|
|
70
|
+
},
|
|
71
|
+
medium: {
|
|
72
|
+
bottom: -30,
|
|
73
|
+
top: -16
|
|
74
|
+
},
|
|
75
|
+
xlarge: {
|
|
76
|
+
bottom: -22,
|
|
77
|
+
top: -18
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
styleMagazine: {
|
|
81
|
+
large: {
|
|
82
|
+
bottom: -26,
|
|
83
|
+
top: -26
|
|
84
|
+
},
|
|
85
|
+
medium: {
|
|
86
|
+
bottom: -30,
|
|
87
|
+
top: -18
|
|
88
|
+
},
|
|
89
|
+
xlarge: {
|
|
90
|
+
bottom: -30,
|
|
91
|
+
top: -26
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return config[font][scale];
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.margins = margins;
|
package/dist/styles/index.js
CHANGED
|
@@ -1 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _shared = _interopRequireDefault(require("./shared"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
+
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
15
|
+
|
|
16
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
|
|
18
|
+
const sharedStyles = (0, _shared.default)();
|
|
19
|
+
|
|
20
|
+
var _default = _objectSpread({}, sharedStyles);
|
|
21
|
+
|
|
22
|
+
exports.default = _default;
|
|
@@ -1 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DropCap = exports.Paragraph = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _tsStyleguide = require("@times-components/ts-styleguide");
|
|
11
|
+
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
|
|
16
|
+
const dropCapFontSizes = {
|
|
17
|
+
cultureMagazine: 104,
|
|
18
|
+
dropCap: 110,
|
|
19
|
+
stMagazine: 105,
|
|
20
|
+
styleMagazine: 103
|
|
21
|
+
};
|
|
22
|
+
const lineHeights = {
|
|
23
|
+
cultureMagazine: 0.85,
|
|
24
|
+
dropCap: 0.55,
|
|
25
|
+
stMagazine: 0.7,
|
|
26
|
+
styleMagazine: 0.8
|
|
27
|
+
};
|
|
28
|
+
const dropCapMargins = {
|
|
29
|
+
cultureMagazine: -0.06,
|
|
30
|
+
dropCap: 0.2,
|
|
31
|
+
stMagazine: 0.065,
|
|
32
|
+
styleMagazine: -0.01
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const Paragraph = _styledComponents.default.p.withConfig({
|
|
36
|
+
displayName: "responsive__Paragraph",
|
|
37
|
+
componentId: "sc-1pktst5-0"
|
|
38
|
+
})(["color:", ";display:block;font-family:\"", "\";line-height:26px;font-size:", "px;margin:0 auto ", ";padding-right:", ";padding-left:", ";&:first-of-type:after{content:\"\";clear:both;display:table;}@media (min-width:", "px){font-size:", "px;line-height:30px;padding-left:0;padding-right:0;width:80.8%;}@media (min-width:", "px){width:56.2%;}"], _tsStyleguide.colours.functional.primary, _tsStyleguide.fonts.bodyRegular, _tsStyleguide.fontSizes.bodyMobile, (0, _tsStyleguide.spacing)(5), (0, _tsStyleguide.spacing)(2), (0, _tsStyleguide.spacing)(2), _tsStyleguide.breakpoints.medium, _tsStyleguide.fontSizes.body, _tsStyleguide.breakpoints.wide);
|
|
39
|
+
|
|
40
|
+
exports.Paragraph = Paragraph;
|
|
41
|
+
|
|
42
|
+
const DropCap = _styledComponents.default.span.withConfig({
|
|
43
|
+
displayName: "responsive__DropCap",
|
|
44
|
+
componentId: "sc-1pktst5-1"
|
|
45
|
+
})(["float:left;color:", ";padding-right:10px;line-height:1em;", ";"], _tsStyleguide.colours.functional.primary, _ref => {
|
|
46
|
+
let _ref$font = _ref.font,
|
|
47
|
+
font = _ref$font === void 0 ? "dropCap" : _ref$font;
|
|
48
|
+
return (0, _styledComponents.css)(["margin-top:", "em;line-height:", "em;font-size:", "px;font-family:\"", "\";"], dropCapMargins[font], lineHeights[font], dropCapFontSizes[font], _tsStyleguide.fonts[font]);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
exports.DropCap = DropCap;
|
package/dist/styles/shared.js
CHANGED
|
@@ -1 +1,67 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _tsStyleguide = require("@times-components/ts-styleguide");
|
|
9
|
+
|
|
10
|
+
var _dropCapSizes = require("./drop-cap-sizes");
|
|
11
|
+
|
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
+
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
15
|
+
|
|
16
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
|
|
18
|
+
const sharedStyles = function sharedStyles() {
|
|
19
|
+
let dropCapFont = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "dropCap";
|
|
20
|
+
let scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _tsStyleguide.scales.medium;
|
|
21
|
+
|
|
22
|
+
const _styleguide = (0, _tsStyleguide.styleguide)({
|
|
23
|
+
scale
|
|
24
|
+
}),
|
|
25
|
+
colours = _styleguide.colours,
|
|
26
|
+
fontFactory = _styleguide.fontFactory,
|
|
27
|
+
spacing = _styleguide.spacing;
|
|
28
|
+
|
|
29
|
+
const dropCapMargins = (0, _dropCapSizes.margins)(dropCapFont, scale);
|
|
30
|
+
const dropCapFontSize = (0, _dropCapSizes.fontSize)(dropCapFont, scale);
|
|
31
|
+
return {
|
|
32
|
+
articleMainContentRow: {
|
|
33
|
+
paddingLeft: spacing(2),
|
|
34
|
+
paddingRight: spacing(2)
|
|
35
|
+
},
|
|
36
|
+
articleMainContentRowTablet: {
|
|
37
|
+
alignSelf: "center",
|
|
38
|
+
width: _tsStyleguide.tabletWidth
|
|
39
|
+
},
|
|
40
|
+
articleTextElement: _objectSpread(_objectSpread({}, fontFactory({
|
|
41
|
+
font: "body",
|
|
42
|
+
fontSize: "bodyMobile"
|
|
43
|
+
})), {}, {
|
|
44
|
+
color: colours.functional.primary,
|
|
45
|
+
marginBottom: spacing(5)
|
|
46
|
+
}),
|
|
47
|
+
dropCapContainer: {
|
|
48
|
+
flexDirection: "row",
|
|
49
|
+
flexWrap: "wrap"
|
|
50
|
+
},
|
|
51
|
+
dropCapContainerTablet: {
|
|
52
|
+
alignSelf: "center",
|
|
53
|
+
width: _tsStyleguide.tabletWidth
|
|
54
|
+
},
|
|
55
|
+
dropCapTextElement: {
|
|
56
|
+
color: colours.functional.primary,
|
|
57
|
+
fontFamily: _tsStyleguide.fonts[dropCapFont],
|
|
58
|
+
fontSize: dropCapFontSize,
|
|
59
|
+
marginBottom: dropCapMargins.bottom,
|
|
60
|
+
marginRight: spacing(1),
|
|
61
|
+
marginTop: dropCapMargins.top
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var _default = sharedStyles;
|
|
67
|
+
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@times-components/article-paragraph",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Article Paragraph",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"dev": "src/index",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"fmt": "eslint . --fix && prettier --write '**/*.*'",
|
|
10
10
|
"prettier:diff": "prettier --list-different '**/*.*'",
|
|
11
11
|
"lint": "eslint . && yarn prettier:diff && yarn depcheck",
|
|
12
|
-
"test:web": "jest --config='./__tests__/
|
|
12
|
+
"test:web": "jest --config='./__tests__/jest.config.js'",
|
|
13
13
|
"prepublishOnly": "yarn transpile && yarn bundle",
|
|
14
14
|
"watch": "watch 'yarn bundle' ./src --ignoreDotFiles --ignoreUnreadable",
|
|
15
15
|
"cleanup-dist": "rm -rf dist",
|
|
@@ -21,10 +21,7 @@
|
|
|
21
21
|
"url": "git+https://github.com/newsuk/times-components.git"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|
|
24
|
-
"react-native-web",
|
|
25
24
|
"react",
|
|
26
|
-
"native",
|
|
27
|
-
"web",
|
|
28
25
|
"article-paragraph",
|
|
29
26
|
"component"
|
|
30
27
|
],
|
|
@@ -34,34 +31,31 @@
|
|
|
34
31
|
},
|
|
35
32
|
"homepage": "https://github.com/newsuk/times-components#readme",
|
|
36
33
|
"dependencies": {
|
|
37
|
-
"@times-components/article-skeleton": "1.
|
|
38
|
-
"@times-components/context": "1.
|
|
39
|
-
"@times-components/markup-forest": "1.
|
|
40
|
-
"@times-components/ts-styleguide": "1.
|
|
34
|
+
"@times-components/article-skeleton": "1.86.0",
|
|
35
|
+
"@times-components/context": "1.10.0",
|
|
36
|
+
"@times-components/markup-forest": "1.9.0",
|
|
37
|
+
"@times-components/ts-styleguide": "1.37.0",
|
|
41
38
|
"prop-types": "15.7.2",
|
|
42
39
|
"styled-components": "4.3.2"
|
|
43
40
|
},
|
|
44
41
|
"devDependencies": {
|
|
45
42
|
"@babel/core": "7.4.4",
|
|
46
43
|
"@times-components/eslint-config-thetimes": "0.8.18",
|
|
47
|
-
"@times-components/jest-configurator": "
|
|
48
|
-
"@times-components/jest-serializer": "3.
|
|
49
|
-
"@times-components/markup": "3.
|
|
50
|
-
"@times-components/storybook": "4.
|
|
51
|
-
"@times-components/test-utils": "2.
|
|
52
|
-
"@times-components/webpack-configurator": "2.0
|
|
44
|
+
"@times-components/jest-configurator-web": "0.8.0",
|
|
45
|
+
"@times-components/jest-serializer": "3.4.0",
|
|
46
|
+
"@times-components/markup": "3.7.0",
|
|
47
|
+
"@times-components/storybook": "4.5.0",
|
|
48
|
+
"@times-components/test-utils": "2.4.0",
|
|
49
|
+
"@times-components/webpack-configurator": "2.1.0",
|
|
53
50
|
"babel-jest": "24.8.0",
|
|
54
|
-
"babel-plugin-styled-components": "1.10.6",
|
|
55
51
|
"eslint": "5.9.0",
|
|
56
52
|
"jest": "24.8.0",
|
|
57
53
|
"jest-styled-components": "6.3.1",
|
|
58
54
|
"prettier": "1.14.3",
|
|
59
55
|
"react": "16.9.0",
|
|
60
56
|
"react-dom": "16.9.0",
|
|
61
|
-
"react-native": "0.61.5",
|
|
62
57
|
"react-test-renderer": "16.9.0",
|
|
63
|
-
"webpack": "4.30.0"
|
|
64
|
-
"webpack-cli": "3.3.1"
|
|
58
|
+
"webpack": "4.30.0"
|
|
65
59
|
},
|
|
66
60
|
"resolutions": {
|
|
67
61
|
"react": "16.9.0",
|
|
@@ -69,12 +63,10 @@
|
|
|
69
63
|
},
|
|
70
64
|
"peerDependencies": {
|
|
71
65
|
"react": ">=16.9",
|
|
72
|
-
"react-dom": ">=16.9"
|
|
73
|
-
"react-native": ">=0.59",
|
|
74
|
-
"react-native-web": "0.11.4"
|
|
66
|
+
"react-dom": ">=16.9"
|
|
75
67
|
},
|
|
76
68
|
"publishConfig": {
|
|
77
69
|
"access": "public"
|
|
78
70
|
},
|
|
79
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "fe2f12b7448a88662c53f840772282cd97756c5c"
|
|
80
72
|
}
|
package/rnw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports=function(e){var t={};function r
|
|
1
|
+
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t){e.exports=require("@times-components/ts-styleguide/rnw")},function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("styled-components")},function(e,t){e.exports=require("react")},function(e,t,n){"use strict";n.r(t);var r=n(2),o=n.n(r),i=n(0);const a={cultureMagazine:104,dropCap:110,stMagazine:105,styleMagazine:103},p={cultureMagazine:.85,dropCap:.55,stMagazine:.7,styleMagazine:.8},l={cultureMagazine:-.06,dropCap:.2,stMagazine:.065,styleMagazine:-.01},u=o.a.p.withConfig({displayName:"responsive__Paragraph",componentId:"sc-1pktst5-0"})(["color:",';display:block;font-family:"','";line-height:26px;font-size:',"px;margin:0 auto ",";padding-right:",";padding-left:",';&:first-of-type:after{content:"";clear:both;display:table;}@media (min-width:',"px){font-size:","px;line-height:30px;padding-left:0;padding-right:0;width:80.8%;}@media (min-width:","px){width:56.2%;}"],i.colours.functional.primary,i.fonts.bodyRegular,i.fontSizes.bodyMobile,Object(i.spacing)(5),Object(i.spacing)(2),Object(i.spacing)(2),i.breakpoints.medium,i.fontSizes.body,i.breakpoints.wide),s=o.a.span.withConfig({displayName:"responsive__DropCap",componentId:"sc-1pktst5-1"})(["float:left;color:",";padding-right:10px;line-height:1em;",";"],i.colours.functional.primary,e=>{let t=e.font,n=void 0===t?"dropCap":t;return Object(r.css)(["margin-top:","em;line-height:","em;font-size:",'px;font-family:"','";'],l[n],p[n],a[n],i.fonts[n])});var c=u,f=n(3),d=n.n(f),g=n(1),y=n.n(g);y.a.string,y.a.string;function m(e){let t=e.colour,n=e.children,r=e.font;return d.a.createElement(s,{font:r,style:{color:t}},n)}m.defaultProps={colour:"black",font:"dropCap"};var b=m;n.d(t,"DropCapView",(function(){return b}));t.default=c}]);
|