@mohamed-karawia/library 0.1.15 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. package/dist/stories/Chat/Chat.js +127 -33
  2. package/dist/stories/Common Inputs/EditorComponent/EditorComponent.js +4 -2
  3. package/dist/stories/Common Inputs/Picker/Picker.js +61 -0
  4. package/dist/stories/Common Inputs/TextField/TextField.js +3 -1
  5. package/dist/stories/Community/Community.js +137 -0
  6. package/dist/stories/Enrollment/Admin/CreateForm/CreateForm.js +1 -1
  7. package/dist/stories/Enrollment/Admin/DetailedForm/DetailedForm.js +11 -23
  8. package/dist/stories/Enrollment/Admin/ViewForms/ViewForms.js +2 -17
  9. package/dist/stories/Enrollment/Guest/FillForm/FillForm.js +4 -17
  10. package/dist/stories/Events/Event/Event.js +117 -5
  11. package/dist/stories/Events/EventsList/EventsList.js +98 -19
  12. package/dist/stories/Forms/CreateSpace/CreateSpace.js +75 -0
  13. package/dist/stories/Library/Folders/Folders.js +82 -7
  14. package/dist/stories/Library/Notes/Notes.js +78 -4
  15. package/dist/stories/Library/ViewNote/ViewNote.js +7 -10
  16. package/dist/stories/Modals/NavbarPreviewModal/NavbarPreviewModal.js +54 -0
  17. package/dist/stories/Music Album/ViewAlbum/ViewAlbum.js +139 -23
  18. package/dist/stories/Music Album/ViewAlbums/ViewAlbums.js +70 -34
  19. package/dist/stories/Navbar/Navbar.js +15 -45
  20. package/dist/stories/Pages/Chat/Chat.js +13 -1
  21. package/dist/stories/Pages/Enrollment/DetailedForm/DetailedForm.js +19 -1
  22. package/dist/stories/Pages/Enrollment/FillForm/FillForm.js +7 -1
  23. package/dist/stories/Pages/Enrollment/Forms/Forms.js +24 -2
  24. package/dist/stories/Pages/Events/Event/Event.js +14 -5
  25. package/dist/stories/Pages/Events/Events/Events.js +1 -0
  26. package/dist/stories/Pages/Library/Folders/Library.js +7 -1
  27. package/dist/stories/Pages/Music/MusicAlbum/Music.js +12 -5
  28. package/dist/stories/Pages/Music/MusicAlbums/MusicAlbums.js +34 -5
  29. package/dist/stories/Pages/Photos/Album/Album.js +7 -1
  30. package/dist/stories/Pages/Photos/Albums/Albums.js +38 -2
  31. package/dist/stories/Photo Album/ViewAlbum/ViewAlbum.js +80 -27
  32. package/dist/stories/Photo Album/ViewAlbums/ViewAlbums.js +85 -60
  33. package/dist/stories/Preview/Preview.js +37 -0
  34. package/dist/stories/PreviewComponents/ChatPreview/ChatPreview.js +193 -0
  35. package/dist/stories/PreviewComponents/EventPreview/EventPreview.js +158 -0
  36. package/dist/stories/PreviewComponents/EventsPreview/EventsPreview.js +192 -0
  37. package/dist/stories/PreviewComponents/FoldersPreview/FoldersPreview.js +182 -0
  38. package/dist/stories/PreviewComponents/MusicAlbumPreview/MusicAlbumPreview.js +177 -0
  39. package/dist/stories/PreviewComponents/MusicAlbumsPreview/MusicAlbumsPreview.js +181 -0
  40. package/dist/stories/PreviewComponents/MusicPlayerPreview/MusicPlayerPreview.js +153 -0
  41. package/dist/stories/PreviewComponents/NavbarPreview/NavbarPreview.js +112 -0
  42. package/dist/stories/PreviewComponents/NotesPreview/NotesPreview.js +173 -0
  43. package/dist/stories/PreviewComponents/PhotoAlbumPreview/PhotoAlbumPreview.js +189 -0
  44. package/dist/stories/PreviewComponents/PhotoAlbumsPreview/PhotoAlbumsPreview.js +189 -0
  45. package/dist/stories/PreviewComponents/SpacesListPreview/SpacesListPreview.js +197 -0
  46. package/dist/stories/PreviewComponents/VideoAlbumPreview/VideoAlbumPreview.js +189 -0
  47. package/dist/stories/PreviewComponents/VideoAlbumsPreview/VideoAlbumsPreview.js +175 -0
  48. package/dist/stories/PreviewComponents/VideoPreview/VideoPreview.js +172 -0
  49. package/dist/stories/PreviewComponents/globalStyles.js +26 -0
  50. package/dist/stories/Reusable Components/Cards/Card-style-10/CardStyle10.js +10 -5
  51. package/dist/stories/Reusable Components/Cards/Card-style-11/CardStyle11.js +8 -4
  52. package/dist/stories/Reusable Components/Cards/Card-style-3/CardStyle3.js +3 -2
  53. package/dist/stories/Reusable Components/Cards/Card-style-6/CardStyle6.js +10 -4
  54. package/dist/stories/Reusable Components/Cards/Card-style-8/CardStyle8.js +4 -2
  55. package/dist/stories/Reusable Components/Cards/Card-style-9/CardStyle9.js +26 -15
  56. package/dist/stories/Reusable Components/Cards/globalCardStyles.js +3 -3
  57. package/dist/stories/Reusable Components/Community/Community.js +76 -0
  58. package/dist/stories/Reusable Components/Gallery/Gallery.js +17 -18
  59. package/dist/stories/Reusable Components/ReactModal/ReactModal.js +11 -30
  60. package/dist/stories/Reusable Components/ReusableForm/ReusableForm.js +20 -3
  61. package/dist/stories/Reusable Components/ReusableList/ReusableList.js +15 -9
  62. package/dist/stories/Reusable Components/Tabs/Tabs.js +68 -0
  63. package/dist/stories/Sections/Sections.js +67 -0
  64. package/dist/stories/VideoAlbum/AlbumsGallery/AlbumsGallery.js +77 -18
  65. package/dist/stories/VideoAlbum/VideoSpace/VideoSpace.js +96 -3
  66. package/dist/stories/VideoAlbum/ViewAlbum/ViewAlbum.js +78 -5
  67. package/dist/stories/Widgets/MusicPlayerWidget/MusicPlayerWidget.js +17 -11
  68. package/dist/stories/Widgets/SpacesListWidget/SpacesListWidget.js +115 -0
  69. package/dist/stories/Widgets/UsersWidget/UsersWidget.js +30 -0
  70. package/dist/stories/helpers/util.js +70 -7
  71. package/dist/stories/store/communities.js +943 -0
  72. package/dist/stories/store/store.js +44 -0
  73. package/package.json +5 -2
  74. package/src/stories/Chat/Chat.jsx +109 -35
  75. package/src/stories/Common Inputs/EditorComponent/EditorComponent.jsx +3 -3
  76. package/src/stories/Common Inputs/Picker/Picker.jsx +47 -0
  77. package/src/stories/Common Inputs/TextField/TextField.jsx +1 -1
  78. package/src/stories/Community/Community.jsx +110 -0
  79. package/src/stories/Enrollment/Admin/CreateForm/CreateForm.jsx +1 -0
  80. package/src/stories/Enrollment/Admin/DetailedForm/DetailedForm.jsx +8 -19
  81. package/src/stories/Enrollment/Admin/ViewForms/ViewForms.jsx +3 -17
  82. package/src/stories/Enrollment/Guest/FillForm/FillForm.jsx +6 -16
  83. package/src/stories/Events/Event/Event.jsx +98 -5
  84. package/src/stories/Events/EventsList/EventsList.jsx +101 -22
  85. package/src/stories/Forms/CreateSpace/CreateSpace.jsx +73 -0
  86. package/src/stories/Library/Folders/Folders.jsx +82 -8
  87. package/src/stories/Library/Notes/Notes.jsx +65 -5
  88. package/src/stories/Library/ViewNote/ViewNote.jsx +1 -12
  89. package/src/stories/Modals/NavbarPreviewModal/NavbarPreviewModal.jsx +31 -0
  90. package/src/stories/Music Album/ViewAlbum/ViewAlbum.jsx +133 -21
  91. package/src/stories/Music Album/ViewAlbums/ViewAlbums.jsx +62 -36
  92. package/src/stories/Navbar/Navbar.jsx +51 -49
  93. package/src/stories/Pages/Chat/Chat.jsx +17 -4
  94. package/src/stories/Pages/Enrollment/DetailedForm/DetailedForm.jsx +20 -1
  95. package/src/stories/Pages/Enrollment/FillForm/FillForm.jsx +6 -0
  96. package/src/stories/Pages/Enrollment/Forms/Forms.jsx +23 -1
  97. package/src/stories/Pages/Events/Event/Event.jsx +12 -4
  98. package/src/stories/Pages/Events/Events/Events.jsx +75 -74
  99. package/src/stories/Pages/Library/Folders/Library.jsx +7 -1
  100. package/src/stories/Pages/Music/MusicAlbum/Music.jsx +16 -8
  101. package/src/stories/Pages/Music/MusicAlbums/MusicAlbums.jsx +28 -27
  102. package/src/stories/Pages/Photos/Album/Album.jsx +7 -1
  103. package/src/stories/Pages/Photos/Albums/Albums.jsx +25 -20
  104. package/src/stories/Photo Album/ViewAlbum/ViewAlbum.jsx +63 -21
  105. package/src/stories/Photo Album/ViewAlbums/ViewAlbums.jsx +65 -66
  106. package/src/stories/Preview/Preview.jsx +35 -0
  107. package/src/stories/PreviewComponents/ChatPreview/ChatPreview.jsx +132 -0
  108. package/src/stories/PreviewComponents/EventPreview/EventPreview.jsx +116 -0
  109. package/src/stories/PreviewComponents/EventsPreview/EventsPreview.jsx +132 -0
  110. package/src/stories/PreviewComponents/FoldersPreview/FoldersPreview.jsx +127 -0
  111. package/src/stories/PreviewComponents/MusicAlbumPreview/MusicAlbumPreview.jsx +124 -0
  112. package/src/stories/PreviewComponents/MusicAlbumsPreview/MusicAlbumsPreview.jsx +126 -0
  113. package/src/stories/PreviewComponents/MusicPlayerPreview/MusicPlayerPreview.jsx +113 -0
  114. package/src/stories/PreviewComponents/NavbarPreview/NavbarPreview.jsx +93 -0
  115. package/src/stories/PreviewComponents/NotesPreview/NotesPreview.jsx +122 -0
  116. package/src/stories/PreviewComponents/PhotoAlbumPreview/PhotoAlbumPreview.jsx +129 -0
  117. package/src/stories/PreviewComponents/PhotoAlbumsPreview/PhotoAlbumsPreview.jsx +129 -0
  118. package/src/stories/PreviewComponents/SpacesListPreview/SpacesListPreview.jsx +138 -0
  119. package/src/stories/PreviewComponents/VideoAlbumPreview/VideoAlbumPreview.jsx +129 -0
  120. package/src/stories/PreviewComponents/VideoAlbumsPreview/VideoAlbumsPreview.jsx +124 -0
  121. package/src/stories/PreviewComponents/VideoPreview/VideoPreview.jsx +125 -0
  122. package/src/stories/PreviewComponents/globalStyles.js +20 -0
  123. package/src/stories/Reusable Components/Cards/Card-style-10/CardStyle10.jsx +13 -6
  124. package/src/stories/Reusable Components/Cards/Card-style-11/CardStyle11.jsx +5 -5
  125. package/src/stories/Reusable Components/Cards/Card-style-3/CardStyle3.jsx +5 -2
  126. package/src/stories/Reusable Components/Cards/Card-style-6/CardStyle6.jsx +12 -6
  127. package/src/stories/Reusable Components/Cards/Card-style-8/CardStyle8.jsx +2 -2
  128. package/src/stories/Reusable Components/Cards/Card-style-9/CardStyle9.jsx +12 -8
  129. package/src/stories/Reusable Components/Cards/globalCardStyles.js +3 -2
  130. package/src/stories/Reusable Components/Community/Community.jsx +70 -0
  131. package/src/stories/Reusable Components/Gallery/Gallery.jsx +15 -10
  132. package/src/stories/Reusable Components/ReactModal/ReactModal.jsx +3 -25
  133. package/src/stories/Reusable Components/ReusableForm/ReusableForm.jsx +19 -7
  134. package/src/stories/Reusable Components/ReusableHeader/ReusableHeader.jsx +0 -2
  135. package/src/stories/Reusable Components/ReusableList/ReusableList.jsx +24 -8
  136. package/src/stories/Reusable Components/Tabs/Tabs.jsx +67 -0
  137. package/src/stories/Sections/Sections.jsx +56 -0
  138. package/src/stories/VideoAlbum/AlbumsGallery/AlbumsGallery.jsx +57 -16
  139. package/src/stories/VideoAlbum/VideoSpace/VideoSpace.jsx +70 -1
  140. package/src/stories/VideoAlbum/ViewAlbum/ViewAlbum.jsx +65 -8
  141. package/src/stories/Widgets/MusicPlayerWidget/MusicPlayerWidget.jsx +14 -7
  142. package/src/stories/Widgets/SpacesListWidget/SpacesListWidget.jsx +78 -0
  143. package/src/stories/Widgets/UsersWidget/UsersWidget.jsx +20 -0
  144. package/src/stories/helpers/util.js +50 -6
  145. package/src/stories/store/communities.js +705 -0
  146. package/src/stories/store/store.js +33 -0
  147. package/src/stories/styling.json +92 -0
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = exports.deleteEvent = exports.addEvent = void 0;
9
+
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
11
+
12
+ var _toolkit = require("@reduxjs/toolkit");
13
+
14
+ var _communities = require("./communities");
15
+
16
+ var Community = (0, _toolkit.createSlice)({
17
+ name: 'community',
18
+ initialState: _communities.community,
19
+ reducers: {
20
+ addEvent: function addEvent(state, action) {
21
+ state.spaces[1].spaceProps.events = [].concat((0, _toConsumableArray2.default)(state.spaces[1].spaceProps.events), [action.payload]); // console.log(action)
22
+ // alert
23
+
24
+ console.log(action);
25
+ },
26
+ deleteEvent: function deleteEvent(state, action) {
27
+ var eventsAfterDelete = (0, _toConsumableArray2.default)(state.spaces[1].spaceProps.events);
28
+ eventsAfterDelete.splice(action.payload, 1);
29
+ state.spaces[1].spaceProps.events = eventsAfterDelete;
30
+ }
31
+ }
32
+ });
33
+ var _Community$actions = Community.actions,
34
+ addEvent = _Community$actions.addEvent,
35
+ deleteEvent = _Community$actions.deleteEvent;
36
+ exports.deleteEvent = deleteEvent;
37
+ exports.addEvent = addEvent;
38
+ var store = (0, _toolkit.configureStore)({
39
+ reducer: {
40
+ communities: Community.reducer
41
+ }
42
+ });
43
+ var _default = store;
44
+ exports.default = _default;
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ]
11
11
  ]
