@mohamed-karawia/library 0.1.18 → 0.1.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. package/dist/stories/Chat/Chat.js +114 -4
  2. package/dist/stories/Common Inputs/Picker/Picker.js +61 -0
  3. package/dist/stories/Common Inputs/TextField/TextField.js +3 -1
  4. package/dist/stories/Community/Community.js +159 -0
  5. package/dist/stories/Events/Event/Event.js +123 -4
  6. package/dist/stories/Events/EventsList/EventsList.js +98 -16
  7. package/dist/stories/Forms/CreateSpace/CreateSpace.js +75 -0
  8. package/dist/stories/Library/Folders/Folders.js +94 -9
  9. package/dist/stories/Library/Notes/Notes.js +94 -9
  10. package/dist/stories/Modals/NavbarPreviewModal/NavbarPreviewModal.js +54 -0
  11. package/dist/stories/Music Album/ViewAlbum/ViewAlbum.js +98 -10
  12. package/dist/stories/Music Album/ViewAlbums/ViewAlbums.js +96 -34
  13. package/dist/stories/Navbar/Navbar.js +1 -1
  14. package/dist/stories/Pages/Events/Event/Event.js +14 -5
  15. package/dist/stories/Pages/Music/MusicAlbums/MusicAlbums.js +2 -15
  16. package/dist/stories/Photo Album/ViewAlbum/ViewAlbum.js +94 -17
  17. package/dist/stories/Photo Album/ViewAlbums/ViewAlbums.js +88 -10
  18. package/dist/stories/Preview/Preview.js +1 -0
  19. package/dist/stories/PreviewComponents/ChatPreview/ChatPreview.js +193 -0
  20. package/dist/stories/PreviewComponents/EventPreview/EventPreview.js +158 -0
  21. package/dist/stories/PreviewComponents/EventsPreview/EventsPreview.js +192 -0
  22. package/dist/stories/PreviewComponents/FoldersPreview/FoldersPreview.js +182 -0
  23. package/dist/stories/PreviewComponents/MusicAlbumPreview/MusicAlbumPreview.js +177 -0
  24. package/dist/stories/PreviewComponents/MusicAlbumsPreview/MusicAlbumsPreview.js +181 -0
  25. package/dist/stories/PreviewComponents/MusicPlayerPreview/MusicPlayerPreview.js +153 -0
  26. package/dist/stories/PreviewComponents/NavbarPreview/NavbarPreview.js +112 -0
  27. package/dist/stories/PreviewComponents/NotesPreview/NotesPreview.js +173 -0
  28. package/dist/stories/PreviewComponents/PhotoAlbumPreview/PhotoAlbumPreview.js +189 -0
  29. package/dist/stories/PreviewComponents/PhotoAlbumsPreview/PhotoAlbumsPreview.js +189 -0
  30. package/dist/stories/PreviewComponents/SpacesListPreview/SpacesListPreview.js +197 -0
  31. package/dist/stories/PreviewComponents/VideoAlbumPreview/VideoAlbumPreview.js +189 -0
  32. package/dist/stories/PreviewComponents/VideoAlbumsPreview/VideoAlbumsPreview.js +175 -0
  33. package/dist/stories/PreviewComponents/VideoPreview/VideoPreview.js +172 -0
  34. package/dist/stories/PreviewComponents/globalStyles.js +26 -0
  35. package/dist/stories/Reusable Components/Cards/Card-style-10/CardStyle10.js +4 -3
  36. package/dist/stories/Reusable Components/Cards/Card-style-11/CardStyle11.js +8 -4
  37. package/dist/stories/Reusable Components/Cards/Card-style-6/CardStyle6.js +10 -4
  38. package/dist/stories/Reusable Components/Cards/Card-style-8/CardStyle8.js +4 -2
  39. package/dist/stories/Reusable Components/Cards/globalCardStyles.js +2 -2
  40. package/dist/stories/Reusable Components/Community/Community.js +53 -0
  41. package/dist/stories/Reusable Components/Gallery/Gallery.js +12 -17
  42. package/dist/stories/Reusable Components/ReactModal/ReactModal.js +11 -30
  43. package/dist/stories/Reusable Components/ReusableForm/ReusableForm.js +19 -2
  44. package/dist/stories/Reusable Components/ReusableList/ReusableList.js +9 -5
  45. package/dist/stories/Reusable Components/Tabs/Tabs.js +68 -0
  46. package/dist/stories/Sections/Sections.js +8 -2
  47. package/dist/stories/VideoAlbum/AlbumsGallery/AlbumsGallery.js +85 -19
  48. package/dist/stories/VideoAlbum/VideoSpace/VideoSpace.js +108 -4
  49. package/dist/stories/VideoAlbum/ViewAlbum/ViewAlbum.js +84 -9
  50. package/dist/stories/Widgets/MusicPlayerWidget/MusicPlayerWidget.js +16 -10
  51. package/dist/stories/Widgets/SpacesListWidget/SpacesListWidget.js +115 -0
  52. package/dist/stories/Widgets/UsersWidget/UsersWidget.js +30 -0
  53. package/dist/stories/helpers/util.js +36 -3
  54. package/dist/stories/store/communities.js +941 -0
  55. package/dist/stories/store/store.js +44 -0
  56. package/package.json +5 -2
  57. package/src/stories/Chat/Chat.jsx +110 -5
  58. package/src/stories/Common Inputs/Picker/Picker.jsx +47 -0
  59. package/src/stories/Common Inputs/TextField/TextField.jsx +1 -1
  60. package/src/stories/Community/Community.jsx +109 -0
  61. package/src/stories/Events/Event/Event.jsx +105 -4
  62. package/src/stories/Events/EventsList/EventsList.jsx +98 -17
  63. package/src/stories/Forms/CreateSpace/CreateSpace.jsx +73 -0
  64. package/src/stories/Library/Folders/Folders.jsx +94 -7
  65. package/src/stories/Library/Notes/Notes.jsx +73 -7
  66. package/src/stories/Modals/NavbarPreviewModal/NavbarPreviewModal.jsx +31 -0
  67. package/src/stories/Music Album/ViewAlbum/ViewAlbum.jsx +81 -11
  68. package/src/stories/Music Album/ViewAlbums/ViewAlbums.jsx +78 -34
  69. package/src/stories/Navbar/Navbar.jsx +1 -1
  70. package/src/stories/Pages/Events/Event/Event.jsx +12 -4
  71. package/src/stories/Pages/Music/MusicAlbums/MusicAlbums.jsx +0 -13
  72. package/src/stories/Pages/ViewWorld/styles.json +1 -1
  73. package/src/stories/Photo Album/ViewAlbum/ViewAlbum.jsx +68 -6
  74. package/src/stories/Photo Album/ViewAlbums/ViewAlbums.jsx +69 -9
  75. package/src/stories/Preview/Preview.jsx +9 -1
  76. package/src/stories/PreviewComponents/ChatPreview/ChatPreview.jsx +132 -0
  77. package/src/stories/PreviewComponents/EventPreview/EventPreview.jsx +116 -0
  78. package/src/stories/PreviewComponents/EventsPreview/EventsPreview.jsx +132 -0
  79. package/src/stories/PreviewComponents/FoldersPreview/FoldersPreview.jsx +127 -0
  80. package/src/stories/PreviewComponents/MusicAlbumPreview/MusicAlbumPreview.jsx +124 -0
  81. package/src/stories/PreviewComponents/MusicAlbumsPreview/MusicAlbumsPreview.jsx +126 -0
  82. package/src/stories/PreviewComponents/MusicPlayerPreview/MusicPlayerPreview.jsx +113 -0
  83. package/src/stories/PreviewComponents/NavbarPreview/NavbarPreview.jsx +93 -0
  84. package/src/stories/PreviewComponents/NotesPreview/NotesPreview.jsx +122 -0
  85. package/src/stories/PreviewComponents/PhotoAlbumPreview/PhotoAlbumPreview.jsx +129 -0
  86. package/src/stories/PreviewComponents/PhotoAlbumsPreview/PhotoAlbumsPreview.jsx +129 -0
  87. package/src/stories/PreviewComponents/SpacesListPreview/SpacesListPreview.jsx +138 -0
  88. package/src/stories/PreviewComponents/VideoAlbumPreview/VideoAlbumPreview.jsx +129 -0
  89. package/src/stories/PreviewComponents/VideoAlbumsPreview/VideoAlbumsPreview.jsx +124 -0
  90. package/src/stories/PreviewComponents/VideoPreview/VideoPreview.jsx +125 -0
  91. package/src/stories/PreviewComponents/globalStyles.js +20 -0
  92. package/src/stories/Reusable Components/Cards/Card-style-10/CardStyle10.jsx +5 -2
  93. package/src/stories/Reusable Components/Cards/Card-style-11/CardStyle11.jsx +5 -5
  94. package/src/stories/Reusable Components/Cards/Card-style-6/CardStyle6.jsx +12 -6
  95. package/src/stories/Reusable Components/Cards/Card-style-8/CardStyle8.jsx +2 -2
  96. package/src/stories/Reusable Components/Cards/globalCardStyles.js +2 -1
  97. package/src/stories/Reusable Components/Community/Community.jsx +47 -0
  98. package/src/stories/Reusable Components/Gallery/Gallery.jsx +10 -9
  99. package/src/stories/Reusable Components/ReactModal/ReactModal.jsx +3 -25
  100. package/src/stories/Reusable Components/ReusableForm/ReusableForm.jsx +18 -6
  101. package/src/stories/Reusable Components/ReusableList/ReusableList.jsx +9 -4
  102. package/src/stories/Reusable Components/Tabs/Tabs.jsx +67 -0
  103. package/src/stories/Sections/Sections.jsx +5 -2
  104. package/src/stories/VideoAlbum/AlbumsGallery/AlbumsGallery.jsx +64 -16
  105. package/src/stories/VideoAlbum/VideoSpace/VideoSpace.jsx +77 -1
  106. package/src/stories/VideoAlbum/ViewAlbum/ViewAlbum.jsx +64 -9
  107. package/src/stories/Widgets/MusicPlayerWidget/MusicPlayerWidget.jsx +13 -6
  108. package/src/stories/Widgets/SpacesListWidget/SpacesListWidget.jsx +78 -0
  109. package/src/stories/Widgets/UsersWidget/UsersWidget.jsx +20 -0
  110. package/src/stories/helpers/util.js +24 -2
  111. package/src/stories/store/communities.js +703 -0
  112. package/src/stories/store/store.js +33 -0
  113. package/src/stories/styling.json +92 -0
