@twreporter/react-components 8.15.1 → 8.16.0-rc.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 +45 -0
- package/lib/input/components/search-bar.js +1 -1
- package/lib/text/link.js +87 -0
- package/lib/text/stories/link.stories.js +42 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,51 @@
|
|
|
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
|
+
# [8.16.0-rc.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.15.2-rc.2...@twreporter/react-components@8.16.0-rc.0) (2023-02-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* abstract padding ([bdb104b](https://github.com/twreporter/twreporter-npm-packages/commit/bdb104ba374dd4210d3517c95edd5050274509f1))
|
|
12
|
+
* fix comments ([3fbc942](https://github.com/twreporter/twreporter-npm-packages/commit/3fbc942b0dfa8730a79d8c04a599af6de6de3a56))
|
|
13
|
+
* refactor some ([11217da](https://github.com/twreporter/twreporter-npm-packages/commit/11217da7d8698bd4f57e7becab5a2d9072a9dc39))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* add story ([b951b33](https://github.com/twreporter/twreporter-npm-packages/commit/b951b3388d7e174e25e8742708a70e7ddc63c97e))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## [8.15.2-rc.2](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.15.2-rc.1...@twreporter/react-components@8.15.2-rc.2) (2023-01-17)
|
|
25
|
+
|
|
26
|
+
**Note:** Version bump only for package @twreporter/react-components
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## [8.15.2-rc.1](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.15.2-rc.0...@twreporter/react-components@8.15.2-rc.1) (2023-01-16)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* fix defects for mobile/tablet header ([bb3f7e5](https://github.com/twreporter/twreporter-npm-packages/commit/bb3f7e523b3173712d9f308e76d781326a276c64))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## [8.15.2-rc.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.15.1...@twreporter/react-components@8.15.2-rc.0) (2023-01-12)
|
|
44
|
+
|
|
45
|
+
**Note:** Version bump only for package @twreporter/react-components
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
6
51
|
## [8.15.1](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.15.1-rc.7...@twreporter/react-components@8.15.1) (2023-01-06)
|
|
7
52
|
|
|
8
53
|
**Note:** Version bump only for package @twreporter/react-components
|
|
@@ -76,7 +76,7 @@ var Container = /*#__PURE__*/_styledComponents["default"].form.withConfig({
|
|
|
76
76
|
})(["display:flex;align-items:center;", " ", "{", " &,& > input{", "}", "}"], function (props) {
|
|
77
77
|
return props.widthType === 'stretch' ? 'width: 100%;' : '';
|
|
78
78
|
}, InputContainer, function (props) {
|
|
79
|
-
return props.focus ? "\n background-color: ".concat(props.focusBgColor, ";\n border: 1px solid ").concat(props.borderColor, ";\n ") : '';
|
|
79
|
+
return props.focus ? "\n background-color: ".concat(props.focusBgColor, ";\n border: 1px solid ").concat(props.borderColor, ";\n ") : 'border: 1px solid transparent;';
|
|
80
80
|
}, function (props) {
|
|
81
81
|
return props.widthType === 'stretch' ? 'width: 100%;' : '';
|
|
82
82
|
}, _mediaQuery["default"].desktopAndAbove(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n "])), function (props) {
|
package/lib/text/link.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
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 _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _theme = require("@twreporter/core/lib/constants/theme");
|
|
15
|
+
|
|
16
|
+
var _color = require("@twreporter/core/lib/constants/color");
|
|
17
|
+
|
|
18
|
+
var _excluded = ["path", "name", "theme", "isBold"];
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
22
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
|
+
|
|
24
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
25
|
+
|
|
26
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
27
|
+
|
|
28
|
+
var getColorFromTheme = function getColorFromTheme(theme) {
|
|
29
|
+
switch (theme) {
|
|
30
|
+
case _theme.ARTICLE_THEME.v2.photo:
|
|
31
|
+
return _color.COLOR_ARTICLE.milkTea;
|
|
32
|
+
|
|
33
|
+
case _theme.ARTICLE_THEME.v2.pink:
|
|
34
|
+
return _color.COLOR_ARTICLE.blue;
|
|
35
|
+
|
|
36
|
+
case _theme.ARTICLE_THEME.v2["default"]:
|
|
37
|
+
default:
|
|
38
|
+
return _color.COLOR_ARTICLE.brown;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var Text = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
43
|
+
displayName: "link__Text",
|
|
44
|
+
componentId: "pki7nr-0"
|
|
45
|
+
})(["color:", ";display:inline-block;font-size:16px;line-height:1;padding:", ";&:hover{padding-bottom:2px;border-width:0 0 1px 0;border-style:solid;border-color:", ";}"], function (props) {
|
|
46
|
+
return props.color;
|
|
47
|
+
}, function (props) {
|
|
48
|
+
return props.padding;
|
|
49
|
+
}, function (props) {
|
|
50
|
+
return props.color;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
var Anchor = /*#__PURE__*/_styledComponents["default"].a.withConfig({
|
|
54
|
+
displayName: "link__Anchor",
|
|
55
|
+
componentId: "pki7nr-1"
|
|
56
|
+
})(["text-decoration:none;"]);
|
|
57
|
+
|
|
58
|
+
var TextLink = function TextLink(_ref) {
|
|
59
|
+
var _ref$path = _ref.path,
|
|
60
|
+
path = _ref$path === void 0 ? '' : _ref$path,
|
|
61
|
+
_ref$name = _ref.name,
|
|
62
|
+
name = _ref$name === void 0 ? '' : _ref$name,
|
|
63
|
+
_ref$theme = _ref.theme,
|
|
64
|
+
theme = _ref$theme === void 0 ? _theme.ARTICLE_THEME.v2["default"] : _ref$theme,
|
|
65
|
+
_ref$isBold = _ref.isBold,
|
|
66
|
+
isBold = _ref$isBold === void 0 ? false : _ref$isBold,
|
|
67
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
68
|
+
|
|
69
|
+
var color = getColorFromTheme(theme);
|
|
70
|
+
return /*#__PURE__*/_react["default"].createElement(Anchor, {
|
|
71
|
+
href: path
|
|
72
|
+
}, /*#__PURE__*/_react["default"].createElement(Text, _extends({
|
|
73
|
+
color: color,
|
|
74
|
+
style: {
|
|
75
|
+
fontWeight: isBold ? 'bold' : 'normal'
|
|
76
|
+
}
|
|
77
|
+
}, props), name));
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
TextLink.propTypes = {
|
|
81
|
+
path: _propTypes["default"].string.isRequired,
|
|
82
|
+
name: _propTypes["default"].string,
|
|
83
|
+
theme: _propTypes["default"].string,
|
|
84
|
+
isBold: _propTypes["default"].bool
|
|
85
|
+
};
|
|
86
|
+
var _default = TextLink;
|
|
87
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.textLink = exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _link = _interopRequireDefault(require("../link"));
|
|
11
|
+
|
|
12
|
+
var _theme = require("@twreporter/core/lib/constants/theme");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
var _default = {
|
|
17
|
+
title: 'Text/Link',
|
|
18
|
+
component: _link["default"],
|
|
19
|
+
argTypes: {
|
|
20
|
+
theme: {
|
|
21
|
+
defaultValue: _theme.ARTICLE_THEME.v2["default"],
|
|
22
|
+
options: [_theme.ARTICLE_THEME.v2["default"], _theme.ARTICLE_THEME.v2.pink, _theme.ARTICLE_THEME.v2.photo],
|
|
23
|
+
control: {
|
|
24
|
+
type: 'radio'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports["default"] = _default;
|
|
30
|
+
|
|
31
|
+
var Template = function Template(args) {
|
|
32
|
+
return /*#__PURE__*/_react["default"].createElement(_link["default"], args);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var textLink = Template.bind({});
|
|
36
|
+
exports.textLink = textLink;
|
|
37
|
+
textLink.args = {
|
|
38
|
+
name: '分類',
|
|
39
|
+
path: '/categories/human_rights_and_society',
|
|
40
|
+
theme: _theme.ARTICLE_THEME.v2["default"],
|
|
41
|
+
isBold: true
|
|
42
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twreporter/react-components",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.16.0-rc.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"repository": "https://github.com/twreporter/twreporter-npm-packages.git",
|
|
6
6
|
"author": "twreporter <developer@twreporter.org>",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"chromatic": "npx chromatic --exit-zero-on-changes"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@twreporter/core": "^1.8.1",
|
|
19
|
-
"@twreporter/redux": "^7.
|
|
18
|
+
"@twreporter/core": "^1.8.2-rc.1",
|
|
19
|
+
"@twreporter/redux": "^7.5.0-rc.2",
|
|
20
20
|
"fontfaceobserver-es": "^3.3.3",
|
|
21
21
|
"hoist-non-react-statics": "^2.3.1",
|
|
22
22
|
"lodash": "^4.0.0",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"babel-loader": "^8.2.4",
|
|
45
45
|
"chromatic": "^6.5.4"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "1ebf9eeda3976aad554b576bf974c2718752ef4e"
|
|
48
48
|
}
|