@digigov/react-core 0.20.0-navlist.alpha → 0.20.0-navlist.alpha.2
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/Masthead/index.d.ts +6 -0
- package/Masthead/index.js +4 -2
- package/es/Masthead/index.js +4 -2
- package/esm/Masthead/index.js +4 -2
- package/esm/index.js +1 -1
- package/package.json +2 -2
- package/src/Masthead/index.tsx +12 -3
package/Masthead/index.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BaseProps } from '@digigov/react-core/Base';
|
|
3
3
|
export interface MastheadProps extends BaseProps<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* color prop changes the background color of MastHead component.
|
|
7
|
+
* default value is primary.
|
|
8
|
+
*/
|
|
9
|
+
color?: 'primary' | 'secondary';
|
|
4
10
|
}
|
|
5
11
|
/**
|
|
6
12
|
* Use the Masthead on the top of the page.
|
package/Masthead/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var _Base = _interopRequireDefault(require("@digigov/react-core/Base"));
|
|
|
17
17
|
|
|
18
18
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
19
19
|
|
|
20
|
-
var _excluded = ["className", "children"];
|
|
20
|
+
var _excluded = ["className", "children", "color"];
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Use the Masthead on the top of the page.
|
|
@@ -25,11 +25,13 @@ var _excluded = ["className", "children"];
|
|
|
25
25
|
var Masthead = /*#__PURE__*/_react["default"].forwardRef(function Masthead(_ref, ref) {
|
|
26
26
|
var className = _ref.className,
|
|
27
27
|
children = _ref.children,
|
|
28
|
+
_ref$color = _ref.color,
|
|
29
|
+
color = _ref$color === void 0 ? 'primary' : _ref$color,
|
|
28
30
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
29
31
|
return /*#__PURE__*/_react["default"].createElement(_Base["default"], (0, _extends2["default"])({
|
|
30
32
|
as: "div",
|
|
31
33
|
ref: ref,
|
|
32
|
-
className: (0, _clsx["default"])(className,
|
|
34
|
+
className: (0, _clsx["default"])(className, color === 'secondary' && 'govgr-masthead--secondary', color === 'primary' && ['govgr-background-dark', 'govgr-masthead--primary'], true && 'govgr-masthead')
|
|
33
35
|
}, props), children);
|
|
34
36
|
});
|
|
35
37
|
|
package/es/Masthead/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "children"];
|
|
3
|
+
var _excluded = ["className", "children", "color"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import Base from '@digigov/react-core/Base';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -11,12 +11,14 @@ import clsx from 'clsx';
|
|
|
11
11
|
export var Masthead = /*#__PURE__*/React.forwardRef(function Masthead(_ref, ref) {
|
|
12
12
|
var className = _ref.className,
|
|
13
13
|
children = _ref.children,
|
|
14
|
+
_ref$color = _ref.color,
|
|
15
|
+
color = _ref$color === void 0 ? 'primary' : _ref$color,
|
|
14
16
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
17
|
|
|
16
18
|
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
17
19
|
as: "div",
|
|
18
20
|
ref: ref,
|
|
19
|
-
className: clsx(className,
|
|
21
|
+
className: clsx(className, color === 'secondary' && 'govgr-masthead--secondary', color === 'primary' && ['govgr-background-dark', 'govgr-masthead--primary'], true && 'govgr-masthead')
|
|
20
22
|
}, props), children);
|
|
21
23
|
});
|
|
22
24
|
export default Masthead;
|
package/esm/Masthead/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "children"];
|
|
3
|
+
var _excluded = ["className", "children", "color"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import Base from '@digigov/react-core/Base';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -11,12 +11,14 @@ import clsx from 'clsx';
|
|
|
11
11
|
export var Masthead = /*#__PURE__*/React.forwardRef(function Masthead(_ref, ref) {
|
|
12
12
|
var className = _ref.className,
|
|
13
13
|
children = _ref.children,
|
|
14
|
+
_ref$color = _ref.color,
|
|
15
|
+
color = _ref$color === void 0 ? 'primary' : _ref$color,
|
|
14
16
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
17
|
|
|
16
18
|
return /*#__PURE__*/React.createElement(Base, _extends({
|
|
17
19
|
as: "div",
|
|
18
20
|
ref: ref,
|
|
19
|
-
className: clsx(className,
|
|
21
|
+
className: clsx(className, color === 'secondary' && 'govgr-masthead--secondary', color === 'primary' && ['govgr-background-dark', 'govgr-masthead--primary'], true && 'govgr-masthead')
|
|
20
22
|
}, props), children);
|
|
21
23
|
});
|
|
22
24
|
export default Masthead;
|
package/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/react-core",
|
|
3
|
-
"version": "0.20.0-navlist.alpha",
|
|
3
|
+
"version": "0.20.0-navlist.alpha.2",
|
|
4
4
|
"description": "@digigov react core components",
|
|
5
5
|
"author": "GRNET Developers <devs@lists.grnet.gr>",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "dist"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@digigov/css": "0.
|
|
14
|
+
"@digigov/css": "0.31.0-navlist.alpha.2",
|
|
15
15
|
"clsx": "1.1.1",
|
|
16
16
|
"react": "^16.8.0 || ^17.0.0",
|
|
17
17
|
"react-dom": "^16.8.0 || ^17.0.0"
|
package/src/Masthead/index.tsx
CHANGED
|
@@ -2,19 +2,28 @@ import React from 'react';
|
|
|
2
2
|
import Base, { BaseProps } from '@digigov/react-core/Base';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
|
|
5
|
-
export interface MastheadProps extends BaseProps<'div'> {
|
|
5
|
+
export interface MastheadProps extends BaseProps<'div'> {
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* color prop changes the background color of MastHead component.
|
|
9
|
+
* default value is primary.
|
|
10
|
+
*/
|
|
11
|
+
color?: 'primary' | 'secondary';
|
|
12
|
+
}
|
|
6
13
|
/**
|
|
7
14
|
* Use the Masthead on the top of the page.
|
|
8
15
|
*/
|
|
9
16
|
export const Masthead = React.forwardRef<HTMLDivElement, MastheadProps>(
|
|
10
|
-
function Masthead({ className, children, ...props }, ref) {
|
|
17
|
+
function Masthead({ className, children, color = 'primary', ...props }, ref) {
|
|
11
18
|
return (
|
|
12
19
|
<Base
|
|
13
20
|
as="div"
|
|
14
21
|
ref={ref}
|
|
15
22
|
className={clsx(className, {
|
|
16
23
|
'govgr-masthead': true,
|
|
17
|
-
'govgr-background-dark':
|
|
24
|
+
'govgr-background-dark': color === 'primary',
|
|
25
|
+
'govgr-masthead--primary': color === 'primary',
|
|
26
|
+
'govgr-masthead--secondary': color === 'secondary',
|
|
18
27
|
})}
|
|
19
28
|
{...props}
|
|
20
29
|
>
|