@@ -5,11 +5,14 @@ import styled from 'styled-components';
5
5
  import Gallery from '../../Reusable Components/Gallery/Gallery';
6
6
  import Modal from '../../Reusable Components/ReactModal/ReactModal';
7
7
  import CreateAlbum from '../../Forms/CreateMusicAlbum/CreateMusicAlbum';
8
-
9
- import { AiOutlineFileAdd, AiFillDelete } from "react-icons/ai";
10
-
8
+ import Tabs from '../../Reusable Components/Tabs/Tabs';
9
+ import Sections from '../../Sections/Sections';
10
+ import MusicAlbumsPreview from '../../PreviewComponents/MusicAlbumsPreview/MusicAlbumsPreview';
11
+ import Community from '../../Reusable Components/Community/Community';
11
12
 
12
13
 
14
+ import { AiOutlineFileAdd, AiFillDelete } from "react-icons/ai";
15
+ import { BsGear } from "react-icons/bs";
13
16
 
14
17
  const cardControls = [
15
18
  { icon: (<AiFillDelete />), action: 'delete', name: 'Delete album' },
@@ -17,43 +20,56 @@ const cardControls = [
17
20
 
18
21
  const galleryControls = [
19
22
  { icon: (<AiOutlineFileAdd />), action: 'add', name: 'Add Album' },
23
+ { icon: (<BsGear />), action: 'config', name: 'Config' },
20
24
  ]
21
25
 
22
26
  const ViewAlbums = ({
23
27
  albums,
24
- albumTitleColor,
25
- descColor,
28
+ community,
26
29
  ...props
27
30
  }) => {
28
- const cardStyles = {
29
- darkOnHover: true,
30
- cardTitleColor: albumTitleColor,
31
- descColor,
32
- controlsStyles: {
33
- showOnHover: true,
34
- position: 'center',
35
- iconBackground: "#272727",
36
- dropdownBackground: "#272727",
37
- dropdownFontColor: "white",
38
- dropdownItemHoverColor: "#414141",
39
- iconBackgroundHover: "#414141",
40
- iconBorderRadius: 100,
41
- iconSize: 25,
42
- iconsGap: 10,
43
- iconColor: 'white',
44
- containerPadding: 20
45
- }
46
- }
47
31
 
48
32
  const [showModal, setShowModal] = useState(false);
33
+ const [showConfigModal, setShowConfigModal] = useState(false);
34
+ const [centerContext, setCenterContext] = useState(<ViewAlbums preview={true} albums={albums} />)
35
+
36
+
37
+
38
+ let tabs = [
39
+ {
40
+ title: 'New', id: 'preview'
41
+ },
42
+ {
43
+ title: 'Context', id: 'community'
44
+ }
45
+ ]
46
+
47
+ const sections = [
48
+ {
49
+ title: 'Styles',
50
+ data: [
51
+ {
52
+ title: 'Styling', component: (<Tabs
53
+ title="Music Albums Config"
54
+ tabs={tabs}
55
+ />)
56
+ }
57
+ ]
58
+ }
59
+ ]
49
60
 
50
61
  const onHeaderIconClicked = (action) => {
51
- switch (action) {
52
- case 'add':
53
- setShowModal(true)
54
- break;
55
- default:
56
- break;
62
+ if (!props.preview) {
63
+ switch (action) {
64
+ case 'add':
65
+ setShowModal(true)
66
+ break;
67
+ case 'config':
68
+ setShowConfigModal(true)
69
+ break;
70
+ default:
71
+ break;
72
+ }
57
73
  }
58
74
  }
59
75
 
@@ -61,6 +77,9 @@ const ViewAlbums = ({
61
77
  props.cardIconClicked(action, index)
62
78
  }
63
79
 
80
+ const formChanged = (values) => {
81
+ setCenterContext(<ViewAlbums preview={true} albums={albums} {...values} />)
82
+ }
64
83
 
65
84
  const onAddAlbum = (album) => {
66
85
  setShowModal(false)
@@ -71,10 +90,15 @@ const ViewAlbums = ({
71
90
  setShowModal(false)
72
91
  }
73
92
 
93
+ const cancelConfig = () => {
94
+ setShowConfigModal(false);
95
+ localStorage.removeItem('formStyles')
96
+ }
97
+
74
98
  return (
75
99
  <Container>
76
100
  <Gallery
77
- galleryTitle={props.title || 'musicAlbums'}
101
+ galleryTitle={props.title || 'Music Albums'}
78
102
  data={albums}
79
103
  type="flat"
80
104
  cardStyle="card-style-6"
@@ -96,6 +120,27 @@ const ViewAlbums = ({
96
120
  saveBtnText={props.saveBtnText || "Create"}
97
121
  cancelBtnText={props.cancelBtnText || "Cancel"} />
98
122
  </Modal>
123
+ <Modal
124
+ modalIsOpen={showConfigModal}
125
+ closeModal={cancelConfig}
126
+ exitModalButton={(e) => (
127
+ <div></div>
128
+ )}
129
+ >
130
+ <Tabs
131
+ title="Albums Config"
132
+ tabs={tabs}>
133
+ <MusicAlbumsPreview
134
+ componentProps={{ albums: albums, title: 'Music Albums', preview: true }}
135
+ formChanged={formChanged}
136
+ id='preview'
137
+ />
138
+ <Community
139
+ center={centerContext}
140
+ community={community}
141
+ id="community" />
142
+ </Tabs>
143
+ </Modal>
99
144
  </Container>
100
145
  )
101
146
  }
@@ -103,9 +148,7 @@ const Container = styled.div`
103
148
  width: 100%;
104
149
  `
105
150
 
106
- ViewAlbums.defaultProps = {
107
- cardBackgroundColor: 'white'
108
- };
151
+ ViewAlbums.defaultProps = {};
109
152
 
110
153
  ViewAlbums.propTypes = {
111
154
  albums: PropTypes.array,
@@ -117,6 +160,7 @@ ViewAlbums.propTypes = {
117
160
  title: PropTypes.string,
118
161
  saveBtnText: PropTypes.string,
119
162
  cancelBtnText: PropTypes.string,
163
+ preview: PropTypes.bool
120
164
  };
121
165
 
122
166
  export default ViewAlbums
@@ -205,7 +205,7 @@ const NavBar = styled.div`
205
205
  `;
206
206
 
207
207
  const UniverseContainer = styled('div')({
208
- width: '346px',
208
+ width: '100%',
209
209
  height: '72px',
210
210
  display: 'flex',
211
211
  'align-items': 'center',
@@ -11,7 +11,6 @@ import BaseMaterial from '../../../Containers/BaseMaterial';
11
11
  import SpaceContainer from "../../../Reusable Components/SpaceContainer/SpaceContainer";
12
12
  import WidgetContainer from "../../../Reusable Components/WidgetContainer/WidgetContainer";
13
13
  import DetailedEvent from '../../../Events/Event/Event';
14
- import { addObjectToArray, deleteFromArrayByIndex } from '../../../helpers/util';
15
14
 
16
15
  import worldStyles from '../../ViewWorld/styles.json';
17
16
 
@@ -30,16 +29,25 @@ const Event = (props) => {
30
29
  }}
31
30
  />
32
31
  <WidgetContainer
33
- widgetType='list'
32
+ widgetType='spaces-list'
34
33
  widgetProps={{
35
34
  listTitle: 'Your Spaces',
36
35
  type: 'sectioned',
37
- data: SPACES,
36
+ spaces: SPACES,
38
37
  cardStyle: 'card-style-3',
38
+ cardClicked: () => alert('clicked'),
39
+ headerStyles:{
40
+ headerBackground: 'purple',
41
+ padding: 3,
42
+ controlsStyles:{
43
+ iconColor: 'white',
44
+ iconsGap: 5
45
+ }
46
+ },
39
47
  sectionHeaderStyles: {
40
48
  cardBorderSize: 2,
41
49
  cardPadding: 2,
42
- cardBackgroundColor: '#fff',
50
+ headerBackground: 'red',
43
51
  cardBorderColor: 'black',
44
52
  },
45
53
  customCardStyles: {
@@ -99,9 +99,6 @@ const MusicAlbums = (props) => {
99
99
  cardBackgroundColor: 'black',
100
100
  cardTitleColor: 'white',
101
101
  onHoverBackgroundColor: '#F6891F',
102
- controlsStyles: {
103
- showOnHover: true,
104
- }
105
102
  },
106
103
  }}
107
104
  />
@@ -127,16 +124,6 @@ const MusicAlbums = (props) => {
127
124
  }}
128
125
  customCardStyles={{
129
126
  darkOnHover: true,
130
- controlsStyles: {
131
- showOnHover: true,
132
- position: 'center',
133
- dropdownFontColor: "white",
134
- iconBorderRadius: 100,
135
- iconSize: 40,
136
- iconsGap: 10,
137
- iconColor: 'white',
138
- containerPadding: 20,
139
- }
140
127
  }}
141
128
  cardClicked={cardClicked}
142
129
  />
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "containerStyle": {
3
- "backgroundColor": "red"
3
+ "backgroundColor": "white"
4
4
  },
5
5
  "headStyle": {},
6
6
  "bodyStyle": {},
@@ -6,10 +6,19 @@ import AddPhoto from '../../Forms/AddPhoto/AddPhoto'
6
6
  import Gallery from '../../Reusable Components/Gallery/Gallery';
7
7
  import Modal from '../../Reusable Components/ReactModal/ReactModal';
8
8
  import DetailedPhoto from '../DetailedPhoto/DetailedPhoto';
9
+ import PhotoAlbumPreview from '../../PreviewComponents/PhotoAlbumPreview/PhotoAlbumPreview';
10
+ import Tabs from '../../Reusable Components/Tabs/Tabs';
11
+ import Sections from '../../Sections/Sections';
12
+ import Community from '../../Reusable Components/Community/Community';
13
+
14
+
9
15
  import { AiOutlineArrowLeft, AiOutlineArrowRight, AiOutlineClose, AiOutlineFileAdd, AiFillDelete } from "react-icons/ai";
16
+ import { BsGear } from "react-icons/bs";
17
+
10
18
 
11
19
  const galleryControls = [
12
20
  { icon: (<AiOutlineFileAdd />), action: 'add', name: 'Add Photo' },
21
+ { icon: (<BsGear />), action: 'config', name: 'Config' },
13
22
  ]
14
23
 
15
24
  const cardControls = [
@@ -21,6 +30,7 @@ const ViewAlbum = ({
21
30
  cardBackgroundColor,
22
31
  imgTitleColor,
23
32
  descColor,
33
+ community,
24
34
  ...props
25
35
  }) => {
26
36
 
@@ -46,10 +56,27 @@ const ViewAlbum = ({
46
56
  }
47
57
  }
48
58
 
49
- const [showModal, setShowModal] = useState(false)
50
- const [showImgModal, setShowImgModal] = useState(false)
59
+ const [showModal, setShowModal] = useState(false);
60
+ const [showConfigModal, setShowConfigModal] = useState(false);
61
+ const [showImgModal, setShowImgModal] = useState(false);
51
62
  const [openedImgIndex, setOpenedImgIndex] = useState(null);
52
- const [openedImg, setOpenedImg] = useState(null)
63
+ const [openedImg, setOpenedImg] = useState(null);
64
+
65
+ const [centerContext, setCenterContext] = useState(<ViewAlbum preview={true} album={album} />)
66
+
67
+ const formChanged = (values) => {
68
+ setCenterContext(<ViewAlbum preview={true} album={album} {...values} />)
69
+ }
70
+
71
+ let tabs = [
72
+ {
73
+ title: 'New', id: 'preview'
74
+ },
75
+ {
76
+ title: 'Context', id: 'community'
77
+ }
78
+ ]
79
+
53
80
 
54
81
  const handleUserKeyPress = useCallback(event => {
55
82
  const { key } = event;
@@ -66,17 +93,23 @@ const ViewAlbum = ({
66
93
  }, [openedImgIndex, handleUserKeyPress]);
67
94
 
68
95
  const onIconClicked = (action) => {
69
- switch (action) {
96
+ if(!props.preview){
97
+ switch (action) {
70
98
  case 'add':
71
99
  setShowModal(true)
72
100
  break;
101
+ case 'config':
102
+ setShowConfigModal(true)
103
+ break;
73
104
  default:
74
105
  break;
75
- }
106
+ }}
76
107
  }
77
108
 
78
109
  const cardIconClicked = (action, index) => {
79
- props.cardIconClicked(action, index)
110
+ if (!props.preview) {
111
+ props.cardIconClicked(action, index)
112
+ }
80
113
  }
81
114
 
82
115
  const onAddPhoto = (photo) => {
@@ -105,6 +138,11 @@ const ViewAlbum = ({
105
138
  }
106
139
  }
107
140
 
141
+ const cancelConfig = () => {
142
+ setShowConfigModal(false);
143
+ localStorage.removeItem('formStyles')
144
+ }
145
+
108
146
  return (
109
147
  <Container>
110
148
  <Gallery
@@ -154,6 +192,29 @@ const ViewAlbum = ({
154
192
  <AiOutlineArrowRight />
155
193
  </RightIconContainer>
156
194
  </Modal>
195
+ <Modal
196
+ modalIsOpen={showConfigModal}
197
+ closeModal={cancelConfig}
198
+ exitModalButton={(e) => (
199
+ <div></div>
200
+ )}
201
+ >
202
+ <Tabs
203
+ title="Photo Album Config"
204
+ tabs={tabs}
205
+ id='styling'
206
+ >
207
+ <PhotoAlbumPreview
208
+ componentProps={{ album, title: props.title || 'Photo Album', preview: true }}
209
+ formChanged={formChanged}
210
+ id='preview'
211
+ />
212
+ <Community
213
+ center={centerContext}
214
+ community={community}
215
+ id="community" />
216
+ </Tabs>
217
+ </Modal>
157
218
  </Container>
158
219
  )
159
220
  }
@@ -234,6 +295,7 @@ ViewAlbum.propTypes = {
234
295
  title: PropTypes.string,
235
296
  saveBtnText: PropTypes.string,
236
297
  saveBtnText: PropTypes.string,
298
+ preview: PropTypes.bool
237
299
  }
238
300
 
239
301
  export default ViewAlbum;
@@ -5,8 +5,13 @@ import PropTypes from 'prop-types';
5
5
  import CreateAlbum from '../../Forms/CreateAlbum/CreateAlbum'
6
6
  import Gallery from '../../Reusable Components/Gallery/Gallery';
7
7
  import Modal from '../../Reusable Components/ReactModal/ReactModal';
8
+ import PhotoAlbumsPreview from '../../PreviewComponents/PhotoAlbumsPreview/PhotoAlbumsPreview';
9
+ import Tabs from '../../Reusable Components/Tabs/Tabs';
10
+ import Sections from '../../Sections/Sections';
11
+ import Community from '../../Reusable Components/Community/Community';
8
12
 
9
13
  import { AiOutlineFileAdd, AiFillDelete } from "react-icons/ai";
14
+ import { BsGear } from "react-icons/bs";
10
15
 
11
16
  const cardControls = [
12
17
  { icon: (<AiFillDelete />), action: 'delete', name: 'Delete album' },
@@ -14,26 +19,52 @@ const cardControls = [
14
19
 
15
20
  const galleryControls = [
16
21
  { icon: (<AiOutlineFileAdd />), action: 'add', name: 'Add Album' },
22
+ { icon: (<BsGear />), action: 'config', name: 'Config' },
17
23
  ]
18
24
 
19
25
  const ViewAlbums = ({
20
26
  albums,
27
+ community,
21
28
  ...props }) => {
22
29
 
23
- const [showModal, setShowModal] = useState(false)
30
+ const [showModal, setShowModal] = useState(false);
31
+ const [showConfigModal, setShowConfigModal] = useState(false);
32
+ const [centerContext, setCenterContext] = useState(<ViewAlbums preview={true} albums={albums} />)
33
+
34
+ const formChanged = (values) => {
35
+ setCenterContext(<ViewAlbums preview={true} albums={albums} {...values} />)
36
+ }
37
+
38
+
39
+ let tabs = [
40
+ {
41
+ title: 'New', id: 'preview'
42
+ },
43
+ {
44
+ title: 'Context', id: 'community'
45
+ }
46
+ ]
47
+
24
48
 
25
49
  const onIconClicked = (action) => {
26
- switch (action) {
27
- case 'add':
28
- setShowModal(true)
29
- break;
30
- default:
31
- break;
50
+ if (!props.preview) {
51
+ switch (action) {
52
+ case 'add':
53
+ setShowModal(true)
54
+ break;
55
+ case 'config':
56
+ setShowConfigModal(true)
57
+ break;
58
+ default:
59
+ break;
60
+ }
32
61
  }
33
62
  }
34
63
 
35
64
  const cardIconClicked = (action, index) => {
36
- props.cardIconClicked(action, index)
65
+ if (!props.preview) {
66
+ props.cardIconClicked(action, index)
67
+ }
37
68
  }
38
69
 
39
70
  const onAddAlbum = (album) => {
@@ -45,6 +76,11 @@ const ViewAlbums = ({
45
76
  setShowModal(false)
46
77
  }
47
78
 
79
+ const cancelConfig = () => {
80
+ setShowConfigModal(false);
81
+ localStorage.removeItem('formStyles')
82
+ }
83
+
48
84
  return (
49
85
  <Container>
50
86
  <Gallery
@@ -68,6 +104,29 @@ const ViewAlbums = ({
68
104
  saveHandler={onAddAlbum}
69
105
  cancelHandler={cancelHandler} />
70
106
  </Modal>
107
+ <Modal
108
+ modalIsOpen={showConfigModal}
109
+ closeModal={cancelConfig}
110
+ exitModalButton={(e) => (
111
+ <div></div>
112
+ )}
113
+ >
114
+ <Tabs
115
+ title="Photo Albums Config"
116
+ tabs={tabs}
117
+ id='styling'
118
+ >
119
+ <PhotoAlbumsPreview
120
+ componentProps={{ albums, title: props.title || 'Photo Albums', preview: true }}
121
+ formChanged={formChanged}
122
+ id='preview'
123
+ />
124
+ <Community
125
+ center={centerContext}
126
+ community={community}
127
+ id="community" />
128
+ </Tabs>
129
+ </Modal>
71
130
  </Container>
72
131
  )
73
132
  }
@@ -85,7 +144,8 @@ ViewAlbums.propTypes = {
85
144
  onAddAlbum: PropTypes.func,
86
145
  title: PropTypes.string,
87
146
  headerStyles: PropTypes.object,
88
- customCardStyles: PropTypes.object
147
+ customCardStyles: PropTypes.object,
148
+ preview: PropTypes.bool
89
149
  }
90
150
 
91
151
  export default ViewAlbums
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import ProopTypes from 'prop-types';
3
+ import PropTypes from 'prop-types';
4
4
 
5
5
  import { getComponentType } from '../helpers/util';
6
6
 
@@ -24,4 +24,12 @@ const Container = styled.div`
24
24
  width: 100%;
25
25
  `
26
26
 
27
+ Preview.defaultProps = {};
28
+
29
+ Preview.propTypes = {
30
+ type: PropTypes.string,
31
+ componentProps: PropTypes.object,
32
+ stylingProps: PropTypes.object
33
+ }
34
+
27
35
  export default Preview;
@@ -0,0 +1,132 @@
1
+ import React, { useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Preview from '../../Preview/Preview';
4
+ import ReusableForm from '../../Reusable Components/ReusableForm/ReusableForm';
5
+
6
+ import { Container, Left, Right } from '../globalStyles';
7
+ import Picker from '../../Common Inputs/Picker/Picker';
8
+ import TextField from '../../Common Inputs/TextField/TextField';
9
+
10
+
11
+ const ChatPreview = (props) => {
12
+ const [chatStyles, setChatStyles] = useState({});
13
+ const initialValues = JSON.parse(localStorage.getItem('formStyles')) || {
14
+ headerStyles: {
15
+ headerBackground: '',
16
+ padding: 0,
17
+ titleColor: '',
18
+ titleFontSize: '',
19
+ titleFontWeight: '',
20
+ controlsStyles: {
21
+ iconSize: '',
22
+ iconColor: ''
23
+ }
24
+ },
25
+ customCardStyles: {
26
+ cardBackgroundColor: '',
27
+ onHoverBackgroundColor: '',
28
+ cardRadius: '',
29
+ cardTitleFontSize: '',
30
+ cardTitleFontWeight: '',
31
+ cardTitleColor: '',
32
+ cardImageRadius: '',
33
+ cardDescriptionFontSize: '',
34
+ cardDescriptionColor: '',
35
+ cardPadding: 0,
36
+ imgSize: 0,
37
+ cardBorderSize: 0,
38
+ cardBorderColor: 'purple',
39
+ dateColor: ''
40
+ }
41
+ }
42
+
43
+ const sections = [
44
+ {
45
+ title: "Header Styles",
46
+ body: [
47
+ (<Picker label="Header Background" name="headerStyles.headerBackground" />),
48
+ (<TextField type="number" label="Padding" name="headerStyles.padding" />),
49
+ (<Picker label="Title Color" name="headerStyles.titleColor" />),
50
+ (<TextField type="number" label="Title Font Size" name="headerStyles.titleFontSize" />),
51
+ (<TextField type="number" label="Title Font Weight" name="headerStyles.titleFontWeight" />),
52
+ (<TextField type="number" label="Controls Size" name="headerStyles.controlsStyles.iconSize" />),
53
+ (<Picker label="Controls Color" name="headerStyles.controlsStyles.iconColor" />),
54
+ ]
55
+ },
56
+ {
57
+ title: "Card Styles",
58
+ body: [
59
+ (<Picker label="Card Background" name="customCardStyles.cardBackgroundColor" />),
60
+ (<Picker label="Hover Color" name="customCardStyles.onHoverBackgroundColor" />),
61
+ (<TextField type="number" label="Card Radius" name="customCardStyles.cardRadius" />),
62
+ (<TextField type="number" label="Title Font Size" name="customCardStyles.cardTitleFontSize" />),
63
+ (<TextField type="number" label="Title Font Weight" name="customCardStyles.cardTitleFontWeight" />),
64
+ (<Picker label="Title Color" name="customCardStyles.cardTitleColor" />),
65
+ (<TextField type="number" label="Card Image Radius" name="customCardStyles.cardImageRadius" />),
66
+ (<TextField type="number" label="Text Font Size" name="customCardStyles.cardDescriptionFontSize" />),
67
+ (<Picker label="Text Font Color" name="customCardStyles.cardDescriptionColor" />),
68
+ (<TextField type="number" label="Card Padding" name="customCardStyles.cardPadding" />),
69
+ (<TextField type="number" label="Image Size" name="customCardStyles.imgSize" />),
70
+ (<TextField type="number" label="Border Size" name="customCardStyles.cardBorderSize" />),
71
+ (<Picker label="Border Color" name="customCardStyles.cardBorderColor" />),
72
+ (<Picker label="Date Color" name="customCardStyles.dateColor" />),
73
+ ]
74
+ },
75
+ ]
76
+
77
+ const handleChange = (values) => {
78
+ if(values){
79
+ props.formChanged(values)
80
+ setChatStyles(values)
81
+ localStorage.setItem('formStyles', JSON.stringify(values))
82
+ }
83
+ }
84
+
85
+ const submitHandler = (values) => {
86
+ console.log(values);
87
+ }
88
+
89
+ const cancelHandler = () => {
90
+ console.log('Canceled')
91
+ }
92
+ return (
93
+ <Container>
94
+ <Left>
95
+ <ReusableForm
96
+ formTitle="Chat Styles"
97
+ initialValues={initialValues}
98
+ sections={sections}
99
+ headerStyles={{
100
+ padding: 10,
101
+ headerBackground: 'black',
102
+ titleColor: '#ffff',
103
+ }}
104
+ sectionHeaderStyles={{
105
+ padding: 6,
106
+ headerBackground: '#FE1744',
107
+ titleColor: '#ffff',
108
+ }}
109
+ bodyPadding={10}
110
+ saveBtnText="Save"
111
+ cancelBtnText="Cancel"
112
+ saveBtnHandle={submitHandler}
113
+ cancelHandler={cancelHandler}
114
+ handleChange={handleChange}
115
+ bodyRowGap={20}
116
+ bodyColumnGap={10}
117
+ />
118
+ </Left>
119
+ <Right>
120
+ <Preview type={'Chat'} componentProps={props.componentProps} stylingProps={chatStyles} />
121
+ </Right>
122
+ </Container>
123
+ );
124
+ };
125
+
126
+ ChatPreview.defaultProps = {};
127
+
128
+ ChatPreview.propTypes = {
129
+ componentProps: PropTypes.object
130
+ }
131
+
132
+ export default ChatPreview;