@mohamed-karawia/library 0.1.8 → 0.1.12
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/dist/stories/Pages/Chat/Chat.js +3 -0
- package/dist/stories/Pages/ViewWorld/constatnts.js +9 -5
- package/dist/stories/Reusable Components/Cards/Card-style-3/CardStyle3.js +7 -1
- package/dist/stories/Reusable Components/WidgetContainer/WidgetContainer.js +7 -2
- package/dist/stories/helpers/util.js +10 -3
- package/mohamed-karawia-library-0.1.9.tgz +0 -0
- package/package.json +6 -4
- package/src/stories/Pages/Chat/Chat.jsx +1 -0
- package/src/stories/Pages/ViewWorld/constatnts.js +6 -6
- package/src/stories/Reusable Components/Cards/Card-style-3/CardStyle3.jsx +5 -1
- package/src/stories/Reusable Components/WidgetContainer/WidgetContainer.jsx +7 -1
- package/src/stories/helpers/util.js +3 -3
- package/.eslintcache +0 -1
@@ -71,6 +71,9 @@ var Chat = function Chat(_ref) {
|
|
71
71
|
showOnHover: true
|
72
72
|
}
|
73
73
|
}
|
74
|
+
},
|
75
|
+
cardClicked: function cardClicked(path) {
|
76
|
+
return alert(path);
|
74
77
|
}
|
75
78
|
})), /*#__PURE__*/_react.default.createElement(_Center.default, null, /*#__PURE__*/_react.default.createElement(_SpaceContainer.default, {
|
76
79
|
title: "Music Album",
|
@@ -7,16 +7,20 @@ exports.MOVIES_SONGS = exports.MOVIES_DATA = exports.GAMING_SONGS = exports.GAMI
|
|
7
7
|
var SPACES = [{
|
8
8
|
title: 'Main List',
|
9
9
|
data: [{
|
10
|
-
title: 'Cargo Sprint'
|
10
|
+
title: 'Cargo Sprint',
|
11
|
+
path: 'cago'
|
11
12
|
}, {
|
12
|
-
title: 'Movies'
|
13
|
+
title: 'Movies',
|
14
|
+
path: 'movies'
|
13
15
|
}]
|
14
16
|
}, {
|
15
|
-
title: 'Entertainment
|
17
|
+
title: 'Entertainment',
|
16
18
|
data: [{
|
17
|
-
title: 'Gaming'
|
19
|
+
title: 'Gaming',
|
20
|
+
path: 'games'
|
18
21
|
}, {
|
19
|
-
title: 'Music'
|
22
|
+
title: 'Music',
|
23
|
+
path: 'music'
|
20
24
|
}]
|
21
25
|
}];
|
22
26
|
exports.SPACES = SPACES;
|
@@ -23,7 +23,7 @@ var _globalCardStyles = require("../globalCardStyles");
|
|
23
23
|
|
24
24
|
var _templateObject;
|
25
25
|
|
26
|
-
var _excluded = ["title", "description"];
|
26
|
+
var _excluded = ["title", "description", "path"];
|
27
27
|
|
28
28
|
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); }
|
29
29
|
|
@@ -32,6 +32,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
32
32
|
var CardStyle3 = function CardStyle3(_ref) {
|
33
33
|
var title = _ref.title,
|
34
34
|
description = _ref.description,
|
35
|
+
path = _ref.path,
|
35
36
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
36
37
|
|
37
38
|
var _useState = (0, _react.useState)(false),
|
@@ -43,7 +44,12 @@ var CardStyle3 = function CardStyle3(_ref) {
|
|
43
44
|
console.log(action);
|
44
45
|
};
|
45
46
|
|
47
|
+
var cardClicked = function cardClicked() {
|
48
|
+
props.cardClicked(path);
|
49
|
+
};
|
50
|
+
|
46
51
|
return /*#__PURE__*/_react.default.createElement(_globalCardStyles.MainCard, Object.assign({
|
52
|
+
onClick: cardClicked,
|
47
53
|
onMouseEnter: function onMouseEnter(e) {
|
48
54
|
return setShowIcons(true);
|
49
55
|
},
|
@@ -29,7 +29,12 @@ var WidgetContainer = function WidgetContainer(_ref) {
|
|
29
29
|
widgetControls = _ref.widgetControls,
|
30
30
|
widgetProps = _ref.widgetProps,
|
31
31
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
32
|
-
|
32
|
+
|
33
|
+
var cardClicked = function cardClicked(path) {
|
34
|
+
props.cardClicked(path);
|
35
|
+
};
|
36
|
+
|
37
|
+
var child = (0, _util.getWidgetType)(widgetType, widgetProps, cardClicked);
|
33
38
|
|
34
39
|
var iconCliked = function iconCliked(action) {
|
35
40
|
console.log(action);
|
@@ -42,7 +47,7 @@ var WidgetContainer = function WidgetContainer(_ref) {
|
|
42
47
|
}, props.headerStyles)), /*#__PURE__*/_react.default.createElement(Body, null, child));
|
43
48
|
};
|
44
49
|
|
45
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n"])));
|
50
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n width: 100%;\n"])));
|
46
51
|
|
47
52
|
var Body = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0;\n padding: 0;\n"])));
|
48
53
|
|
@@ -88,7 +88,10 @@ var getCardStyle = function getCardStyle(cardProps, cardType, customCardStyles,
|
|
88
88
|
'card-style-3': /*#__PURE__*/_react.default.createElement(_CardStyle3.default, Object.assign({
|
89
89
|
key: index
|
90
90
|
}, cardProps, customCardStyles, {
|
91
|
-
cardControls: cardControls
|
91
|
+
cardControls: cardControls,
|
92
|
+
cardClicked: function cardClicked(path) {
|
93
|
+
return clicked(path);
|
94
|
+
}
|
92
95
|
})),
|
93
96
|
'card-style-4': /*#__PURE__*/_react.default.createElement(_CardStyle4.default, Object.assign({
|
94
97
|
key: index
|
@@ -167,9 +170,13 @@ var getCardStyle = function getCardStyle(cardProps, cardType, customCardStyles,
|
|
167
170
|
|
168
171
|
exports.getCardStyle = getCardStyle;
|
169
172
|
|
170
|
-
var getWidgetType = function getWidgetType(widgetType, props) {
|
173
|
+
var getWidgetType = function getWidgetType(widgetType, props, _cardClicked) {
|
171
174
|
var widgetTypes = {
|
172
|
-
'list': /*#__PURE__*/_react.default.createElement(_ReusableList.default,
|
175
|
+
'list': /*#__PURE__*/_react.default.createElement(_ReusableList.default, Object.assign({
|
176
|
+
cardClicked: function cardClicked(path) {
|
177
|
+
return _cardClicked(path);
|
178
|
+
}
|
179
|
+
}, props)),
|
173
180
|
'music player': /*#__PURE__*/_react.default.createElement(_MusicPlayerWidget.default, props),
|
174
181
|
'logo': /*#__PURE__*/_react.default.createElement(_LogoWidget.default, props),
|
175
182
|
'video player': /*#__PURE__*/_react.default.createElement(_VideoPlayer.default, props)
|
Binary file
|
package/package.json
CHANGED
@@ -10,14 +10,16 @@
|
|
10
10
|
]
|
11
11
|
]
|
12
12
|
},
|
13
|
-
"version": "0.1.
|
13
|
+
"version": "0.1.12",
|
14
14
|
"private": false,
|
15
15
|
"dependencies": {
|
16
16
|
"@babel/cli": "^7.16.7",
|
17
17
|
"@babel/runtime": "^7.15.4",
|
18
|
+
"@editorjs/editorjs": "^2.22.2",
|
18
19
|
"@editorjs/header": "^2.6.1",
|
19
20
|
"@editorjs/image": "^2.6.2",
|
20
21
|
"@editorjs/marker": "^1.2.2",
|
22
|
+
"@editorjs/paragraph": "^2.8.0",
|
21
23
|
"@editorjs/table": "^2.0.1",
|
22
24
|
"@giphy/js-fetch-api": "^4.1.2",
|
23
25
|
"@giphy/react-components": "^5.3.1",
|
@@ -34,7 +36,6 @@
|
|
34
36
|
"formik": "^2.2.9",
|
35
37
|
"moment": "^2.29.1",
|
36
38
|
"rc-slider": "^9.7.5",
|
37
|
-
"react": "^16.14.0",
|
38
39
|
"react-async-hook": "^4.0.0",
|
39
40
|
"react-autocomplete": "^1.8.1",
|
40
41
|
"react-dates": "^21.8.0",
|
@@ -59,6 +60,9 @@
|
|
59
60
|
"web-vitals": "^1.0.1",
|
60
61
|
"yup": "^0.32.9"
|
61
62
|
},
|
63
|
+
"peerDependencies": {
|
64
|
+
"react": "^16.14.0"
|
65
|
+
},
|
62
66
|
"scripts": {
|
63
67
|
"start": "react-scripts start",
|
64
68
|
"build": "cross-env BABEL_ENV=production babel src -d dist",
|
@@ -96,8 +100,6 @@
|
|
96
100
|
]
|
97
101
|
},
|
98
102
|
"devDependencies": {
|
99
|
-
"@editorjs/editorjs": "^2.22.2",
|
100
|
-
"@editorjs/paragraph": "^2.8.0",
|
101
103
|
"@editorjs/simple-image": "^1.4.1",
|
102
104
|
"@geometricpanda/storybook-addon-badges": "^0.0.4",
|
103
105
|
"@storybook/addon-a11y": "^6.3.8",
|
@@ -2,15 +2,15 @@ export const SPACES = [
|
|
2
2
|
{
|
3
3
|
title: 'Main List',
|
4
4
|
data: [
|
5
|
-
{title: 'Cargo Sprint'},
|
6
|
-
{title: 'Movies'}
|
7
|
-
]
|
5
|
+
{title: 'Cargo Sprint', path: 'cago'},
|
6
|
+
{title: 'Movies', path: 'movies'}
|
7
|
+
],
|
8
8
|
},
|
9
9
|
{
|
10
|
-
title: 'Entertainment
|
10
|
+
title: 'Entertainment',
|
11
11
|
data: [
|
12
|
-
{title: 'Gaming'},
|
13
|
-
{title: 'Music'}
|
12
|
+
{title: 'Gaming', path: 'games'},
|
13
|
+
{title: 'Music', path: 'music'}
|
14
14
|
]
|
15
15
|
}
|
16
16
|
]
|
@@ -5,16 +5,20 @@ import PropTypes from "prop-types";
|
|
5
5
|
import Controls from '../../Controls/Controls';
|
6
6
|
import { globalContent, MainCard, Title, Description } from '../globalCardStyles';
|
7
7
|
|
8
|
-
const CardStyle3 = ({ title, description, ...props }) => {
|
8
|
+
const CardStyle3 = ({ title, description, path, ...props }) => {
|
9
9
|
const [showIcons, setShowIcons] = useState(false)
|
10
10
|
|
11
11
|
const iconCliked = (action) => {
|
12
12
|
console.log(action)
|
13
13
|
}
|
14
14
|
|
15
|
+
const cardClicked = () => {
|
16
|
+
props.cardClicked(path)
|
17
|
+
}
|
15
18
|
|
16
19
|
return (
|
17
20
|
<MainCard
|
21
|
+
onClick={cardClicked}
|
18
22
|
onMouseEnter={e => setShowIcons(true)}
|
19
23
|
onMouseLeave={e => setShowIcons(false)}
|
20
24
|
{...props}>
|
@@ -13,7 +13,12 @@ const WidgetContainer = ({
|
|
13
13
|
...props
|
14
14
|
}) => {
|
15
15
|
|
16
|
-
const
|
16
|
+
const cardClicked = (path) => {
|
17
|
+
props.cardClicked(path)
|
18
|
+
}
|
19
|
+
|
20
|
+
const child = getWidgetType(widgetType, widgetProps, cardClicked)
|
21
|
+
|
17
22
|
|
18
23
|
const iconCliked = (action) => {
|
19
24
|
console.log(action)
|
@@ -39,6 +44,7 @@ const WidgetContainer = ({
|
|
39
44
|
const Container = styled.div`
|
40
45
|
display: flex;
|
41
46
|
flex-direction: column;
|
47
|
+
width: 100%;
|
42
48
|
`
|
43
49
|
|
44
50
|
const Body = styled.div`
|
@@ -44,7 +44,7 @@ export const getCardStyle = (cardProps, cardType, customCardStyles, cardControls
|
|
44
44
|
const cardTypes = {
|
45
45
|
'card-style-1': (<CardStyle1 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls} />),
|
46
46
|
'card-style-2': (<CardStyle2 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls}/>),
|
47
|
-
'card-style-3': (<CardStyle3 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls}/>),
|
47
|
+
'card-style-3': (<CardStyle3 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls} cardClicked={(path) => clicked(path)}/>),
|
48
48
|
'card-style-4': (<CardStyle4 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls}/>),
|
49
49
|
'card-style-6': (<CardStyle6 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls} cardClicked={() => clicked(index)} iconClicked={(action) => cardIconClicked(action, index)} />),
|
50
50
|
'card-style-7': (<CardStyle7 key={index} {...cardProps} {...customCardStyles} cardControls={cardControls} cardClicked={() => clicked(index)} iconClicked={(action) => cardIconClicked(action, index)} />),
|
@@ -56,9 +56,9 @@ export const getCardStyle = (cardProps, cardType, customCardStyles, cardControls
|
|
56
56
|
return cardTypes[cardType]
|
57
57
|
};
|
58
58
|
|
59
|
-
export const getWidgetType = (widgetType, props) => {
|
59
|
+
export const getWidgetType = (widgetType, props, cardClicked) => {
|
60
60
|
const widgetTypes = {
|
61
|
-
'list': (<ReusableList {...props}/>),
|
61
|
+
'list': (<ReusableList cardClicked={(path) => cardClicked(path)} {...props}/>),
|
62
62
|
'music player': (<MusicPlayerWidget {...props} />),
|
63
63
|
'logo': (<LogoWidget {...props}/>),
|
64
64
|
'video player': (<VideoPlayer {...props}/>)
|