12
12
  },
13
- "version": "0.1.15",
13
+ "version": "0.1.19",
14
14
  "private": false,
15
15
  "dependencies": {
16
16
  "@babel/cli": "^7.16.7",
@@ -23,6 +23,7 @@
23
23
  "@editorjs/table": "^2.0.1",
24
24
  "@giphy/js-fetch-api": "^4.1.2",
25
25
  "@giphy/react-components": "^5.3.1",
26
+ "@reduxjs/toolkit": "^1.7.2",
26
27
  "@testing-library/jest-dom": "^5.11.4",
27
28
  "@testing-library/react": "^11.1.0",
28
29
  "@testing-library/user-event": "^12.1.10",
@@ -38,6 +39,7 @@
38
39
  "rc-slider": "^9.7.5",
39
40
  "react-async-hook": "^4.0.0",
40
41
  "react-autocomplete": "^1.8.1",
42
+ "react-color": "^2.19.3",
41
43
  "react-dates": "^21.8.0",
42
44
  "react-dom": "^16.14.0",
43
45
  "react-dropzone": "^11.4.0",
@@ -48,8 +50,9 @@
48
50
  "react-icons": "^4.2.0",
49
51
  "react-jinke-music-player": "^4.24.1",
50
52
  "react-mentions": "^4.3.0",
51
- "react-modal": "^3.14.3",
53
+ "react-modal": "^3.14.4",
52
54
  "react-player": "^2.9.0",
55
+ "react-redux": "^7.2.6",
53
56
  "react-resize-observer": "^1.1.1",
54
57
  "react-scripts": "4.0.1",
55
58
  "react-select": "^4.3.1",
@@ -1,59 +1,134 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
4
 
5
- import { controls } from '../Reusable Components/fakeData';
6
- import ReusableHeader from '../Reusable Components/ReusableHeader/ReusableHeader';
5
+
6
+ import { BsGear } from "react-icons/bs";
7
7
  import List from '../Reusable Components/ReusableList/ReusableList';
8
8
  import RichTextInput from '../Common Inputs/RichTextInput/RichTextInput';
9
+ import ChatPreview from '../PreviewComponents/ChatPreview/ChatPreview';
10
+ import Modal from '../Reusable Components/ReactModal/ReactModal';
11
+ import Community from '../Reusable Components/Community/Community';
12
+
13
+
14
+ import Tabs from '../Reusable Components/Tabs/Tabs';
15
+ import Sections from '../Sections/Sections'
16
+
17
+
18
+ const listControls = [
19
+ { icon: (<BsGear />), action: 'config', name: 'Config' },
20
+ ]
9
21
 
10
22
  const Chat = ({
11
23
  data,
12
- title,
13
- titleColor,
14
- headerBackground,
15
- headerPadding,
16
- cardBackgroundColor,
17
- cardTitleColor,
18
- textColor,
19
24
  users,
25
+ title,
26
+ backgroundColor,
20
27
  ...props }) => {
21
28
 
29
+ const [showConfigModal, setShowConfigModal] = useState(false);
30
+ const [centerContext, setCenterContext] = useState(<Chat users={users} data={data}/>)
31
+
32
+ const formChanged = (values) => {
33
+ console.log('context changed')
34
+ setCenterContext(<Chat users={users} data={data} {...values} />)
35
+ }
36
+
37
+ let tabs = [
38
+ {
39
+ title: 'New', id: 'preview'
40
+ },
41
+ {
42
+ title: 'Context', id: 'community'
43
+ }
44
+ ]
45
+
46
+ let sections = [
47
+ {
48
+ title: 'Styles',
49
+ data: [
50
+ {
51
+ title: 'Styling',
52
+ id: 'styling'
53
+ }
54
+ ]
55
+ }
56
+ ]
57
+
58
+ const onIconClicked = (action) => {
59
+ if (!props.preview) {
60
+ switch (action) {
61
+ case 'config':
62
+ setShowConfigModal(true)
63
+ break;
64
+ default:
65
+ break;
66
+ }
67
+ }
68
+ }
69
+
22
70
  return (
23
71
  <Container
24
- cardBackgroundColor={cardBackgroundColor}>
25
- <ReusableHeader
26
- title={title}
27
- titleColor={titleColor}
28
- controls={controls}
29
- controlsStyles={{
30
- iconColor: 'white',
31
- maxIcons: 4,
32
- dropdownBackground: 'white'
33
- }}
34
- headerBackground={headerBackground}
35
- padding={headerPadding} />
72
+ backgroundColor={backgroundColor}>
36
73
  <List
74
+ listTitle={title || 'Chat'}
37
75
  type="flat"
38
76
  data={data}
39
77
  cardStyle="card-style-8"
40
- customCardStyles={{
41
- cardBackgroundColor,
42
- cardTitleColor,
43
- cardDescriptionColor: textColor
44
- }}
78
+ iconClicked={onIconClicked}
79
+ listControls={listControls}
80
+ {...props}
45
81
  />
46
82
  <RichTextInput
47
83
  users={users}
48
84
  />
85
+ <Modal
86
+ modalIsOpen={showConfigModal}
87
+ closeModal={() => setShowConfigModal(false)}
88
+ exitModalButton={(e) => (
89
+ <div></div>
90
+ )}
91
+ >
92
+ <Sections
93
+ sections={sections}
94
+ backgroundColor={'white'}
95
+ sectionHeaderStyles={{
96
+ titleColor: 'white',
97
+ headerBackground: 'transparent'
98
+ }}
99
+ customCardStyles={{
100
+ cardPadding: 6,
101
+ cardTitleFontSize: 15,
102
+ cardBackgroundColor: '#2c2c2c',
103
+ cardTitleColor: 'white',
104
+ onHoverBackgroundColor: '#555555',
105
+ controlsStyles: {
106
+ showOnHover: true,
107
+ }
108
+ }}>
109
+ <Tabs
110
+ title="Chat Config"
111
+ tabs={tabs}
112
+ id='styling'
113
+ >
114
+ <ChatPreview
115
+ componentProps={{ data, users, title: props.title || "Chat", preview: true }}
116
+ formChanged={formChanged}
117
+ id="preview"
118
+ />
119
+ <Community
120
+ center={centerContext}
121
+ id="community" />
122
+ </Tabs>
123
+ </Sections>
124
+ </Modal>
49
125
  </Container>
50
126
  )
51
127
  }
52
128
 
53
129
  const Container = styled.div`
54
- background-color: ${cardBackgroundColor => cardBackgroundColor};
55
130
  width: 100%;
56
- padding: 15px 0;
131
+ background-color: ${({ backgroundColor }) => backgroundColor || 'transparent'};
57
132
  `
58
133
 
59
134
  Chat.defaultProps = {
@@ -63,12 +138,11 @@ Chat.defaultProps = {
63
138
  Chat.propTypes = {
64
139
  data: PropTypes.array.isRequired,
65
140
  title: PropTypes.string,
66
- titleColor: PropTypes.string,
67
- headerBackground: PropTypes.string,
68
- headerPadding: PropTypes.number,
69
- cardBackgroundColor: PropTypes.string,
70
- cardTitleColor: PropTypes.string,
71
- textColor: PropTypes.string
141
+ users: PropTypes.array,
142
+ backgroundColor: PropTypes.string,
143
+ customCardStyles: PropTypes.object,
144
+ headerStyles: PropTypes.object,
145
+ preview: PropTypes.bool
72
146
  }
73
147
 
74
148
  export default Chat
@@ -4,14 +4,14 @@ import PropTypes from "prop-types";
4
4
  import styled from 'styled-components';
5
5
 
6
6
  // Editor.js
7
- import EditorJs from 'react-editor-js';
7
+ import { createReactEditorJS } from 'react-editor-js'
8
8
  // Editor.js Constants
9
9
  import { EDITOR_JS_TOOLS } from "./constants";
10
10
 
11
11
 
12
12
  const EditorComponent = (props) => {
13
13
  const instanceRef = useRef(null)
14
-
14
+ const ReactEditorJS = createReactEditorJS()
15
15
 
16
16
  async function handleSave() {
17
17
  const savedData = await instanceRef.current.save()
@@ -20,7 +20,7 @@ const EditorComponent = (props) => {
20
20
 
21
21
  return (
22
22
  <Container {...props}>
23
- <EditorJs
23
+ <ReactEditorJS
24
24
  instanceRef={(instance) => (instanceRef.current = instance)}
25
25
  tools={EDITOR_JS_TOOLS}
26
26
  data={props.data}
@@ -0,0 +1,47 @@
1
+ import React, {useState} from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import { useField } from 'formik';
5
+
6
+ import { ChromePicker } from 'react-color';
7
+
8
+
9
+
10
+ const Picker = (props) => {
11
+ const [field, meta, helpers] = useField(props);
12
+
13
+ {
14
+ return (
15
+ <Container>
16
+ <Label htmlFor={props.name} {...props}>{props.label}</Label>
17
+ <ChromePicker
18
+ name={props.name}
19
+ color={field.value}
20
+ onChange={(color) => helpers.setValue(color.hex)}
21
+ onChangeComplete={(color) => helpers.setValue(color.hex)}
22
+ />
23
+ </Container>
24
+ );
25
+ }
26
+ };
27
+
28
+ const Container = styled.div`
29
+ display: flex;
30
+ flex-direction: column;
31
+ font-family: sans-serif;
32
+ `
33
+
34
+ const Label = styled.label`
35
+ margin-bottom: 5px;
36
+ text-transform: capitalize;
37
+ color: ${props => props.labelColor};
38
+ font-size: ${props => props.labelFontSize}px;
39
+ `
40
+
41
+ Picker.defaultProps = {};
42
+
43
+ Picker.propTypes = {
44
+ name: PropTypes.string
45
+ }
46
+
47
+ export default Picker;
@@ -10,7 +10,7 @@ const TextField = (props) => {
10
10
  return (
11
11
  <TextFieldWrapper>
12
12
  <Label htmlFor={field.name} {...props}>{props.label}</Label>
13
- <Input {...field} {...props} />
13
+ <Input type={props.type || 'text'} {...field} {...props} />
14
14
  {(meta.error && meta.touched) && <Error>{meta.error}</Error>}
15
15
  </TextFieldWrapper>
16
16
  )
@@ -0,0 +1,110 @@
1
+ import React, { useState, useEffect, useCallback } from 'react';
2
+ import styled from 'styled-components';
3
+ import { useDispatch, useSelector } from 'react-redux';
4
+ import { addEvent, deleteEvent } from '../store/store';
5
+
6
+ import Navbar from '../Navbar/Navbar'
7
+ import Body from '../Layout/Body/Body'
8
+ import Left from '../Layout/Left/Left'
9
+ import Center from '../Layout/Center/Center'
10
+ import Right from '../Layout/Right/Right'
11
+ import BaseMaterial from '../Containers/BaseMaterial';
12
+ import WidgetContainer from "../Reusable Components/WidgetContainer/WidgetContainer";
13
+
14
+ import Chat from '../Chat/Chat';
15
+ import Event from '../Events/Event/Event';
16
+ import EventsList from '../Events/EventsList/EventsList';
17
+ import Folders from '../Library/Folders/Folders';
18
+ import Notes from '../Library/Notes/Notes';
19
+ import MusicAlbum from '../Music Album/ViewAlbum/ViewAlbum';
20
+ import MusicAlbums from '../Music Album/ViewAlbums/ViewAlbums';
21
+ import PhotoAlbum from '../Photo Album/ViewAlbum/ViewAlbum';
22
+ import PhotoAlbums from '../Photo Album/ViewAlbums/ViewAlbums';
23
+ import VideoAlbums from '../VideoAlbum/AlbumsGallery/AlbumsGallery';
24
+ import VideoAlbum from '../VideoAlbum/ViewAlbum/ViewAlbum';
25
+ import VideoSpace from '../VideoAlbum/VideoSpace/VideoSpace';
26
+
27
+ const Community = (props) => {
28
+ const [spaceType, setSpaceType] = useState('chat');
29
+ const community = useSelector(state => state.communities)
30
+ const space = useSelector(state => {
31
+ return state.communities.spaces.find(x => x.spaceType === spaceType)
32
+ })
33
+ const spacesWidget = useSelector(state => state.communities.spacesListWidget.widgetSpacesList)
34
+ const dispatch = useDispatch();
35
+
36
+ const onAddEvent = (event) => {
37
+ dispatch(addEvent(event))
38
+ }
39
+
40
+ console.log(space)
41
+
42
+ const eventIconClicked = (action, index) => {
43
+ switch (action) {
44
+ case 'delete':
45
+ dispatch(deleteEvent(index))
46
+ break;
47
+
48
+ default:
49
+ break;
50
+ }
51
+ }
52
+
53
+ const switchSpace = (index, props) => {
54
+ setSpaceType(props.id)
55
+ }
56
+
57
+
58
+ return (
59
+ <BaseMaterial {...community.styles}>
60
+ <Navbar {...community.navbarStyles} />
61
+ <Body>
62
+ <Left>
63
+ <WidgetContainer
64
+ widgetType='spaces-list'
65
+ widgetProps={{
66
+ listTitle: spacesWidget.listTitle,
67
+ spaces: spacesWidget.spaces,
68
+ cardClicked: switchSpace,
69
+ headerStyles: spacesWidget.styles.header,
70
+ ...spacesWidget.styles.body
71
+ }}
72
+ />
73
+ </Left>
74
+ <Center>
75
+ {
76
+ {
77
+ 'chat': <Chat {...space.spaceProps} {...space.styles} />,
78
+ 'event': <Event {...space.spaceProps} {...space.styles} />,
79
+ 'events_list': <EventsList cardIconClicked={eventIconClicked} onAddEvent={onAddEvent} {...space.spaceProps} {...space.styles} />,
80
+ 'folders': <Folders {...space.spaceProps} {...space.styles} />,
81
+ 'notes': <Notes {...space.spaceProps} {...space.styles} />,
82
+ 'music_album': <MusicAlbum {...space.spaceProps} {...space.styles} />,
83
+ 'music_albums': <MusicAlbums {...space.spaceProps} {...space.styles} />,
84
+ 'photo_album': <PhotoAlbum {...space.spaceProps} {...space.styles}/>,
85
+ 'photo_albums': <PhotoAlbums {...space.spaceProps} {...space.styles}/>,
86
+ 'video_albums': <VideoAlbums {...space.spaceProps} {...space.styles}/>,
87
+ 'video_album': <VideoAlbum {...space.spaceProps} {...space.styles}/>,
88
+ 'video_space': <VideoSpace {...space.spaceProps} {...space.styles}/>
89
+
90
+ }[spaceType]
91
+ }
92
+ </Center>
93
+ <Right>{
94
+ space.widgets && space.widgets.map(widget => (
95
+ <WidgetContainer
96
+ widgetType={widget.widgetType}
97
+ widgetProps={{
98
+ ...widget.widgetProps,
99
+ ...widget.styles
100
+ }}
101
+ />
102
+ ))
103
+ }</Right>
104
+ </Body>
105
+ </BaseMaterial>
106
+ );
107
+ };
108
+
109
+
110
+ export default Community;
@@ -49,6 +49,7 @@ const AddQuestion = (props) => {
49
49
  }
50
50
 
51
51
  const Container = styled.div`
52
+ width: 100%;
52
53
  padding: 10px;
53
54
  background-color: 'white';
54
55
  display: flex;
@@ -13,11 +13,11 @@ const DetailedForm = ({
13
13
  }) => {
14
14
 
15
15
  const onAccept = () => {
16
- alert('Form Accepted')
16
+ props.onAccept()
17
17
  }
18
18
 
19
19
  const onDecline = () => {
20
- alert('Form Declined')
20
+ props.onDecline()
21
21
  }
22
22
 
23
23
  return (
@@ -26,27 +26,15 @@ const DetailedForm = ({
26
26
  <Card
27
27
  title={userName}
28
28
  img={userImg}
29
- cardImageRadius="100"
29
+ {...props.userHeaderStyles}
30
30
  />
31
31
  </User>
32
32
  <List
33
- listTitle="Form"
33
+ listTitle={props.title || "Form"}
34
34
  data={questions}
35
35
  type='flat'
36
36
  cardStyle='card-style-3'
37
- headerStyles={{
38
- padding: 10,
39
- headerBackground: '#FE1744',
40
- titleColor: '#ffff',
41
- controlsStyles: {
42
- dropdownBackground: 'black',
43
- dropdownFontColor: 'white',
44
- dropdownItemHoverColor: '#FE1744'
45
- },
46
- }}
47
- customCardStyles={{
48
- cardPadding: 10
49
- }}
37
+ {...props}
50
38
  />
51
39
  <Buttons>
52
40
  <Accept onClick={onAccept}>Accept</Accept>
@@ -57,7 +45,7 @@ const DetailedForm = ({
57
45
  }
58
46
 
59
47
  const Container = styled.div`
60
- background-color: white;
48
+ background-color: ${props => props.backgroundColor || 'transparent'};
61
49
  padding: 10px 0;
62
50
  width: 100%;
63
51
  `
@@ -92,7 +80,8 @@ DetailedForm.defaultProps = {};
92
80
  DetailedForm.propTypes = {
93
81
  userName: PropTypes.string,
94
82
  userImg: PropTypes.string,
95
- questions: PropTypes.array
83
+ questions: PropTypes.array,
84
+ title: PropTypes.string
96
85
  }
97
86
 
98
87
  export default DetailedForm
@@ -8,25 +8,10 @@ const ViewForms = ({
8
8
  }) => {
9
9
  return (
10
10
  <List
11
- listTitle="Submitted Forms"
11
+ listTitle={props.title || "Submitted Forms"}
12
12
  data={data}
13
13
  cardStyle="card-style-9"
14
14
  type="sectioned"
15
- sectionHeaderStyles={{
16
- cardTitleColor: 'white',
17
- cardBackgroundColor: 'black',
18
- cardPadding: 10
19
- }}
20
- headerStyles={{
21
- padding: 10,
22
- headerBackground: '#FE1744',
23
- titleColor: '#ffff',
24
- controlsStyles: {
25
- dropdownBackground: 'black',
26
- dropdownFontColor: 'white',
27
- dropdownItemHoverColor: '#FE1744'
28
- },
29
- }}
30
15
  {...props}
31
16
  />
32
17
  )
@@ -35,7 +20,8 @@ const ViewForms = ({
35
20
  ViewForms.defaultProps = {};
36
21
 
37
22
  ViewForms.propTypes = {
38
- data: PropTypes.array
23
+ data: PropTypes.array,
24
+ title: PropTypes.string
39
25
  }
40
26
 
41
27
  export default ViewForms
@@ -9,13 +9,6 @@ const FillForm = ({
9
9
  ...props
10
10
  }) => {
11
11
 
12
- // const initialValues = {
13
- // question0: '',
14
- // question1: '',
15
- // question2: '',
16
- // question3: '',
17
- // question4: '',
18
- // }
19
12
 
20
13
  const onCreate = (values) => {
21
14
  console.log(values)
@@ -28,19 +21,14 @@ const FillForm = ({
28
21
  return (
29
22
  <Container>
30
23
  <Form
31
- // initialValues={initialValues}
32
- formTitle="Join Community Form"
24
+ formTitle={props.formTitle || 'Join Community Form'}
33
25
  sections={sections}
34
26
  saveBtnText={props.saveBtnText}
35
27
  cancelBtnText={props.cancelBtnText}
36
28
  saveHandler={onCreate}
37
29
  cancelHandler={cancelHandler}
38
- headerStyles={{
39
- padding: 10,
40
- headerBackground: 'black',
41
- titleColor: '#ffff',
42
- }}
43
- bodyRowGap={10}
30
+ bodyRowGap={props.bodyRowGap || 10}
31
+ {...props}
44
32
  />
45
33
  </Container>
46
34
  )
@@ -55,7 +43,9 @@ FillForm.defaultProps = {};
55
43
  FillForm.propTypes = {
56
44
  sections: PropTypes.array,
57
45
  saveBtnText: PropTypes.string,
58
- cancelBtnText: PropTypes.string
46
+ cancelBtnText: PropTypes.string,
47
+ formTitle: PropTypes.string,
48
+ bodyRowGap: PropTypes.number
59
49
  }
60
50
 
61
51
  export default FillForm;